Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph Namespace Reference

Main namespace for Aleph-w library functions. More...

Namespaces

namespace  adaptive_huffman_detail
 
namespace  adversarial_search_detail
 
namespace  arrayheap_detail
 
namespace  bidirectional_bfs_detail
 
namespace  bin_node_detail
 
namespace  blossom_detail
 
namespace  blossom_weighted_detail
 
namespace  bucket_sort_detail
 
namespace  CA
 
namespace  cancellation_detail
 
namespace  Compiler_Ast_Detail
 
namespace  Compiler_Backend_C_Detail
 
namespace  Compiler_Bytecode_Detail
 
namespace  Compiler_Bytecode_Interpreter_Detail
 
namespace  Compiler_CFG_Detail
 
namespace  Compiler_Dataflow_Detail
 
namespace  Compiler_Driver_Detail
 
namespace  Compiler_HIR_Detail
 
namespace  Compiler_IR_Detail
 
namespace  Compiler_Module_Binder_Detail
 
namespace  Compiler_Module_Linker_Detail
 
namespace  Compiler_Module_Name_Resolver_Detail
 
namespace  Compiler_Module_Name_Table_Detail
 
namespace  Compiler_Module_Resolver_Detail
 
namespace  Compiler_Module_Semantic_Environment_Detail
 
namespace  Compiler_SSA_Detail
 
namespace  Compiler_Token_Detail
 
namespace  concat_detail
 
namespace  concepts_detail
 
namespace  const_graph_view_detail
 
namespace  const_iterator_detail
 
namespace  cpp_compat_detail
 
namespace  detail
 
namespace  df_tree_detail
 
namespace  dfs_stack_detail
 
namespace  dp_optimization_detail
 
namespace  dry_detail
 
namespace  dynarrayheap_detail
 
namespace  error_detail
 What the macros that throw need besides ExceptionBuilder.
 
namespace  eulerian_detail
 
namespace  function_detail
 
namespace  functional_detail
 
namespace  graph_coloring_detail
 
namespace  graph_concepts_detail
 
namespace  graph_dry_detail
 
namespace  graph_to_tree_detail
 
namespace  graph_utils_detail
 
namespace  hamiltonian_detail
 
namespace  hash_fct_detail
 
namespace  hash_table_detail
 
namespace  hld_detail
 
namespace  howard_detail
 
namespace  htlist_detail
 
namespace  ida_star_detail
 
namespace  in_arcs_detail
 
namespace  interval_tree_detail
 
namespace  johnson_detail
 
namespace  k_shortest_paths_detail
 
namespace  knapsack_detail
 
namespace  kosaraju_detail
 Depth-first search that computes finish times in postorder (Phase 1).
 
namespace  latex_floyd_detail
 
namespace  lca_detail
 
namespace  lis_detail
 
namespace  mat_path_detail
 
namespace  matgraph_detail
 
namespace  matrix_chain_detail
 
namespace  min_cost_matching_detail
 
namespace  min_mean_cycle_detail
 
namespace  mincost_detail
 Find shortest path using Dijkstra with potentials.
 
namespace  multi_poly_detail
 Internal helpers for multivariate polynomial operations.
 
namespace  negative_cycles_detail
 
namespace  net_detail
 
namespace  packed_matrix_detail
 
namespace  parallel_detail
 
namespace  parallel_zip_detail
 
namespace  patricia_trie_detail
 
namespace  pdq_detail
 Pattern-defeating quicksort, the algorithm of introsort().
 
namespace  planarity_detail
 
namespace  polynomial_detail
 Internal helpers for polynomial operations.
 
namespace  random_detail
 
namespace  Search
 User-facing facade exported by the umbrella search header.
 
namespace  search_engine_detail
 Shared helper utilities used internally by all search engines.
 
namespace  shortest_path_detail
 Namespace for shortest path algorithm implementation details.
 
namespace  sort_utils_detail
 
namespace  sparse_table_detail
 
namespace  state_search_detail
 
namespace  std_zip_detail
 
namespace  stl_comb_detail
 
namespace  stl_detail
 
namespace  stl_zip_detail
 
namespace  string_dp_detail
 
namespace  string_search_detail
 
namespace  subset_sum_detail
 
namespace  suffix_structures_detail
 
namespace  test_helpers
 
namespace  Testing
 
namespace  TestVisual
 
namespace  timsort_detail
 
namespace  tree_decomposition_detail
 
namespace  tree_dp_detail
 
namespace  tree_node_detail
 
namespace  uni_functional_detail
 
namespace  uni_unzip_detail
 
namespace  uni_zip_detail
 
namespace  zip_detail
 
namespace  zip_index_detail
 

Classes

struct  __const_iterator
 STL-compatible const iterator wrapper. More...
 
class  __In_Filt
 Filter the incoming arcs. More...
 
struct  __iterator
 STL-compatible mutable iterator wrapper. More...
 
class  __Out_Filt
 Filter the outcoming arcs. More...
 
struct  __Res_Arc
 Arc of the residual network of the preflow-push algorithms. More...
 
struct  __Shade_Arc
 
struct  __Shade_Node
 
struct  _Identity
 
struct  _Select1st
 
struct  _Select2nd
 
class  AABBTree
 Axis-aligned bounding box tree for spatial queries. More...
 
struct  AABBTreeQueryVizResult
 Result bundle for AABB query visualization. More...
 
class  Abstract_Euclidian_Plane
 
class  AbstractTreeNodeAllocator
 
class  Adaptive_Huffman_Decoder
 Incremental FGK decoder accepting arbitrarily fragmented bits. More...
 
class  Adaptive_Huffman_Encoder
 Stateful, one-pass FGK Huffman encoder for binary byte strings. More...
 
struct  Add_Max_Policy
 Range add + range max policy. More...
 
struct  Add_Min_Policy
 Range add + range min policy. More...
 
struct  Add_Sum_Policy
 Range add + range sum policy. More...
 
struct  AddLazyTag
 Additive lazy tag: adds a delta to every node on a path. More...
 
struct  AdversarialIterativeDeepeningIteration
 Result of one iterative-deepening iteration. More...
 
struct  AdversarialIterativeDeepeningOptions
 Controls for adversarial iterative deepening. More...
 
struct  AdversarialIterativeDeepeningResult
 Aggregate result of adversarial iterative deepening. More...
 
struct  AdversarialSearchResult
 Result of one adversarial search execution. More...
 
struct  AdversarialSearchStats
 Statistics collected by adversarial search engines. More...
 
class  AdversarialTraceCollector
 Collector that stores trace events in an Aleph list. More...
 
struct  AdversarialTraceEvent
 One trace event produced by an adversarial search. More...
 
struct  AdversarialTranspositionEntry
 Cached adversarial-search entry stored in transposition tables. More...
 
struct  AdversarialTranspositionKey
 Convenience alias for adversarial transposition tables. More...
 
class  Ady_Mat
 Auxiliary adjacency matrix with custom entry type. More...
 
class  Ady_MaT
 
class  AhArenaAllocator
 Arena allocator for fast bump-pointer allocation. More...
 
class  AHMapping
 A generic key-value mapping container with inverse operation support. More...
 
class  Aho_Corasick
 Aho-Corasick multi-pattern automaton. More...
 
class  AlDomain
 Generic domain class based on hash set. More...
 
struct  Aleph_Hash
 Primary hash functor used internally by dft_hash_fct / snd_hash_fct. More...
 
struct  Aleph_Hash< double >
 
struct  Aleph_Hash< float >
 
class  Alpha_Beta
 Adversarial search engine with Alpha-Beta pruning. More...
 
class  AlphaShape
 Alpha shape of a point set. More...
 
class  AndrewMonotonicChainConvexHull
 Andrew's monotonic chain convex hull algorithm. More...
 
struct  Arc_Iterator
 Filtered iterator on all the arcs of a graph. More...
 
struct  Arc_List_Order
 The order of the arc iterator of the graph, as a comparison for Bounded_Cycle_Index: it tells no arc apart from another. More...
 
class  Arc_Node
 
class  Arcs_Index
 Builds an arc index for fast lookup by source/target nodes. More...
 
struct  ArenaTreeAllocator
 Allocator of the nodes of a tree in an arena. More...
 
class  Array
 Simple dynamic array with automatic resizing and functional operations. More...
 
class  Array_Container
 Lightweight wrapper that provides Aleph-w container interface for raw arrays. More...
 
class  Array_Graph
 
class  Array_Iterator
 Iterator wrapper for C++ raw arrays. More...
 
class  ArrayHeap
 Fixed-capacity binary heap backed by a raw array. More...
 
class  ArrayQueue
 Queue implemented with a single dynamic array. More...
 
class  ArrayStack
 Stack implemented with simple dynamic array and with bounds verification. More...
 
struct  AspirationWindow
 Aspiration-window configuration for iterative deepening. More...
 
struct  Assign_Sum_Policy
 Range assign + range sum policy. More...
 
struct  AssignLazyTag
 Assignment lazy tag: sets every node on a path to a fixed value. More...
 
struct  AssignmentResult
 Result of assignment problem. More...
 
class  AStar_Min_Path
 A* algorithm for finding the shortest path between two nodes. More...
 
struct  Attr
 
struct  Avl_Tree
 AVL binary search tree with nodes without a virtual destructor. More...
 
struct  Avl_Tree_Rk
 Ranked AVL tree with nodes without a virtual destructor. More...
 
struct  Avl_Tree_Rk_Vtl
 Ranked AVL tree with nodes with a virtual destructor. More...
 
struct  Avl_Tree_Vtl
 AVL binary search tree with nodes with a virtual destructor. More...
 
class  AvlNodeRk
 Extended AVL node with subtree counter. More...
 
class  AvlNodeRk_Data
 AVL node data with balance factor and subtree count. More...
 
class  AvlNodeRkVtl
 
class  bad_expected_access
 Exception thrown by expected::value() when no value is held. More...
 
struct  BaseballEliminationResult
 Result of baseball elimination check. More...
 
class  Bellman_Ford
 Bellman-Ford algorithm for shortest paths with negative weights. More...
 
struct  Bellman_Ford_Negative_Cycle
 Detects if a negative cycle exists and eventually computes it. More...
 
class  BestSolution
 Tracks the best solution seen so far according to a comparator. More...
 
class  BezierCurve
 Quadratic and cubic Bézier curves with exact rational arithmetic. More...
 
class  Bidirectional_BFS
 Bidirectional BFS for finding shortest unweighted paths. More...
 
struct  binary_function
 
class  binary_negate
 
class  binder1st
 
class  binder2nd
 
struct  BinHeap
 Node heap without virtual destructor. More...
 
class  BinHeapNode
 
class  BinHeapNode_Data
 
class  BinHeapNodeVtl
 
struct  BinHeapVtl
 Heap of nodes with virtual destructor. More...
 
class  BinNode
 Node for binary search tree. More...
 
class  BinNodeInfixIterator
 Inorder iterator on the nodes of a binary tree. More...
 
class  BinNodePrefixIterator
 Preorder iterator on the nodes of a binary tree. More...
 
class  BinNodeVtl
 
class  BinNodeXt
 Node for extended binary search tree. More...
 
class  BinNodeXt_Data
 
class  BinNodeXtVtl
 
struct  BinTree
 Binary search tree with nodes without virtual destructors,. More...
 
class  BinTree_Operation
 Functor encompassing basic operation for binary search trees. More...
 
struct  BinTreeVtl
 Binary search tree with nodes with virtual destructors,. More...
 
class  BinTreeXt_Iterator
 Base iterator template for ranked binary search trees. More...
 
class  BinTreeXt_Operation
 Functor encompassing basic operation for extended binary search trees. More...
 
struct  Bit_Column
 Inclusive range of the integers that a column holds. More...
 
class  Bit_Fields
 Bit fields for nodes and arcs used for marking visit state during processing. More...
 
class  Bit_Mat_Graph
 Bit matrix for graph connectivity. More...
 
class  BitArray
 Contiguous array of bits. More...
 
class  Bloom_Filter
 Bloom filter implementation. More...
 
struct  Blossom_Weighted_Result
 Result of weighted matching. More...
 
class  BooleanPolygonOperations
 Boolean operations on simple polygons (union, intersection, difference) using the Greiner-Hormann algorithm. More...
 
class  Bounded_Cycle_Index
 Index of the simple cycles of bounded length of a digraph. More...
 
struct  Bounded_Cycle_Result
 Result of most_negative_cycle_bounded(). More...
 
class  BoundedChannel
 Bounded blocking channel for producer-consumer workflows. More...
 
class  Branch_And_Bound
 Reusable branch-and-bound engine over implicit state spaces. More...
 
struct  BranchAndBoundResult
 Result of a branch-and-bound execution. More...
 
struct  BranchAndBoundStats
 Branch-and-bound specific statistics. More...
 
class  Breadth_First_Traversal
 Stateful breadth-first traversal functor. More...
 
class  BruteForceConvexHull
 Brute force convex hull algorithm. More...
 
struct  Buf128Bits
 
class  Build_Grid
 Functor to build a 2D grid graph with 8-connectivity. More...
 
class  Build_Spanning_Tree
 Build a spanning tree from an array of arcs. More...
 
class  Build_Subgraph
 Build a mapped subgraph from a graph starting at a given node. More...
 
class  Byte
 
class  CancellationSource
 Cooperative cancellation source paired with CancellationToken. More...
 
struct  CancellationState
 Shared state for cooperative cancellation. More...
 
class  CancellationToken
 Read-only cooperative cancellation token. More...
 
struct  Capacity_Scaling_Maximum_Flow
 Functor wrapper for capacity scaling. More...
 
struct  Cartesian_Tree
 Cartesian Tree for min-heap (range minimum). More...
 
struct  Cartesian_Tree_RMaxQ
 Range maximum queries via Cartesian Tree. More...
 
struct  Cartesian_Tree_RMQ
 Range minimum queries via Cartesian Tree. More...
 
class  ChaikinSmoothing
 Chaikin corner-cutting subdivision for polygon smoothing. More...
 
struct  Chebyshev_Heuristic
 Chebyshev (L-infinity) distance heuristic for 8-connected grids. More...
 
struct  CirculationResult
 Result of a circulation problem. More...
 
class  ClosestPairDivideAndConquer
 Closest pair of points via divide and conquer. More...
 
struct  CmpContainer
 
class  Cnode
 Low-level prefix tree node for storing character sequences. More...
 
struct  Commodity
 Commodity definition for multi-commodity flow. More...
 
class  Compact_Cuckoo_Filter
 Memory-optimized Cuckoo Filter with bit-packed fingerprints. More...
 
class  Compact_Quotient_Filter
 Memory-optimized quotient filter with bit-packed slots. More...
 
struct  Compare_Dnode
 Comparator specialization for Dnode objects. More...
 
struct  Compare_Dup
 
struct  Compare_Height
 Compare nodes by height (higher first). More...
 
class  Compare_Tnode
 Helper class to compare nodes of a linked list. More...
 
class  Compiler_Ast_Context
 Arena-backed ownership context for AST nodes. More...
 
struct  Compiler_Ast_Node
 Abstract base class for all AST nodes. More...
 
struct  Compiler_Binary_Expr
 Node representing an infix binary operation. More...
 
struct  Compiler_Block_Stmt
 Node representing a braced sequence of statements. More...
 
struct  Compiler_Break_Stmt
 Node representing a loop break. More...
 
struct  Compiler_Bytecode_Block_Info
 Debug metadata that maps original IR basic blocks to bytecode PCs. More...
 
struct  Compiler_Bytecode_Constant
 One constant stored in a function-level constant pool. More...
 
class  Compiler_Bytecode_Context
 Arena-backed ownership context for bytecode functions and modules. More...
 
struct  Compiler_Bytecode_Execution_Result
 Result of one bytecode execution request. More...
 
struct  Compiler_Bytecode_Function
 Bytecode for one lowered function or top-level body. More...
 
struct  Compiler_Bytecode_Instruction
 One lowered bytecode instruction. More...
 
class  Compiler_Bytecode_Lowering
 Lowers explicit IR into register-based bytecode. More...
 
struct  Compiler_Bytecode_Module
 Bytecode module sharing global slot layout with the source IR module. More...
 
struct  Compiler_Bytecode_Runtime_Error
 Structured runtime error produced by the bytecode VM. More...
 
struct  Compiler_Bytecode_Validation_Report
 Structural validation report for one bytecode function or module. More...
 
struct  Compiler_Bytecode_Value
 One value stored in bytecode registers, locals, or globals. More...
 
class  Compiler_Bytecode_VM
 Small portable VM for executing one Compiler_Bytecode_Module. More...
 
class  Compiler_C_Backend
 Emits portable C from one validated Compiler_IR_Module. More...
 
struct  Compiler_C_Backend_Emission
 Result of one C backend emission request. More...
 
struct  Compiler_C_Backend_Options
 Options that control one C backend emission request. More...
 
struct  Compiler_Call_Expr
 Node representing a function or method call. More...
 
struct  Compiler_CFG_Block
 Represents a single basic block in a CFG. More...
 
class  Compiler_CFG_Context
 Arena-backed ownership context for CFG objects. More...
 
struct  Compiler_CFG_Function
 CFG representation of a single function or top-level body. More...
 
class  Compiler_CFG_Lowering
 Transformation engine that lowers typed HIR into reusable CFGs. More...
 
struct  Compiler_CFG_Module
 Aggregates all lowered CFGs for a compilation unit. More...
 
struct  Compiler_CFG_Terminator
 Detailed information about a block's termination. More...
 
struct  Compiler_CFG_Validation_Report
 Detailed results of a CFG structural validation. More...
 
struct  Compiler_Continue_Stmt
 Node representing a loop continuation. More...
 
struct  Compiler_Dataflow_Bit_Set
 Small reusable bit-set for slot-domain dataflow analyses. More...
 
struct  Compiler_Dataflow_Constant
 One propagated constant value in the local-slot lattice. More...
 
struct  Compiler_Dataflow_Function_Analysis
 Full dataflow result for one IR function or top-level body. More...
 
struct  Compiler_Dataflow_Uninitialized_Read
 One definite-assignment finding for an uninitialized local read. More...
 
struct  Compiler_Dataflow_Validation_Report
 Validation report for analysis and optimization passes. More...
 
struct  Compiler_Dead_Code_Elimination_Result
 Result of applying dead-code elimination to one IR function. More...
 
class  Compiler_Driver
 Reusable orchestration object for compiler pipeline experiments. More...
 
struct  Compiler_Driver_Artifact
 Stable text artifact produced during one pipeline run. More...
 
struct  Compiler_Driver_Options
 Immutable configuration shared by all runs of one driver object. More...
 
struct  Compiler_Driver_Run_Output
 Structured output of a run action. More...
 
struct  Compiler_Driver_Source
 One logical input source handled by a compiler frontend. More...
 
struct  Compiler_Enum_Decl
 Nominal top-level enum declaration with unit variants. More...
 
struct  Compiler_Enum_Variant
 One named variant inside a parsed enum declaration. More...
 
struct  Compiler_Expr
 Abstract base class for expression nodes. More...
 
struct  Compiler_Expr_Stmt
 Node representing an expression evaluated as a statement. More...
 
struct  Compiler_Expr_Type_Assignment
 Recorded inferred type for one expression node. More...
 
class  Compiler_Frontend
 Abstract language frontend that can feed reusable drivers. More...
 
struct  Compiler_Function_Decl
 Node representing a top-level function declaration. More...
 
struct  Compiler_Function_Type_Assignment
 Recorded inferred type for one function declaration. More...
 
struct  Compiler_Function_Type_Expr
 Function type syntax such as fn(Int, T) -> Bool. More...
 
class  Compiler_Generic_Driver
 Reusable orchestration object built on top of Compiler_Frontend. More...
 
struct  Compiler_Generic_Driver_Options
 Configuration shared by all runs of Compiler_Generic_Driver. More...
 
struct  Compiler_Grouping_Expr
 Node representing an expression explicitly wrapped in parentheses. More...
 
struct  Compiler_HIR_Binary_Expr
 Typed binary expression. More...
 
struct  Compiler_HIR_Block_Stmt
 Structured block statement. More...
 
struct  Compiler_HIR_Break_Stmt
 break statement in HIR. More...
 
class  Compiler_HIR_Builder
 Small reusable helper that allocates and connects HIR nodes. More...
 
struct  Compiler_HIR_Call_Expr
 Typed function call expression. More...
 
struct  Compiler_HIR_Constant_Expr
 Typed constant expression. More...
 
class  Compiler_HIR_Context
 Arena-backed ownership context for HIR nodes. More...
 
struct  Compiler_HIR_Continue_Stmt
 continue statement in HIR. More...
 
struct  Compiler_HIR_Eval_Stmt
 Expression statement in HIR. More...
 
struct  Compiler_HIR_Expr
 Base class for HIR expressions. More...
 
struct  Compiler_HIR_Function
 Typed HIR function. More...
 
struct  Compiler_HIR_If_Stmt
 Structured conditional statement. More...
 
struct  Compiler_HIR_Invalid_Expr
 Invalid HIR expression placeholder. More...
 
struct  Compiler_HIR_Invalid_Stmt
 Invalid HIR statement placeholder. More...
 
struct  Compiler_HIR_Let_Stmt
 Typed lexical binding statement. More...
 
class  Compiler_HIR_Lowering
 Lowers the MVP typed AST into HIR. More...
 
struct  Compiler_HIR_Module
 Top-level HIR module. More...
 
struct  Compiler_HIR_Node
 Base node carrying a source span. More...
 
struct  Compiler_HIR_Param
 Parameter metadata for one HIR function. More...
 
struct  Compiler_HIR_Return_Stmt
 Return statement in HIR. More...
 
struct  Compiler_HIR_Stmt
 Base class for HIR statements. More...
 
struct  Compiler_HIR_Unary_Expr
 Typed unary expression. More...
 
struct  Compiler_HIR_Variable_Expr
 Typed variable reference expression. More...
 
struct  Compiler_HIR_While_Stmt
 Structured while-loop statement. More...
 
struct  Compiler_Identifier_Expr
 Node representing a named identifier reference. More...
 
struct  Compiler_If_Stmt
 Node representing a conditional branch. More...
 
struct  Compiler_Import_Decl
 Abstract base class for top-level import declarations. More...
 
struct  Compiler_Integer_Result
 Result of compiler_integer_binary() and compiler_integer_negate(). More...
 
struct  Compiler_Invalid_Expr
 Placeholder node for expressions that failed to parse. More...
 
struct  Compiler_Invalid_Import_Decl
 Placeholder node for malformed import declarations. More...
 
struct  Compiler_Invalid_Stmt
 Placeholder node for statements that failed to parse. More...
 
struct  Compiler_Invalid_Type_Decl
 Placeholder node for malformed type declarations. More...
 
struct  Compiler_Invalid_Type_Expr
 Placeholder node for type syntax that failed to parse. More...
 
struct  Compiler_IR_Block
 One basic block of IR instructions. More...
 
class  Compiler_IR_Builder
 Small reusable helper that allocates and connects IR nodes. More...
 
class  Compiler_IR_Context
 Arena-backed ownership context for IR nodes. More...
 
struct  Compiler_IR_Function
 Lowered IR for one function or top-level body. More...
 
struct  Compiler_IR_Instruction
 One instruction producing an optional explicit result value. More...
 
class  Compiler_IR_Lowering
 Lowers typed HIR into explicit-value IR. More...
 
struct  Compiler_IR_Module
 Lowered IR module with shared global slots and functions. More...
 
struct  Compiler_IR_Slot
 One storage slot used by the IR. More...
 
struct  Compiler_IR_Terminator
 Explicit terminator for one IR basic block. More...
 
struct  Compiler_IR_Validation_Report
 Structural validation report for one IR module or function. More...
 
struct  Compiler_Let_Stmt
 Node representing a local variable binding. More...
 
struct  Compiler_Let_Type_Assignment
 Recorded inferred type for one let binding. More...
 
class  Compiler_Lexer
 Token generator for a single source file. More...
 
struct  Compiler_Lexer_Options
 Configuration options for lexer behavior. More...
 
class  Compiler_Line_Frontend
 Small example frontend for a line-oriented language. More...
 
struct  Compiler_Literal_Expr
 Node representing a literal value. More...
 
struct  Compiler_Module
 Node representing a complete translation unit or module. More...
 
struct  Compiler_Module_Ambiguous_Name
 One ambiguous name tracked in a per-module name table. More...
 
struct  Compiler_Module_Binding_Issue
 One structural issue reported by the reusable module binder. More...
 
struct  Compiler_Module_Binding_Result
 Binding result over one linked module-surface view. More...
 
struct  Compiler_Module_Bindings
 Bound top-level names visible from one module. More...
 
struct  Compiler_Module_Bound_Name
 One top-level name successfully bound in a module namespace. More...
 
struct  Compiler_Module_Dependency
 One source-name dependency edge originating from one module. More...
 
struct  Compiler_Module_Descriptor
 One module descriptor consumed by the reusable resolver. More...
 
struct  Compiler_Module_Export
 One reusable top-level declaration exposed by a module surface. More...
 
struct  Compiler_Module_Link_Result
 Link result over module descriptors and module metadata. More...
 
struct  Compiler_Module_Linkage
 One linked module view under direct-import surface rules. More...
 
struct  Compiler_Module_Linkage_Issue
 One structural issue reported by the reusable module linker. More...
 
struct  Compiler_Module_Metadata
 Reusable metadata describing one parsed or analyzed module surface. More...
 
struct  Compiler_Module_Name_Resolution
 Structured result returned by reusable module-name resolution. More...
 
struct  Compiler_Module_Name_Table
 Cached top-level name table over all visible modules. More...
 
struct  Compiler_Module_Name_Table_Entry
 Cached top-level names for one module. More...
 
struct  Compiler_Module_Resolution_Issue
 One structured issue emitted by the reusable module resolver. More...
 
struct  Compiler_Module_Resolution_Result
 Resolution result for one set of source-name module descriptors. More...
 
struct  Compiler_Module_Semantic_Environment
 Semantic environments for all modules in one compilation unit set. More...
 
struct  Compiler_Module_Semantic_Module
 One namespace-separated semantic environment for a module. More...
 
struct  Compiler_Module_Visible_Export
 One visible top-level declaration in a linked module surface. More...
 
class  Compiler_MVP_Frontend
 Compiler_Frontend implementation backed by the current MVP language stack. More...
 
struct  Compiler_MVP_Frontend_Options
 Options used by the MVP frontend adapter. More...
 
struct  Compiler_Name_Resolution
 Mapping from an identifier expression to its resolved symbol. More...
 
struct  Compiler_Named_Type_Expr
 Named type syntax such as Int, Bool, or T. More...
 
struct  Compiler_Param
 Representation of a function parameter. More...
 
struct  Compiler_Param_Type_Assignment
 Recorded inferred type for one function parameter. More...
 
class  Compiler_Parser
 Recursive-descent parser that produces an AST in Compiler_Ast_Context. More...
 
struct  Compiler_Parser_Options
 Parser configuration knobs for the MVP grammar. More...
 
class  Compiler_Parser_Stream
 Lightweight token stream facade for recursive-descent parsers. More...
 
struct  Compiler_Return_Stmt
 Node representing a return from the current function. More...
 
class  Compiler_Semantic_Analyzer
 Name-resolution and basic semantic checker for the MVP AST. More...
 
struct  Compiler_Semantic_Options
 Options controlling semantic analyzer behavior. More...
 
struct  Compiler_Source_Import_Decl
 Top-level import declaration naming one other source unit. More...
 
struct  Compiler_SSA_Block
 One SSA basic block containing phis, instructions, and a terminator. More...
 
class  Compiler_SSA_Context
 Arena-backed ownership context for SSA functions and modules. More...
 
struct  Compiler_SSA_Dominance_Info
 Dominance metadata computed for one SSA function. More...
 
struct  Compiler_SSA_Function
 SSA form for one function or top-level body lowered from IR. More...
 
struct  Compiler_SSA_Instruction
 One SSA instruction producing an optional explicit result value. More...
 
class  Compiler_SSA_Lowering
 Lowers non-SSA IR to SSA form for all reachable blocks. More...
 
struct  Compiler_SSA_Module
 SSA module sharing global slots with the source IR module. More...
 
struct  Compiler_SSA_Parameter
 SSA parameter definition that seeds renaming for one IR parameter slot. More...
 
struct  Compiler_SSA_Phi
 Phi node merging values for one original IR local slot. More...
 
struct  Compiler_SSA_Terminator
 Explicit terminator for one SSA basic block. More...
 
struct  Compiler_SSA_Validation_Report
 Validation report for one SSA function or module. More...
 
struct  Compiler_Stmt
 Abstract base class for statement nodes. More...
 
struct  Compiler_Struct_Decl
 Nominal top-level struct declaration. More...
 
struct  Compiler_Struct_Field
 One named field inside a parsed struct declaration. More...
 
struct  Compiler_Symbol
 One reusable symbol record tracked by lexical bindings. More...
 
class  Compiler_Symbol_Bindings
 Reusable lexical symbol table with stable ids and scope tracking. More...
 
struct  Compiler_Symbol_Declare_Result
 Structured result returned after one declaration attempt. More...
 
struct  Compiler_Token
 Lexical token representation with its value and location. More...
 
struct  Compiler_Tuple_Type_Expr
 Tuple type syntax such as (Int, Bool). More...
 
struct  Compiler_Type
 One node inside the type graph. More...
 
struct  Compiler_Type_Alias_Decl
 Transparent top-level type alias declaration. More...
 
class  Compiler_Type_Context
 Context owning all compiler type nodes. More...
 
struct  Compiler_Type_Decl
 Abstract base class for top-level type declarations. More...
 
struct  Compiler_Type_Expr
 Abstract base class for parsed type-annotation syntax. More...
 
class  Compiler_Type_Substitution
 Mutable substitution from type variables to replacement types. More...
 
class  Compiler_Type_Unifier
 Structural unifier for compiler types. More...
 
class  Compiler_Typed_Semantic_Analyzer
 Inference-oriented semantic pass for the MVP compiler front-end. More...
 
struct  Compiler_Typed_Semantic_Options
 Options controlling the typed semantic pass. More...
 
struct  Compiler_Unary_Expr
 Node representing a prefix unary operation. More...
 
struct  Compiler_Unify_Result
 Outcome of one type-unification attempt. More...
 
struct  Compiler_While_Stmt
 Node representing a while-loop. More...
 
class  Compute_Bipartite
 Class that takes a bipartite graph and computes the partition sets. More...
 
class  Compute_Bridges
 Find bridge edges (isthmuses) of a connected undirected graph. More...
 
class  Compute_Cut_Nodes
 Computation of cut nodes (articulation points) of a graph. More...
 
class  Compute_Cycle_In_Digraph
 Determines if a digraph contains a cycle and constructs it. More...
 
class  Compute_Maximum_Cardinality_Bipartite_Matching
 Class for computing the maximum cardinality matching of a bipartite graph. More...
 
class  Compute_Maximum_Cardinality_General_Matching
 Functor wrapper for maximum cardinality general matching. More...
 
class  Compute_Maximum_Weight_General_Matching
 Functor wrapper for weighted blossom matching. More...
 
class  Compute_Min_Cut
 Functor wrapper for compute_min_cut(). More...
 
class  Compute_Minimum_Cost_General_Matching
 Functor wrapper for minimum-cost general matching. More...
 
class  Compute_Minimum_Cost_Perfect_General_Matching
 Functor wrapper for minimum-cost perfect general matching. More...
 
class  ConcurrentHashMap
 Sharded concurrent hash map: Shards independently-locked DynMapHashTable partitions, no single global lock. More...
 
class  Const_Arc_Iterator
 Read-only iterator on the arcs of a graph. More...
 
class  Const_Graph_View
 Strict read-only view of a graph. More...
 
class  Const_Iterator
 Read-only view of an Aleph iterator: the iterator of a constant container. More...
 
class  const_mem_fun1_ref_t
 
class  const_mem_fun1_ref_t< void, _Tp, _Arg >
 
class  const_mem_fun1_t
 
class  const_mem_fun1_t< void, _Tp, _Arg >
 
class  const_mem_fun_ref_t
 
class  const_mem_fun_ref_t< void, _Tp >
 
class  const_mem_fun_t
 
class  const_mem_fun_t< void, _Tp >
 
class  Const_Node_Arc_Iterator
 Read-only iterator on the arcs of a node. More...
 
class  Const_Node_Iterator
 Read-only iterator on the nodes of a graph. More...
 
class  ConstrainedDelaunayTriangulation
 Constrained Delaunay Triangulation via Sloan's flip-based method. More...
 
class  Constraint_Set
 Ordered collection of equality constraints. More...
 
struct  ContinueSearch
 Default solution visitor that always continues the search. More...
 
class  Convex_Hull_Trick
 Convex Hull Trick for minimum queries. More...
 
class  ConvexPolygonDecomposition
 Decompose a simple polygon into convex parts using Hertel-Mehlhorn. More...
 
class  ConvexPolygonDistanceGJK
 Distance between two closed convex polygons using GJK. More...
 
class  ConvexPolygonIntersectionBasic
 Basic exact intersection for closed convex polygons. More...
 
class  ConvexPolygonOffset
 Inward (erosion) and outward (dilation) offset of convex polygons. More...
 
class  Cookie_Guard
 RAII guard that clears graph cookies on destruction. More...
 
class  Cookie_Saver
 RAII guard that saves and restores graph cookies. More...
 
class  Copy_Graph
 Filtered copy of graphs. More...
 
class  Count_Min_Sketch
 Count-Min Sketch frequency estimator. More...
 
class  CsvReader
 Lazy CSV reader for large files. More...
 
class  CsvRow
 A CSV row with header-based field access. More...
 
class  Cuckoo_Filter
 Industrial-grade Cuckoo Filter implementation. More...
 
class  CuttingEarsTriangulation
 Polygon triangulation using the ear-cutting algorithm. More...
 
struct  Decompose_Flow
 Functor wrapper for flow decomposition. More...
 
struct  default_accessor
 Trivial accessor policy: access(p, i) is just p[i]. More...
 
struct  Default_Col_Formatter
 Default column index formatter. More...
 
struct  Default_Entry_Formatter
 Default entry formatter. More...
 
struct  Default_Operation_On_Arc
 Default no-op operation for arc initialization. More...
 
struct  Default_Operation_On_Node
 Default no-op operation for node initialization. More...
 
struct  Default_Row_Formatter
 Default row index formatter. More...
 
struct  Default_Visit_Op
 Default visit operation for traversals (never stops). More...
 
struct  DefaultMonoid
 Default (no-op) monoid for connectivity-only usage. More...
 
class  DelaunayTriangulationBowyerWatson
 Exact Delaunay triangulation using the Bowyer-Watson incremental algorithm. More...
 
class  DelaunayTriangulationRandomizedIncremental
 O(n log n) expected-time Delaunay's triangulation. More...
 
class  Depth_First_Backtracking
 Recursive depth-first backtracking over an implicit state space. More...
 
class  Depth_First_Traversal
 Stateful depth-first traversal functor. More...
 
struct  Df_Low_Key
 Key of a node of a depth-first tree with df and low numbers. More...
 
struct  Dfs_Arc_Frame
 The next arc of a node to look at, for a depth-first search that keeps only that in a frame. More...
 
class  Dfs_Stack
 Stack of the frames of a depth-first search that does not recurse. More...
 
struct  Dft_Arc_Attr
 
struct  Dft_Arc_Cmp
 Default arc comparison class for Arcs_Index. More...
 
struct  Dft_Arc_Reader
 
struct  Dft_Arc_Writer
 
struct  Dft_Certificate_Node_Label
 Default node labeler for certificate export. More...
 
struct  Dft_Copy_Arc
 Default copy arc functor. More...
 
struct  Dft_Copy_Node
 Default copy node functor. More...
 
struct  Dft_Df_Tree_Label
 Default label of a graph node: its information, written with operator <<. More...
 
class  Dft_Dist
 Default distance accessor for arc weights. More...
 
struct  Dft_Filter_Op
 Default filter operation (always true). More...
 
struct  Dft_Fold_Op
 Default folding operation (returns default-constructed accumulator). More...
 
struct  Dft_Goal_Node
 
struct  Dft_Init_Rand_Arc
 Default arc initializer for random graph generation. More...
 
struct  Dft_Init_Rand_Node
 Default node initializer for random graph generation. More...
 
struct  Dft_Load_Arc
 Default arc loading functor for binary and text modes. More...
 
struct  Dft_Load_Node
 Default node loading functor for binary and text modes. More...
 
struct  Dft_Map_Op
 Default mapping operation: the conversion of the item, which is its copy when the two types are the same. More...
 
struct  Dft_Node_Attr
 
struct  Dft_Node_Cmp
 Default node comparison class for Nodes_Index. More...
 
struct  Dft_Node_Reader
 
struct  Dft_Node_Writer
 
struct  Dft_Pair_Cmp
 Default comparator for pair types in hash maps. More...
 
struct  Dft_Show_Arc
 Default filter for filtered iterators on arcs. More...
 
struct  Dft_Show_Node
 Default filter for the graph nodes. More...
 
struct  Dft_Store_Arc
 Default arc storage functor for binary and text modes. More...
 
struct  Dft_Store_Node
 Default node storage functor for binary and text modes. More...
 
struct  Dft_Write
 
class  DftTreeNodeAllocator
 
struct  Diagnostic
 Fully accumulated diagnostic. More...
 
class  Diagnostic_Builder
 Fluent builder used to enrich a just-created diagnostic. More...
 
class  Diagnostic_Engine
 Diagnostic accumulator and renderer. More...
 
struct  Diagnostic_Label
 Span annotation attached to a diagnostic. More...
 
class  Dial_Min_Paths
 Dial's algorithm for shortest paths with integer weights. More...
 
class  Digraph
 Generic directed graph (digraph) wrapper template. More...
 
class  Digraph_Iterator
 Filtered iterator on directed graphs. More...
 
class  Dijkstra_Min_Paths
 Spanning tree calculation of all shortest paths from a given node according to Dijkstra's algorithm. More...
 
struct  Dinic_Maximum_Flow
 Functor wrapper for Dinic's algorithm. More...
 
struct  Dinic_Node_Info
 Level information for Dinic's algorithm. More...
 
class  Directed_Find_Path
 Path search on directed graphs defined through a graph class (not a digraph). More...
 
struct  Distance_Compare
 Comparison functor for arc weights/distances. More...
 
struct  Distinct_Count_Policy
 Policy: count distinct elements in a range. More...
 
struct  Divide_Conquer_DP_Result
 Result of divide-and-conquer partition DP optimization. More...
 
struct  divides
 
class  Dlink
 Doubly linked circular list node. More...
 
class  Dnode
 Node belonging to a double circular linked list with header node. More...
 
struct  DotExportOptions
 Options for DOT export. More...
 
class  DouglasPeuckerSimplification
 Douglas-Peucker polyline simplification. More...
 
class  DSatur_Coloring
 Functor wrapper for dsatur_coloring. More...
 
struct  Dummy_Attr
 
class  Dyn_Slist_Nc
 Dynamic list of elements of type T. More...
 
class  DynArray
 
class  DynArray_Set
 Set-like container backed by a dynamic array. More...
 
class  DynArrayHeap
 Dynamic heap (priority queue) backed by DynArray. More...
 
class  DynBinHeap
 Dynamic heap of elements of type T ordered by a comparison functor. More...
 
class  DynDlist
 Dynamic doubly linked list with O(1) size and bidirectional access. More...
 
class  DynHashTable
 Self-adjusting dynamic hash table. More...
 
class  DynIntervalTree
 High-level interval tree with automatic memory management. More...
 
class  DynLhashTable
 Dynamic hash table mapping keys to records with separate chaining. More...
 
class  DynList
 Doubly-linked list (defined in tpl_dynList.H). More...
 
class  DynListQueue
 Dynamic queue of elements of generic type T based on single linked list. More...
 
class  DynListStack
 Dynamic stack of elements of generic type T based on a singly linked list. More...
 
class  DynMapAvlTree
 Dynamic map implemented with an AVL tree. More...
 
class  DynMapBinTree
 Dynamic map implemented with a classic binary search tree. More...
 
class  DynMapHashTable
 
class  DynMapRandTree
 Dynamic map implemented with a randomized BST. More...
 
class  DynMapRbTree
 Dynamic map implemented with a red-black tree. More...
 
class  DynMapSplayTree
 Dynamic map implemented with a splay tree. More...
 
class  DynMapTreap
 Dynamic map implemented with a treap. More...
 
class  DynMapTreapRk
 Dynamic map implemented with a ranked treap. More...
 
class  DynMapTree
 Generic key-value map implemented on top of a binary search tree. More...
 
class  DynMatrix
 Dynamic matrix with sparse storage. More...
 
class  DynSetAvlRkTree
 Dynamic set implemented using extended AVL binary search trees with rank support of type Avl_Tree_Rk<Key>. More...
 
class  DynSetAvlTree
 Dynamic set implemented using AVL binary search trees of type Avl_Tree<Key>. More...
 
class  DynSetBinTree
 Dynamic set implemented using binary search trees of type BinTree<Key>. More...
 
class  DynSetHtdRbRkTree
 Dynamic set implemented using Hybrid Red-Black trees with rank support of type HtdRbTreeRk<Key>. More...
 
class  DynSetHtdRbTree
 Dynamic set implemented using Hybrid Top-Down/Bottom-Up Red-Black trees of type HtdRbTree<Key>. More...
 
struct  DynSetLhash
 Hash-based dynamic set (defined in tpl_dynSetHash.H). More...
 
struct  DynSetLinHash
 
class  DynSetRandTree
 Dynamic set implemented using randomized binary search trees of type Rand_Tree<Key>. More...
 
class  DynSetRbRkTree
 Dynamic set implemented using extended Red-Black binary search trees with rank support of type Rb_Tree_Rk<Key> (bottom-up implementation). More...
 
class  DynSetRbTree
 Dynamic set implemented using Red-Black binary search trees of type Rb_Tree<Key> (bottom-up implementation). More...
 
class  DynSetSplayRkTree
 Dynamic set implemented using splay trees with rank support of type Splay_Tree_Rk<Key>. More...
 
class  DynSetSplayTree
 Dynamic set implemented using splay binary search trees of type Splay_Tree<Key>. More...
 
class  DynSetTdRbRkTree
 Dynamic set implemented using Top-Down Red-Black binary search trees with rank support of type TdRbTreeRk<Key>. More...
 
class  DynSetTdRbTree
 Dynamic set implemented using Top-Down Red-Black binary search trees of type TdRbTree<Key>. More...
 
class  DynSetTreap
 Dynamic set implemented using randomized treap binary search trees of type Treap<Key>. More...
 
class  DynSetTreapRk
 Dynamic set implemented using extended treap binary search trees with rank support of type Treap_Rk<Key>. More...
 
class  DynSetTree
 Dynamic set backed by balanced binary search trees with automatic memory management. More...
 
class  DynSkipList
 Dynamic ordered set implemented with a Skip List. More...
 
class  DynSlist
 Dynamic list of elements of type T implemented with a singly linked list of nodes. More...
 
struct  DynTreapTree
 Dynamic mapping implemented with treap trees. More...
 
class  Edge_Connectivity
 Functor wrapper for edge_connectivity(). More...
 
struct  Edmonds_Karp_Maximum_Flow
 Functor wrapper for edmonds_karp_maximum_flow(). More...
 
class  Ellipse
 An axis-aligned ellipse. More...
 
struct  Empty_Class
 Empty placeholder class with no data members. More...
 
struct  Empty_Node
 
class  EnumZipIterator< C >
 Base case of EnumZipIterator: the read-only iterator of the last container, which also counts the position. More...
 
class  Eppstein_K_Shortest_Paths
 Functor wrapper for Eppstein-style k-shortest paths API. More...
 
struct  Equal_Node
 Functor to compare nodes by their ID. More...
 
struct  equal_to
 
struct  Equality_Constraint
 Equality constraint between two values of type T. More...
 
struct  Euclidean_Heuristic
 Euclidean distance heuristic for A* in 2D grids. More...
 
class  Euclidian_Arc
 
class  Euclidian_Digraph
 
class  Euclidian_Graph
 
class  Euclidian_Node
 
struct  Euler_Tour_LCA
 LCA on a min-heap Cartesian Tree. More...
 
struct  ExceptionBuilder
 Exception constructor with formatted message. More...
 
class  expected
 Minimal std::expected-style result type for C++20. More...
 
class  expected< void, E >
 Specialization of expected for void value type. More...
 
struct  ExplorationPolicy
 Exploration controls shared across engines. More...
 
class  extents
 Shape (per-axis sizes) of an mdspan, mixing compile-time and run-time extents. More...
 
struct  Fenwick_Tree
 Fenwick tree for arithmetic types with find_kth support. More...
 
class  FFT
 Fast Fourier Transform (FFT) and DSP Toolkit. More...
 
class  Fibonacci_Heap
 Implementation of a Fibonacci Heap priority queue. More...
 
class  Field
 
struct  Fifo_Preflow_Maximum_Flow
 Functor wrapper for fifo_preflow_maximum_flow(). More...
 
class  Filter_Iterator
 Generic filter iterator wrapper. More...
 
class  Find_Aumenting_Path
 Augmenting-path search over a directed network. More...
 
class  Find_Breadth_First_Spanning_Tree
 Compute a breadth-first spanning tree of a graph. More...
 
class  Find_Depth_First_Spanning_Tree
 Compute a depth-first spanning tree of a graph. More...
 
class  Find_Eulerian_Path
 Finds and constructs an Eulerian path or cycle using Hierholzer's algorithm. More...
 
class  Find_Min_Path
 Functor wrapper for find_min_path. More...
 
class  Find_Path_Breadth_First
 Performs a breadth-first search for a path between a pair of nodes. More...
 
class  Find_Path_Depth_First
 Performs a depth-first search for a path between a pair of nodes. More...
 
class  FixedQueue
 Very simple queue implemented with a contiguous array. More...
 
class  FixedStack
 Fixed length stack. More...
 
class  FlatMap
 Ordered map stored as two parallel sorted contiguous arrays. More...
 
class  FlatSet
 Ordered set stored as a sorted contiguous array. More...
 
struct  FlowCycle
 Represents a flow cycle in the network. More...
 
struct  FlowDecomposition
 Result of flow decomposition. More...
 
struct  FlowPath
 Represents a flow path from source to sink. More...
 
struct  FlowStatistics
 Statistics about a network flow. More...
 
class  Floyd_All_Shortest_Paths
 Compute the all-pairs shortest path distance matrix and the path reconstruction matrix for a graph g using the Floyd-Warshall algorithm. More...
 
class  For_Each_In_Order
 Generic inorder traversal of a binary tree. More...
 
class  For_Each_Postorder
 Generic postorder traversal of a binary tree. More...
 
class  For_Each_Preorder
 Generic preorder traversal of a binary tree. More...
 
struct  Ford_Fulkerson_Maximum_Flow
 Functor wrapper for ford_fulkerson_maximum_flow(). More...
 
struct  Found_Item
 Abstract base class for optional-like results. More...
 
class  FunctionalMixin
 CRTP Mixin providing functional programming operations. More...
 
struct  FunnelTraceResult
 Full trace for shortest-path funnel processing. More...
 
struct  FunnelTraceStep
 One SSFA (funnel) iteration snapshot. More...
 
struct  GcdMonoid
 GCD monoid: identity = 0 (since gcd(0, x) = x), combine = gcd. More...
 
class  Gen_Avl_Tree
 AVL balanced binary search tree. More...
 
class  Gen_Avl_Tree_Rk
 AVL balanced binary search tree with rank (order statistics). More...
 
class  Gen_B_Tree
 Generic B-Tree with configurable minimum degree. More...
 
class  Gen_Binary_Lifting_LCA
 LCA via binary lifting on a rooted tree. More...
 
class  Gen_BPlus_Tree
 Generic B+ Tree with configurable minimum degree. More...
 
class  Gen_Cartesian_Tree
 Explicit Cartesian Tree built in O(n) with a monotonic stack. More...
 
class  Gen_Cartesian_Tree_RMQ
 O(1) static range queries via the Cartesian Tree reduction. More...
 
class  Gen_Centroid_Decomposition
 Centroid decomposition over a rooted tree represented as an Aleph graph. More...
 
class  Gen_Disjoint_Sparse_Table
 Disjoint Sparse Table over an arbitrary associative binary operation. More...
 
class  Gen_Euler_RMQ_LCA
 LCA via Euler tour + RMQ on depth in a rooted tree. More...
 
class  Gen_Euler_Tour_LCA
 Lowest Common Ancestor queries in O(1) via Euler Tour reduction to RMQ on a Cartesian Tree. More...
 
class  Gen_Fenwick_Tree
 Fenwick tree over an arbitrary abelian group. More...
 
class  Gen_File_B_Map
 Persistent ordered map backed by a paged File_B_Tree. More...
 
class  Gen_File_B_Tree
 Persistent page-managed B-Tree stored in a single binary file. More...
 
class  Gen_File_BPlus_Map
 Persistent ordered map backed by a paged File_BPlus_Tree. More...
 
class  Gen_File_BPlus_Tree
 Persistent page-managed B+ Tree stored in a single binary file. More...
 
class  Gen_Heavy_Light_Decomposition
 Heavy-Light Decomposition over a rooted tree represented as an Aleph graph. More...
 
class  Gen_HLD
 Heavy-Light Decomposition with segment tree for path/subtree queries. More...
 
class  Gen_HLD_Path_Query
 Segment-tree-powered path/subtree queries over an HLD layout. More...
 
class  Gen_Interval_Tree
 Augmented treap storing intervals with overlap/stabbing queries. More...
 
class  Gen_Lazy_Segment_Tree
 Lazy segment tree with range update and range query. More...
 
class  Gen_Link_Cut_Tree
 Dynamic forest with path queries via Link-Cut Trees. More...
 
class  Gen_Link_Cut_Tree_WithEdges
 Link-Cut Tree with edge weights and path aggregations. More...
 
class  Gen_Mo_Algorithm
 Offline range query engine using Mo's algorithm. More...
 
class  Gen_Mo_On_Tree_Node
 Offline subtree and path queries on N-ary trees (Tree_Node). More...
 
class  Gen_Mo_On_Trees
 Offline subtree and path queries on trees via Mo's algorithm. More...
 
class  Gen_MultiPolynomial
 Sparse multivariate polynomial. More...
 
class  Gen_Polynomial
 Univariate polynomial over a generic coefficient ring. More...
 
class  Gen_Rand_Tree
 Randomized binary search tree with rank support. More...
 
class  Gen_Rb_Tree
 Red-black binary search tree implementation (bottom-up). More...
 
class  Gen_Rb_Tree_Rk
 Red-black tree with rank support (select/position operations). More...
 
class  Gen_Reroot_DP
 Generic rerooting dynamic programming (all-roots DP). More...
 
class  Gen_Segment_Tree
 Segment tree over an arbitrary associative binary operation. More...
 
class  Gen_Sparse_Table
 Sparse Table over an arbitrary associative and idempotent binary operation. More...
 
class  Gen_Treap
 Treap - A randomized binary search tree using heap-ordered priorities. More...
 
class  Gen_Treap_Rk
 Extended Treap with rank support for O(log n) indexed access. More...
 
class  Gen_Tree_DP
 Generic bottom-up tree dynamic programming. More...
 
class  GenBinHeap
 Generic heap of nodes. More...
 
class  GenBinTree
 Simple (unbalanced) binary search tree. More...
 
struct  Generate_Graphviz
 Functor for generating Graphviz specifications. More...
 
class  Generator
 Lazy, single-pass sequence of T values produced by a coroutine. More...
 
class  GenLhashTable
 Generic hash table with collision resolution by separate chaining. More...
 
class  GenLinearHashTable
 Generic linear hash table. More...
 
class  GenTdRbTree
 Top-down red-black binary search tree implementation. More...
 
class  GenTdRbTreeRk
 Top-down red-black tree with rank support (select/position). More...
 
struct  Geom_Object
 Base class for all geometric objects. More...
 
class  GeomBowyerWatsonUtils
 Shared Bowyer-Watson core parameterized by in-circle predicate. More...
 
class  GeomPolygonUtils
 Shared polygon helpers used across multiple geometry algorithms. More...
 
class  GeomSerializer
 Serialization utilities for geometry objects. More...
 
class  GeomTriangleAdjacencyUtils
 Shared edge-group extraction for triangle meshes. More...
 
class  GiftWrappingConvexHull
 Gift wrapping (Jarvis march) convex hull algorithm. More...
 
class  GrahamScanConvexHull
 Graham scan convex hull algorithm. More...
 
class  Graph_Aarc
 
class  Graph_Anode
 Node of Array_Graph More...
 
struct  Graph_Arc
 Arc of graph implemented with double-linked adjacency lists. More...
 
struct  Graph_Attr
 General attributes for nodes and arc of graphs. More...
 
struct  Graph_Node
 Node belonging to a graph implemented with a double linked adjacency list. More...
 
class  Graph_Sarc
 Arc for graphs implemented with simple adjacency lists. More...
 
struct  Graph_Snode
 Node for graphs implemented with simple adjacency lists. More...
 
class  Graph_To_Tree_Node
 Functor class to convert a tree graph to Tree_Node structure. More...
 
class  Graph_Traverse_Generator
 Lazily traverse a graph depth-first or breadth-first. More...
 
class  GraphCopyWithMapping
 Graph copy with explicit node mapping. More...
 
struct  greater
 
struct  greater_equal
 
class  Greedy_Coloring
 Functor wrapper for greedy_coloring. More...
 
struct  Grevlex_Order
 Graded reverse lexicographic monomial order (default). More...
 
struct  Grlex_Order
 Graded lexicographic monomial order. More...
 
class  Gsl_Compatible_Rng
 A random number generator with the sequences of GSL's gsl_rng_mt19937. More...
 
class  Gsl_Compatible_Rng_Owner
 A Gsl_Compatible_Rng in dynamic memory, so that what holds it grows only by a pointer, as with the gsl_rng of before. More...
 
class  HalfPlaneIntersection
 Exact bounded intersection of half-planes. More...
 
class  Has_Cycle
 Determines whether a graph contains cycles. More...
 
struct  HashMap
 
struct  HashSet
 
struct  Heap_Preflow_Maximum_Flow
 Functor wrapper for heap_preflow_maximum_flow(). More...
 
class  History_Heuristic_Table
 Sparse history heuristic table over Aleph hash maps. More...
 
struct  HLD_Max
 HLD with path/subtree max queries. More...
 
struct  HLD_Min
 HLD with path/subtree min queries. More...
 
struct  HLD_Sum
 HLD with path/subtree sum queries. More...
 
struct  HLPP_Maximum_Flow
 Functor wrapper for HLPP. More...
 
struct  HLPP_Node_Info
 Node info for HLPP algorithm. More...
 
struct  HLPP_Node_Info< Flow_Type, true >
 Node information of HLPP for a floating flow. More...
 
struct  Hopcroft_Karp_Frame
 A left node that the search for an augmenting path goes through, and the next of its arcs to look at, with a copy of the filter of the search. More...
 
class  Hopcroft_Karp_Matching
 Functor wrapper for hopcroft_karp_matching. More...
 
struct  Howard_Mean_Cycle_Result
 Result of howard_minimum_mean_cycle(). More...
 
class  HtdRbTree
 Hybrid top-down/bottom-up red-black tree. More...
 
class  HtdRbTreeRk
 Hybrid top-down/bottom-up red-black tree with rank support. More...
 
class  HtdRbTreeRkVtl
 Hybrid RB tree with rank and virtual destructor. More...
 
class  HtdRbTreeVtl
 Hybrid red-black tree with virtual node destructor. More...
 
class  HTList
 Single linked list of nodes. More...
 
class  Huffman_Decoder_Engine
 Huffman decoder. More...
 
class  Huffman_Encoder_Engine
 Huffman encoder. More...
 
struct  Huffman_Node
 
class  Hungarian_Assignment
 Implementation of the Hungarian (Munkres) algorithm. More...
 
struct  Hungarian_Result
 Result of the Hungarian assignment algorithm. More...
 
class  HyperLogLog
 HyperLogLog cardinality estimator. More...
 
class  IDA_Star
 IDA* algorithm for memory-efficient shortest path search. More...
 
class  IDA_Star_State_Search
 IDA* engine for implicit state spaces with an admissible heuristic. More...
 
struct  IDAStarIteration
 Result of one threshold pass of IDA*. More...
 
struct  IDAStarResult
 Aggregated result of a complete IDA* run. More...
 
class  In_Arcs_Index
 Index of the arcs that go into each node of a graph. More...
 
class  In_Iterator
 Filtered iterator for incoming arcs of a node. More...
 
class  In_Iterator< GT, SA >
 Filtered iterator for incoming arcs of a node of a digraph type. More...
 
class  Index_Graph
 Builds node and arc indices for fast lookup and retrieval. More...
 
struct  index_tuple
 A type that represents a parameter pack of zero or more integers. More...
 
class  IndexArc
 Index for fast arc lookup by its endpoint nodes. More...
 
class  IndexNode
 Builds an index of nodes for fast search and retrieval. More...
 
struct  Init_Arc
 
class  Init_Guard
 RAII guard for graph algorithm initialization. More...
 
struct  Init_P
 
struct  Init_Prim_Info
 
struct  Initialize_Dist
 Matrix initialization functor for Floyd-Warshall. More...
 
class  InlineStack
 Stack of fixed capacity whose storage is inside the object. More...
 
struct  Interpreter_Binding
 One lexical binding inside an interpreter environment. More...
 
class  Interpreter_Environment
 Nested runtime environment with lexical lookup semantics. More...
 
struct  Interpreter_Execution_Result
 Result of evaluating one expression, statement, module, or call. More...
 
class  Interpreter_Runtime
 Structured runtime for executing typed HIR. More...
 
struct  Interpreter_Runtime_Error
 Structured runtime error. More...
 
struct  Interpreter_Runtime_Options
 Runtime options for the HIR evaluator. More...
 
struct  Interpreter_Tuple_Storage
 Heap-owned tuple payload for recursive runtime values. More...
 
struct  Interpreter_Value
 One runtime value. More...
 
struct  Interval
 Closed interval [low, high]. More...
 
struct  interval_endpoint
 Trait to extract endpoint type from Interval<T>. More...
 
struct  interval_endpoint< Interval< T > >
 Specialization for Interval<T>. More...
 
struct  Interval_Less
 BST comparator for intervals: order by (low, then high). More...
 
struct  Interval_Tree
 Interval tree using nodes without virtual destructor. More...
 
class  Interval_Tree_Node
 Interval tree node with sentinel support. More...
 
class  Interval_Tree_Node_Data
 Data portion of an interval tree node. More...
 
class  Interval_Tree_NodeVtl
 Interval tree node with virtual destructor. More...
 
struct  Interval_Tree_Vtl
 Interval tree using nodes with virtual destructor. More...
 
struct  IntRange
 Integer range domain [start, end] with optional step. More...
 
class  Inversed_Compare
 Performs order reversal of Compare by swapping operands. More...
 
class  Invert_Digraph
 Functor for computing the transposed digraph, filtering arcs. More...
 
class  IO_Graph
 Graph serialization and deserialization class. More...
 
struct  is_counted_lazy_tag
 Metafunction to check if a tag is a counted lazy tag. More...
 
struct  is_counted_lazy_tag< AddLazyTag< T >, T >
 Specialization for AddLazyTag. More...
 
struct  is_counted_lazy_tag< AssignLazyTag< T >, T >
 Specialization for AssignLazyTag. More...
 
class  Is_Graph_Acyclique
 Determines whether a graph is acyclic (contains no cycles). More...
 
class  Is_Planar_Graph
 Functor wrapper for is_planar_graph(). More...
 
struct  is_stream_insertable
 
struct  iterator_traits
 Iterator traits for Aleph-w iterators. More...
 
class  Johnson
 Johnson's algorithm for all-pairs shortest paths. More...
 
struct  K_Shortest_Path_Item
 A shortest-path item returned by k-shortest algorithms. More...
 
class  Karger_Min_Cut
 Karger's randomized minimum cut algorithm. More...
 
class  Karp_Minimum_Mean_Cycle
 Functor wrapper for Karp minimum mean cycle. More...
 
class  Karp_Minimum_Mean_Cycle_Value
 Functor wrapper for value-only minimum mean cycle. More...
 
class  KDTreePointSearch
 Spatial point index for O(log n) nearest-neighbor queries. More...
 
struct  KeepFirstSolution
 Comparison policy that keeps the first solution seen. More...
 
class  Kept_Filter
 A filter that an algorithm object keeps: one given as an lvalue is used where it is, so that the caller sees what the algorithm does to it; one given as an rvalue is moved into the keeper, so that it lives as long as the object. More...
 
class  Kept_Initializer
 An initializer that a random generator keeps: one given as a modifiable lvalue is used where it is, so that the caller sees what the generator does to it; a temporary, or a const lvalue, is moved or copied into the generator, so that it lives as long as the generator. More...
 
class  KeysMixin
 CRTP Mixin for extracting keys from set-like containers. More...
 
class  Killer_Move_Table
 Two-slot killer heuristic table indexed by search depth. More...
 
class  Killer_Move_Table< Move, false >
 Specialized killer table for moves without equality support (no-op). More...
 
class  Killer_Move_Table< Move, true >
 Killer heuristic table for equality-comparable moves. More...
 
struct  Knapsack_Item
 An item for knapsack problems. More...
 
struct  Knapsack_Result
 Result of a knapsack computation. More...
 
struct  Knuth_Optimization_Result
 Result of Knuth interval-DP optimization. More...
 
struct  Kosaraju_Connected_Components
 Functor wrapper for Kosaraju's algorithm. More...
 
class  Kruskal_Min_Spanning_Tree
 Computes the minimum spanning tree of a graph using Kruskal's algorithm. More...
 
struct  layout_left
 Column-major layout: the first axis varies fastest (Fortran convention). More...
 
struct  layout_right
 Row-major layout: the last axis varies fastest (C convention). More...
 
struct  Lazy_Max_Segment_Tree
 Lazy segment tree for range add + range max. More...
 
struct  Lazy_Min_Segment_Tree
 Lazy segment tree for range add + range min. More...
 
struct  Lazy_Sum_Segment_Tree
 Lazy segment tree for range add + range sum. More...
 
struct  LCS_Result
 Result for Longest Common Subsequence (LCS). More...
 
class  Lengauer_Tarjan_Dominators
 Computes dominator tree and dominance frontiers of a digraph using the Lengauer-Tarjan algorithm. More...
 
class  Lengauer_Tarjan_Post_Dominators
 Computes post-dominator tree and post-dominance frontiers of a digraph using the Lengauer-Tarjan algorithm on the reversed graph. More...
 
struct  less
 
struct  less_equal
 
struct  Lex_Order
 Lexicographic monomial order. More...
 
struct  LhashBucketVtl
 Bucket with virtual destructor for a hash table with collision resolution by separate chaining. More...
 
struct  LhashTable
 Generic hash table with collision resolution by separate chaining and buckets without virtual destructor. More...
 
struct  LhashTableVtl
 Generic hash table with collision resolution by separate chaining and buckets with virtual destructor. More...
 
class  Li_Chao_Tree
 Li Chao tree for min line queries on an integral x-domain. More...
 
struct  LineEq
 2D infinite line in slope-intercept form. More...
 
class  LineSweepFramework
 Reusable event-driven sweep line framework. More...
 
class  LinHashBucket
 Bucket without virtual destructor for a hash table with collision resolution by separate chaining. More...
 
class  LinHashBucketVtl
 Bucket with virtual destructor for a hash table with collision resolution by separate chaining. More...
 
struct  LIS_Result
 Result of a Longest Increasing Subsequence computation. More...
 
class  List_Graph
 Graph implemented with double-linked adjacency lists. More...
 
class  List_SGraph
 Graph class implemented with singly-linked adjacency lists. More...
 
class  LocateMixin
 CRTP Mixin providing element location operations. More...
 
struct  logical_and
 
struct  logical_not
 
struct  logical_or
 
struct  Longest_Common_Substring_Result
 Result for longest common substring. More...
 
struct  make_index_tuple
 Unary metafunction that generates an index_tuple containing [0, Size). More...
 
struct  Manacher_Result
 Result object for Manacher's algorithm. More...
 
struct  Manhattan_Heuristic
 Manhattan distance heuristic for A* in grid graphs. More...
 
class  Map_Matrix_Graph
 Adjacency matrix mapped to an adjacency list graph. More...
 
struct  MapODhash
 Open addressing hash map using double hashing. More...
 
struct  MapOLhash
 Open addressing hash map using linear probing. More...
 
struct  MapOpenHash
 Open addressing hash map for key-value pairs. More...
 
class  Mat_Graph
 
class  Matrix
 Sparse matrix with generic row and column domains. More...
 
struct  Matrix_Chain_Result
 Result of matrix-chain multiplication optimization. More...
 
class  Matrix_Graph
 Adjacency matrix storing copies of graph attributes. More...
 
struct  Max_Cartesian_Tree
 Cartesian Tree for max-heap (range maximum). More...
 
struct  Max_Euler_Tour_LCA
 LCA on a max-heap Cartesian Tree. More...
 
struct  Max_Flow_Min_Cost_By_Cycle_Canceling
 Functor wrapper for maximum flow minimum cost algorithm. More...
 
struct  Max_Flow_Min_Cost_By_Network_Simplex
 Functor wrapper for Network Simplex algorithm. More...
 
struct  Max_Op
 Functor returning the maximum of two values. More...
 
struct  Max_Segment_Tree
 Max Segment Tree for range maximum queries with point updates. More...
 
struct  Max_Sparse_Table
 Sparse Table for range maximum queries. More...
 
struct  MaxFlowBenchmarkResult
 Result of running a max-flow algorithm. More...
 
struct  Maximize_Objective
 Objective policy for maximization problems. More...
 
struct  MaxMonoid
 Max monoid: identity = numeric lowest, combine = max(a, b). More...
 
struct  MCF_Arc
 Arc information for multi-commodity flow. More...
 
class  MCF_Graph
 Multi-commodity flow network (directed graph). More...
 
class  MCF_LP_Solver
 Multi-commodity flow solver using LP formulation. More...
 
struct  MCF_Result
 Multi-commodity flow result. More...
 
class  mdspan
 Non-owning view of a contiguous buffer as a multidimensional grid. More...
 
class  mem_fun1_ref_t
 
class  mem_fun1_ref_t< void, _Tp, _Arg >
 
class  mem_fun1_t
 
class  mem_fun1_t< void, _Tp, _Arg >
 
class  mem_fun_ref_t
 
class  mem_fun_ref_t< void, _Tp >
 
class  mem_fun_t
 
class  mem_fun_t< void, _Tp >
 
class  MemArray
 Simple, scalable and fast dynamic array. More...
 
struct  Min_Cost_Matching_Result
 Result of minimum-cost matching. More...
 
struct  Min_Cost_Perfect_Matching_Result
 Result of minimum-cost perfect matching. More...
 
struct  Min_Cut
 Functor wrapper for min_cut(). More...
 
struct  Min_Mean_Cycle_Result
 Result of minimum mean cycle computation. More...
 
struct  Min_Mean_Cycle_Value_Result
 Lightweight minimum-mean-cycle value result. More...
 
struct  Min_Op
 Functor returning the minimum of two values. More...
 
struct  Min_Segment_Tree
 Min Segment Tree for range minimum queries with point updates. More...
 
struct  MinCostFlowStats
 Statistics for min-cost flow algorithms. More...
 
class  MinHash
 MinHash signature generator. More...
 
struct  Minimize_Objective
 Objective policy for minimization problems. More...
 
class  MinimumEnclosingCircle
 Smallest circle enclosing a point set (Welzl's algorithm). More...
 
class  MinkowskiSumConvex
 Exact Minkowski sum of two closed convex polygons. More...
 
struct  MinMonoid
 Min monoid: identity = numeric max, combine = min(a, b). More...
 
struct  minus
 
struct  Mo_Query
 A query for Mo's algorithm: inclusive range [l, r] with id. More...
 
class  Modular_Matrix
 Matrix operations modulo a prime. More...
 
class  ModularCombinatorics
 High-performance combinatorics operations modulo a prime. More...
 
struct  modulus
 
struct  monoid_supports_counted_lazy
 Metafunction to check if a monoid supports counted lazy tags. More...
 
struct  monoid_supports_counted_lazy< Monoid, std::void_t< typename Monoid::supports_counted_lazy > >
 Specialization for monoids with supports_counted_lazy member. More...
 
struct  Monotone_Queue_DP_Result
 Result of monotone-queue windowed DP transition. More...
 
class  MonotonePolygonTriangulation
 O(n log n) triangulation of simple polygons via y-monotone partition + linear-time monotone triangulation. More...
 
struct  MoveOrderingStats
 Statistics collected by engines that reorder successor batches. More...
 
class  MpscQueue
 Unbounded lock-free multi-producer/single-consumer queue. More...
 
struct  multiplies
 
struct  My_P
 Simple integer point used as node payload by the helper functors in this header. More...
 
class  Naive_Suffix_Tree
 Naive compressed suffix tree (didactic implementation). More...
 
class  Negamax
 Pure Negamax search over an implicit game tree. More...
 
struct  negate
 
class  Negate_Compare
 Comparator wrapper that inverts the comparison order. More...
 
struct  Negative_Cycle_Item
 One negative cycle reported by find_disjoint_negative_cycles(). More...
 
struct  Net_Arc
 Arc of a flow network implemented with adjacency lists. More...
 
struct  Net_Arc_Info
 Arc info extension that stores capacity and flow values. More...
 
class  Net_Cap_Graph
 Capacitated network with node capacity constraints. More...
 
class  Net_Cap_Node
 Node with capacity constraint for flow networks. More...
 
struct  Net_Cost_Arc
 Arc type for maximum flow minimum cost networks. More...
 
struct  Net_Cost_Graph
 Capacitated flow network with costs associated to arcs. More...
 
struct  Net_Filt
 Arc filter for residual traversal in flow networks. More...
 
struct  Net_Graph
 Flow network implemented with adjacency lists. More...
 
class  Net_Sup_Dem_Graph
 Network graph with supply and demand nodes. More...
 
class  Net_Sup_Dem_Node
 Node with supply/demand flow value. More...
 
class  Network_Simplex
 Network Simplex algorithm for minimum cost flow. More...
 
struct  NetworkGenParams
 Parameters for random network generation. More...
 
struct  NetworkSimplexStats
 Execution statistics for Network Simplex algorithm. More...
 
struct  Node_Arc_Iterator
 Filtered iterator of adjacent arcs of a node. More...
 
class  Node_Iterator
 Filtered iterator on the nodes of a graph. More...
 
struct  node_traits
 
class  Nodes_Index
 Builds a node index for fast lookup and retrieval. More...
 
struct  NoLazyTag
 No-op lazy tag (default — no deferred path updates). More...
 
struct  None
 Represents a missing value. More...
 
struct  NonPlanar_Certificate_Export_Options
 Export options for non-planar certificate serializers. More...
 
struct  NonPlanar_Certificate_Validation
 Structural validation report for non-planar certificates. More...
 
struct  not_equal_to
 
class  Now
 Class Now is a practical class for timing based in a high resolution clock. More...
 
class  NTT
 Number Theoretic Transform over Z / MOD Z. More...
 
class  NTTExact
 Exact polynomial multiplication via three-prime NTT + CRT. More...
 
struct  NTTPrime
 Metadata for an NTT-friendly prime used in CRT reconstruction. More...
 
struct  Null_Adversarial_Search_Tracer
 Default no-op tracer used when the caller does not request tracing. More...
 
struct  Null_History_Heuristic_Table
 Null history heuristic hook used when a domain has no move key. More...
 
class  ObjectiveIncumbent
 Global incumbent manager for branch and bound. More...
 
class  ODhashTable
 Open addressing hash table with double hashing collision resolution. More...
 
class  OLhashTable
 Open addressing hash table with linear probing collision resolution. More...
 
class  Operate_On_Arcs
 Functor that traverses the arcs of a graph and performs an operation. More...
 
class  Operate_On_Nodes
 Functor that traverses the nodes of a graph and performs an operation. More...
 
class  operation_canceled
 Exception thrown when cooperative cancellation is observed. More...
 
struct  OptimizationSolution
 Snapshot of a complete optimization solution. More...
 
class  Out_Iterator
 Filtered iterator for outcoming arcs of a node. More...
 
class  Packed_Matrix
 Matrix whose columns are bit fields: an Aleph::Array of Packed_Row. More...
 
class  Packed_Row
 Tuple of small integers packed into the fewest whole words. More...
 
struct  Painted_Min_Spanning_Tree
 Filter of painter arcs with that are set the Spanning_Tree control bit. More...
 
class  Pair_Iterator
 Iterator that zips two other iterators. More...
 
struct  ParallelOptions
 Common configuration object for parallel algorithms. More...
 
class  ParseError
 Exception class for parsing errors with location information. More...
 
class  Path
 Path on a graph. More...
 
class  PatriciaMap
 Compressed bitwise map for unsigned integral keys. More...
 
class  PatriciaSet
 Compressed bitwise set for unsigned integral keys. More...
 
class  PersistentHashMap
 Immutable unordered map backed by a Hash Array Mapped Trie (HAMT). More...
 
class  PersistentTreapMap
 Immutable ordered map backed by a path-copying treap. More...
 
class  PersistentTreapSet
 Immutable ordered set backed by a path-copying treap. More...
 
class  PersistentVector
 Immutable vector backed by a 32-way bitmapped trie. More...
 
struct  Planar_Dual_Edge_Info
 Dual-edge payload linked to a primal simplified edge. More...
 
struct  Planar_Dual_Metadata
 Metadata extracted from a planar embedding for face/dual analysis. More...
 
struct  Planar_Geometric_Drawing
 Embedding-aware geometric drawing result. More...
 
struct  Planar_Geometric_Drawing_Options
 Options for embedding-aware 2D drawing extraction. More...
 
class  Planarity_Test
 Functor wrapper for planarity_test(). More...
 
struct  Planarity_Test_Options
 Configuration options for planarity testing and auxiliary outputs. More...
 
struct  Planarity_Test_Result
 Complete result of a planarity test execution. More...
 
struct  plus
 
class  Point
 Represents a point with rectangular coordinates in a 2D plane. More...
 
class  Point3D
 Represents a point in 3D space with exact rational coordinates. More...
 
class  pointer_to_binary_function
 
class  pointer_to_unary_function
 
class  PointInPolygonWinding
 Exact point-in-polygon classification via winding number. More...
 
class  Polar_Point
 Polar representation of a 2D point. More...
 
struct  PolyFitAnalysis
 Structure holding residual analysis for polynomial fits. More...
 
class  Polygon
 A general (irregular) 2D polygon defined by a sequence of vertices. More...
 
class  PolygonOffset
 Offset (inflate/deflate) an arbitrary simple polygon. More...
 
class  PowerDiagram
 Power diagram (weighted Voronoi diagram). More...
 
struct  Powerful_Array_Policy
 Policy: "powerful array" sum = sum(cnt[x]^2 * x). More...
 
struct  PP_Res_Node
 Residual node used by preflow-push algorithms. More...
 
struct  Prefer_Deeper_Entry
 Replacement policy that prefers entries searched to greater depth. More...
 
struct  Prefer_Exact_Adversarial_Entry
 Replacement policy for adversarial transposition entries. More...
 
struct  PreferBetterObjective
 Compare two optimization solutions by objective quality. More...
 
class  Prefix_Tree
 Owning prefix tree wrapper. More...
 
class  Prefix_Tree_Map
 Owning prefix tree map from strings to values. More...
 
struct  Prim_Heap_Info
 
struct  Prim_Info
 
class  Prim_Min_Spanning_Tree
 Computes the minimum spanning tree of a graph using Prim's algorithm. More...
 
struct  Product_Disjoint_Sparse_Table
 Disjoint Sparse Table for range product queries. More...
 
struct  ProductMonoid
 Product monoid: identity = 1, combine = a * b. More...
 
struct  Project
 Project with profit and dependencies. More...
 
struct  ProjectSelectionResult
 Result of project selection. More...
 
class  Q_Topological_Sort
 Computes topological ordering using breadth-first search (Kahn's algorithm). More...
 
class  queue_overflow_error
 Exception thrown when the task queue exceeds its hard limit. More...
 
class  QuickHull
 QuickHull convex hull algorithm. More...
 
class  Quotient_Filter
 Quotient filter for probabilistic set membership with deletion. More...
 
class  RadixTree
 Compressed prefix tree mapping std::basic_string<Char> keys to values of type T. More...
 
struct  Rand_Tree
 Randomized binary search tree. More...
 
struct  Rand_Tree_Vtl
 Randomized binary search tree. More...
 
class  RandNode
 
class  RandNodeVtl
 
class  Random_Digraph
 Random directed graph (digraph) generator. More...
 
class  Random_Graph
 Random undirected graph generator. More...
 
class  Random_Graph_Base
 
struct  Random_Preflow_Maximum_Flow
 Functor wrapper for random_preflow_maximum_flow(). More...
 
class  Random_Set
 Random queue. More...
 
class  Random_Source
 The source of random numbers of a randomized structure, which draws from one of two generators. More...
 
class  Range_Fenwick_Tree
 Fenwick tree supporting range updates and range queries. More...
 
struct  Range_Mode_Policy
 Policy: range mode (most frequent element). More...
 
class  RangeTree2D
 Static 2D range tree for orthogonal range queries. More...
 
struct  RangeTreeQueryVizResult
 Result bundle for range-tree query visualization. More...
 
struct  RankedMove
 One move plus the metadata used by ordering comparators. More...
 
struct  Rarc
 
struct  Rb_Tree
 Red-black tree with nodes without virtual destructor. More...
 
struct  Rb_Tree_Rk
 Red-Black binary search tree with nodes without virtual destructor and with subtree counters for select/position operations. More...
 
struct  Rb_Tree_Rk_Vtl
 Red-Black binary search tree with virtual destructor in its nodes and with subtree counters for select/position operations. More...
 
struct  Rb_Tree_Vtl
 Red-black tree with virtual destructor in nodes. More...
 
class  RbNodeRk
 Extended Red-Black node with subtree counter. More...
 
class  RbNodeRk_Data
 Red-Black node data with color and subtree count. More...
 
class  RbNodeRkVtl
 
struct  Rcost
 Cost distance functor for Bellman-Ford on residual networks. More...
 
struct  Rcost_With_Tolerance
 Cost of a residual arc, with a tolerance for the relaxations of Bellman-Ford (see the parameter Distance of Bellman_Ford), which the cycle canceling takes for a floating flow. More...
 
class  Rectangle
 An axis-aligned rectangle. More...
 
class  Regular_Polygon
 A regular polygon defined by center, side length, and vertex count. More...
 
class  RegularTriangulationBowyerWatson
 Exact regular triangulation (weighted Delaunay) via Bowyer-Watson. More...
 
struct  Replace_Always
 Minimal replacement policy: always replace the current entry. More...
 
struct  Res_Arc
 Residual arc type with mirror pointer. More...
 
struct  Res_F
 Residual arc filter: keep arcs with residual capacity. More...
 
struct  Res_Filt
 Arc filter for residual networks. More...
 
struct  Res_Filt_With_Tolerance
 Arc filter for the residual networks of a floating flow, which the cycle canceling takes: an arc has residual capacity if it has more than a tolerance left. More...
 
class  Reservoir_Sampler
 Incremental reservoir sampler (Algorithm R). More...
 
class  RevisedSimplex
 Revised Simplex algorithm for linear programming. More...
 
class  RingBuffer
 Fixed-capacity circular FIFO buffer over contiguous storage. More...
 
struct  Rnode
 
class  Rope
 Immutable, structurally-shared rope over a sequence of Char. More...
 
class  RotatedEllipse
 An ellipse with arbitrary rotation. More...
 
class  RotatingCalipersConvexPolygon
 Rotating calipers metrics for convex polygons. More...
 
struct  RotatingCalipersResult
 Bundle of rotating-calipers results used by visualization helpers. More...
 
class  RTree
 Dynamic R-tree indexing axis-aligned rectangles by payload. More...
 
struct  RTreeQueryVizResult
 Result bundle for R-tree/R*-tree query visualization. More...
 
class  RwSynchronized
 Read/write-lock protected shared object wrapper. More...
 
class  Scope
 Lexical scope stack for Key to Value associations. More...
 
class  Scope_Guard
 Generic RAII scope guard for cleanup operations on graphs. More...
 
struct  SearchLimits
 Hard bounds applied by the search engine. More...
 
struct  SearchResult
 Aggregates the outcome of one search execution. More...
 
struct  SearchSolution
 Snapshot of a concrete solution encountered during the traversal. More...
 
class  SearchSolutionCollector
 Collector that stores accepted solutions in an Aleph list. More...
 
struct  SearchStats
 Counters collected during a search run. More...
 
class  Segment
 Represents a line segment between two points. More...
 
class  Segment3D
 Represents a line segment in 3D space. More...
 
class  Segment_Tree_Beats
 Ji Driver's Segment Tree (Segment Tree Beats). More...
 
class  SegmentArrangement
 Compute the full planar subdivision induced by a set of segments. More...
 
struct  SegmentationResult
 Result of binary image segmentation. More...
 
class  SegmentSegmentIntersection
 Dedicated exact intersection for a single pair of segments. More...
 
struct  SensitivityRange
 Sensitivity analysis result for a coefficient. More...
 
struct  Short_Cycle_Result
 Exact optimum returned by most_negative_cycle_up_to_3(). More...
 
class  Shortest_Path_Base
 Base class providing common infrastructure for shortest path algorithms. More...
 
struct  ShortestPathDebugResult
 Result bundle for shortest-path + funnel portal visualization. More...
 
class  ShortestPathInPolygon
 Compute the shortest Euclidean path between two points inside a simple polygon. More...
 
struct  Show_All
 Default filter functor that shows all elements. More...
 
struct  Show_None
 Filter functor that hides all elements. More...
 
class  SimHash
 SimHash fingerprint generator. More...
 
struct  Simple_Prim_Heap
 
class  Simplex
 Linear program solver using the Simplex method. More...
 
struct  Simplex_Arc_Info
 Arc information for Network Simplex algorithm. More...
 
struct  Simplex_Node_Info
 Node information for Network Simplex algorithm. More...
 
struct  SimplexStats
 Execution statistics for the Simplex algorithm. More...
 
class  SkipList
 Skip List - a probabilistic ordered data structure. More...
 
class  Slink
 Singly linked handle to list nodes. More...
 
class  Slink_Nc
 Singly linked list node (non-circular). More...
 
class  Slinknc
 Link of a single linked list non-circular and without header node. More...
 
class  Slist
 Singly linked list of nodes that store values of type T. More...
 
class  SmallVector
 Contiguous dynamic array with N elements of inline storage. More...
 
class  Snode
 Singly linked node that stores data of type T. More...
 
class  Snode_Nc
 
class  Snodenc
 
struct  Some
 Represents a found value (stored by reference). More...
 
struct  Source_File
 Registered source file with cached line starts. More...
 
class  Source_Manager
 Stores source files and resolves offsets into human-readable data. More...
 
struct  Source_Position
 Fully resolved source position. More...
 
struct  Source_Snippet
 Render-ready excerpt for a single source line. More...
 
struct  Source_Span
 Half-open byte range inside a source file. More...
 
struct  SourceLocation
 Represents a location in source code. More...
 
struct  Sparse_Table
 Sparse Table for range minimum queries. More...
 
class  SplitMix64_Rng
 SplitMix64: a random number generator whose state is a word of 64 bits. More...
 
class  SpscQueue
 Bounded single-producer/single-consumer queue. More...
 
struct  SSP_Node_Info
 Node info for SSP algorithm. More...
 
struct  Stats
 Container for comprehensive statistical results. More...
 
class  StlEnumerateIterator
 Iterator that pairs each element with its index. More...
 
class  StlEnumerateView
 Lazy view that pairs each element with its index. More...
 
class  StlZipIterator
 Lazy iterator that traverses multiple STL containers in lockstep. More...
 
class  StlZipView
 Lazy view over multiple zipped STL containers. More...
 
class  Stoer_Wagner_Min_Cut
 Stoer-Wagner deterministic minimum cut algorithm. More...
 
struct  StreamPosition
 Structure to save stream position for backtracking. More...
 
struct  Subset_Sum_Result
 Result of a subset sum computation. More...
 
struct  Successive_Shortest_Paths
 Functor wrapper for SSP algorithm. More...
 
class  Suffix_Automaton
 Suffix automaton (SAM) over byte alphabet. More...
 
struct  Sum_Disjoint_Sparse_Table
 Disjoint Sparse Table for range sum queries. More...
 
struct  Sum_Segment_Tree
 Sum Segment Tree for range sum queries with point updates. More...
 
struct  SumMonoid
 Sum monoid: identity = 0, combine = a + b. More...
 
struct  SurveyDesignResult
 Result of survey design. More...
 
struct  SurveyQuestion
 Survey question with constraints. More...
 
struct  SurveyRespondent
 Survey respondent with constraints. More...
 
class  SweepLineSegmentIntersection
 Report all pairwise intersection points among a set of segments. More...
 
class  Synchronized
 Mutex-protected shared object wrapper. More...
 
class  Tarjan_Connected_Components
 Computes strongly connected components (SCCs) in a directed graph using Tarjan's algorithm. More...
 
class  TaskGroup
 Minimal structured-concurrency helper over ThreadPool futures. More...
 
class  TdRbTree
 Top-down red-black tree without virtual destructor. More...
 
class  TdRbTreeRk
 Top-down red-black tree with rank (no virtual destructor). More...
 
class  TdRbTreeRkVtl
 Top-down red-black tree with rank (virtual destructor). More...
 
class  TdRbTreeVtl
 Top-down red-black tree with virtual destructor. More...
 
struct  Team
 Team information for baseball elimination. More...
 
class  Test_Dirac_Condition
 Tests Dirac's sufficient condition for Hamiltonian graphs. More...
 
class  Test_Eulerian
 Tests whether a graph or digraph is Eulerian. More...
 
class  Test_For_Cycle
 Test whether a cycle is reachable from a given node. More...
 
class  Test_For_Path
 Checks whether a path exists between two nodes. More...
 
class  Test_Hamiltonian_Sufficiency
 Tests Ore's sufficient condition for Hamiltonian graphs. More...
 
class  Test_Single_Graph
 Determines whether a graph or digraph is simple. More...
 
class  Tetrahedron
 Represents a tetrahedron in 3D space defined by four points. More...
 
class  Text
 Represents a text string positioned at a 2D point. More...
 
class  ThreadPool
 A reusable thread pool for efficient parallel task execution. More...
 
struct  ThreadPoolStats
 Statistics collected by ThreadPool. More...
 
struct  Tikz_Beamer_Document_Options
 Options used by Tikz_Scene beamer/handout export helpers. More...
 
struct  Tikz_Cubic_Bezier
 Represents a cubic Bézier curve for native TikZ rendering. More...
 
class  Tikz_Plane
 2D TikZ canvas storing geometry objects and emitting LaTeX output. More...
 
struct  Tikz_Polyline
 An open or closed polyline for TikZ rendering. More...
 
struct  Tikz_Quadratic_Bezier
 Represents a quadratic Bézier curve for native TikZ rendering. More...
 
class  Tikz_Scene
 High-level scene wrapper to compose objects and algorithm visualizations. More...
 
struct  Tikz_Standalone_Document_Options
 Options used by Tikz_Scene standalone document export. More...
 
struct  Tikz_Style
 Style descriptor for TikZ primitives. More...
 
struct  To_Graphviz
 Functor class for generating Graphviz DOT specifications. More...
 
struct  Token
 Structure representing a lexical token. More...
 
class  Topological_Sort
 Computes topological ordering using depth-first search. More...
 
class  Total_Cost
 Compute the total cost (sum of arc weights) of a graph. More...
 
struct  TransportationResult
 Result of transportation problem. More...
 
class  Transposition_Table
 Transposition-table container built on top of Aleph hash maps. More...
 
struct  TranspositionStats
 Statistics collected by memo/transposition storage. More...
 
struct  Transshipment_Node_Info
 Node with supply/demand for transshipment problems. More...
 
struct  TransshipmentResult
 Result of transshipment problem. More...
 
class  TrapezoidalMapPointLocation
 O(log n) point location via trapezoidal map with DAG search. More...
 
class  TraverseMixin
 CRTP Mixin providing traversal operations. More...
 
struct  Treap
 Treap (a special type of randomized binary search tree) using nodes without virtual destructor. More...
 
struct  Treap_Rk
 Extended treap (a special type of randomized binary search tree) which manages selection and splitting for inorder position. More...
 
class  Treap_Rk_Node
 
class  Treap_Rk_NodeVtl
 
struct  Treap_Rk_Vtl
 Extended treap (a special type of randomized binary search tree) which manages selection and splitting for inorder position. More...
 
struct  Treap_Vtl
 Treap (a special type of randomized binary search tree) using nodes with virtual destructors. More...
 
class  TreapNode
 Declare TreapNode type with 80-byte pool allocation. More...
 
class  TreapNode_Data
 Data portion of a treap node. More...
 
class  TreapNodeVtl
 
class  TreapRkNode_Data
 
class  Tree_Node
 Forward declaration used by CRTP helpers before the full node definition. More...
 
struct  Tree_Node_Vtl
 Tree_Node variant with a virtual destructor. More...
 
class  Triangle
 A non-degenerate triangle defined by three points. More...
 
class  Triangle3D
 Represents a triangle in 3D space defined by three points. More...
 
class  Two_Sat
 2-SAT solver using Tarjan's SCC algorithm. More...
 
struct  unary_function
 
class  unary_negate
 
class  Unconnected_Components
 Compute the connected components of a graph. More...
 
struct  unexpect_t
 Tag type used to construct an expected holding an error in place. More...
 
class  unexpected
 Wrapper for the error value used to initialize an expected. More...
 
struct  Uninit_Prim_Info
 
struct  Unit_Weight
 Unit weight functor for unweighted graphs. More...
 
class  UniZipIterator
 Iterator that traverses multiple containers (STL or Aleph) in lockstep. More...
 
class  UniZipSentinel
 Sentinel type for UniZipIterator end comparison. More...
 
class  UniZipView
 Lazy view over multiple zipped containers (STL or Aleph). More...
 
class  Vector
 Sparse vector implementation with domain-based indexing. More...
 
class  Vertex
 A vertex in a polygon's doubly linked vertex list. More...
 
class  VisibilityPolygon
 Compute the visibility polygon from a point inside a simple polygon. More...
 
class  VisvalingamWhyattSimplification
 Visvalingam-Whyatt polyline simplification. More...
 
class  VoronoiDiagram
 O(n log n) Voronoi diagram construction. More...
 
class  VoronoiDiagramFortune
 The Voronoi diagram, as VoronoiDiagram computes it. More...
 
class  VoronoiDiagramFromDelaunay
 Voronoi diagram derived as the dual of a Delaunay triangulation. More...
 
struct  Warc
 
class  Warshall_Compute_Transitive_Clausure
 Computes the transitive closure of a graph using Warshall's algorithm. More...
 
class  Welsh_Powell_Coloring
 Functor wrapper for welsh_powell_coloring. More...
 
struct  Wnode
 
struct  Write_Df_Tree_Df
 Writer for generate_tree() that shows the label and the df number of each node, as (label,df). More...
 
struct  Write_Df_Tree_Label
 Writer for generate_tree() that shows the label of each node. More...
 
struct  Write_Df_Tree_Low
 Writer for generate_tree() that shows the label, the df and the low numbers of each node, as label,df,low. More...
 
class  Xml_Graph
 Class that writes and reads a graph (in a very elementary way) as XML. More...
 
struct  XorMonoid
 XOR monoid: identity = 0, combine = a ^ b. More...
 
class  Yen_K_Shortest_Paths
 Functor wrapper for Yen's k-shortest loopless paths algorithm. More...
 
struct  Zero_Heuristic
 Default heuristic for A* (zero heuristic, degrades to Dijkstra). More...
 
class  Zero_One_BFS
 0-1 BFS algorithm for shortest paths in graphs with 0/1 weights. More...
 
class  ZipIterator< C >
 Base case of ZipIterator: the read-only iterator of the last container. More...
 

Concepts

concept  BinaryPredicate
 A callable that takes two const T& and returns bool.
 
concept  StrictWeakOrder
 Strict weak ordering constraint for BST comparators.
 
concept  EqualityComparator
 Equivalence relation constraint for equality comparators.
 
concept  BSTPolicy
 Concept for BST tree policies used by DynSetTree.
 
concept  AlephArrayConvertible
 Concept that identifies types that can be converted or used as an Aleph Array.
 
concept  AlephSequentialContainer
 Concept for Aleph-w mutable sequential containers.
 
concept  AlephSequentialIterableContainer
 Concept for Aleph-w sequential containers that can be iterated.
 
concept  AlephIterator
 An Aleph cursor-style iterator, as generic library code uses it.
 
concept  AlephUncheckedIterator
 An AlephIterator whose get_curr_ne() gives what get_curr() gives, without its check.
 
concept  AlephIterable
 A type that yields an AlephIterator over its Item_Types.
 
concept  AlephTraversable
 A container whose items can be visited with traverse().
 
concept  AlephIterableContainer
 A traversable, AlephIterable container with a size.
 
concept  AlephSequence
 An iterable container that grows at its back with append().
 
concept  AppendableWith
 A container whose append() accepts an argument of type Item.
 
concept  InsertableWith
 A container whose insert() accepts an argument of type Item.
 
concept  StlIterableContainer
 A container with STL-style begin()/end() and value_type.
 
concept  IntegerSortableValue
 Integral value accepted by linear-time integer sorting algorithms.
 
concept  ArrayStorable
 An element type the Aleph arrays can store.
 
concept  ClosedBinaryOp
 A binary functor closed over T.
 
concept  StaticMonoid
 A static monoid: M::identity() and M::combine(a, b).
 
concept  CallableWith
 f(args...) is a valid call expression, exactly as written.
 
concept  PredicateWith
 f(args...) is a valid call whose result is usable as a condition.
 
concept  InvocableWith
 std::invoke(f, args...) is valid.
 
concept  InvocablePredicateWith
 std::invoke(f, args...) is valid and usable as a condition.
 
concept  NothrowPredicateWith
 PredicateWith<F, Args...>, and neither the call nor the conversion of its result to bool can throw.
 
concept  BinNodeLike
 A binary tree node usable by tpl_binNodeUtils.H.
 
concept  RankedBinNodeLike
 A binary tree node that also keeps subtree sizes (rank).
 
concept  AlephGraph
 A graph usable by the graph algorithms.
 
concept  NodeFilter
 A node filter (SN) for graph GT.
 
concept  ArcFilter
 An arc filter (SA) for graph GT.
 
concept  ArcDistance
 An arc distance (Distance) for graph GT.
 
concept  DigraphType
 A graph type built with the Digraph template.
 
concept  FlowNetwork
 A flow network usable by the max-flow and min-cost algorithms.
 
concept  AlephSequential
 Concept for Aleph sequential containers with traversal and append semantics.
 
concept  AlDomainKey
 A key of a domain: of an AlDomain, and so an index of a Vector or of a Matrix.
 
concept  AlOrderedDomainKey
 A key of a domain that < orders: what AlDomain::keys(), and the members that take the keys in their order, need.
 
concept  AlStreamable
 A value that << writes to a stream: what the members that print keys or numbers need.
 
concept  AlNumber
 A number of the entries of a Vector or of a Matrix.
 
concept  AlAdditiveNumber
 A number that adds and subtracts: what the sums, the differences and the comparisons of vectors and matrices need.
 
concept  AlMultiplicativeNumber
 A number that multiplies: what the products by a scalar, and the products of vectors and matrices, need.
 
concept  AlDivisibleNumber
 A number that divides: what the division of a vector by a scalar needs.
 
concept  BranchAndBoundObjectivePolicy
 Concept for objective policies used by branch and bound.
 
concept  CompleteSolutionPredicate
 Concept for complete-solution predicates in optimization domains.
 
concept  OptimizationEvaluator
 Concept for domains that provide an objective and an optimistic bound.
 
concept  BranchAndBoundDomain
 Minimal contract for branch-and-bound domains.
 
concept  HashableByADL
 Concept: T provides a semantic hash via ADL.
 
concept  SparseMatrix
 Expresses requirements for sparse matrix backends like DynMatrix.
 
concept  DenseMatrix
 Expresses requirements for dense matrix backends like Array<Array<uint64_t>>.
 
concept  ModularMatrixBackend
 Union of supported matrix backends for modular operations.
 
concept  AdversarialScore
 Score type accepted by adversarial search engines.
 
concept  AdversarialTranspositionMemo
 Concept for memo tables storing adversarial-search entries.
 
concept  AdversarialSearchTracer
 Concept for adversarial-search trace sinks.
 
concept  AdversarialSearchKeyer
 Concept for explicit state-key providers used by adversarial TT overloads.
 
concept  GameEvaluator
 Required evaluator contract for zero-sum games.
 
concept  AdversarialGameDomain
 Minimal contract for alternating-turn zero-sum games.
 
concept  SearchState
 Minimal requirement for mutable search states.
 
concept  SearchMove
 Minimal requirement for search moves.
 
concept  VisitedStateSet
 Concept for a set suitable for tracking globally visited states.
 
concept  VisitedBoundMap
 Concept for a map tracking the best bound seen per visited state.
 
concept  IncrementalBoundProvider
 Concept for domains that can estimate a move's bound without modifying state (incremental bound for Branch-and-Bound ordering).
 
concept  IncrementalEvaluator
 Concept for adversarial-search domains that can estimate a child score without modifying state (incremental evaluator for Alpha_Beta Estimated_Score move ordering).
 
concept  SupportsBestFirst
 Concept that checks whether a search engine supports the Best_First exploration strategy at compile time.
 
concept  SearchSolutionVisitor
 Concept for callbacks invoked on each accepted solution.
 
concept  SuccessorGenerator
 Concept for lazy successor generation.
 
concept  GoalPredicate
 Concept for domains that can recognize goal states.
 
concept  TerminalPredicate
 Optional concept for explicit non-solution terminal states.
 
concept  DomainPruner
 Optional concept for domain-side pruning hooks.
 
concept  MoveKeyProvider
 Optional concept for domains that can key moves for history heuristics.
 
concept  SearchStateKeyProvider
 Generic concept for domains that can expose a stable state key.
 
concept  HeuristicEvaluator
 Concept for domains that provide an admissible heuristic.
 
concept  ActionCostProvider
 Concept for domains that provide the cost of applying a move.
 
concept  BacktrackingDomain
 Minimal contract for DFS/backtracking domains.
 
concept  IDAStarDomain
 Minimal contract for IDA* domains.
 
concept  TikzDrawable
 A geometry type that Tikz_Plane::Object can wrap.
 
concept  DisjointSparseTableOp
 Binary operation compatible with Disjoint Sparse Table queries.
 
concept  FenwickArithmetic
 Arithmetic domain accepted by Fenwick specializations.
 
concept  FenwickBinaryOp
 Binary operation compatible with Fenwick tree group functors.
 
concept  LCTMonoid
 Concept for a monoidal combiner over path values.
 
concept  LCTLazyTag
 Concept for a lazy-tag policy used in deferred path updates.
 
concept  MoPolicy
 Concept constraining a policy for Mo's algorithm.
 
concept  MoTreeGraph
 Concept constraining a graph type usable for Mo on Trees.
 
concept  RopeCharTraitsCompatible
 True exactly for the character types std::char_traits is specialized for by the standard (char, wchar_t, char8_t, char16_t, char32_t), i.e.
 
concept  SegmentTreeOp
 Binary operation compatible with Segment Tree queries.
 
concept  SegmentTreePolicy
 Policy concept for lazy segment tree.
 
concept  CountingSortable
 Value concept accepted by counting sort overloads.
 
concept  RadixSortable
 Value concept accepted by radix sort overloads.
 
concept  IdempotentOp
 A closed binary operation not known to break idempotency.
 
concept  SparseTableOp
 Binary operation compatible with Sparse Table queries.
 
concept  TranspositionReplacementPolicy
 Minimal protocol for replacement policies.
 
concept  MemoTable
 Minimal protocol for memo tables used by search engines.
 

Typedefs

template<class C >
using const_iterator_t = Const_Iterator< typename C::Iterator >
 The read-only iterator of the container C.
 
template<class IndexType , size_t Rank>
using dextents = typename decltype(mdspan_detail::dextents_of< IndexType >(std::make_index_sequence< Rank >{}))::type
 extents<IndexType, ...> with all Rank axes dynamic — the common case.
 
using Source_File_Id = size_t
 
using Source_Offset = size_t
 
template<typename... Types>
using to_index_tuple = typename make_index_tuple< sizeof...(Types)>::type
 Convenience alias to generate an index tuple from a parameter pack.
 
using T = std::decay_t< typename HeadC::Item_Type >
 
using Tuple_Type = decltype(std::tuple_cat(std::declval< std::tuple< T > >(), std::declval< typename ZipIterator< TailC... >::Tuple_Type >()))
 The tuple type returned by get_curr() and get_curr_ne()
 
using Item_Type = T
 Type of elements from the first container.
 
using size_type = size_t
 
typedef uint32_t IPv4_Address
 Type alias for IPv4 addresses stored as 32-bit integers.
 
typedef Field< int > Integer
 
typedef Field< short > Short
 
typedef Field< float > Float
 
typedef Field< double > Double
 
typedef Field< long double > Ldouble
 
template<typename First , typename Second >
using pair = std::pair< First, Second >
 Alias to std::pair kept for backwards compatibility.
 
using Compiler_Bytecode_Register_Id = size_t
 
using Compiler_Bytecode_Constant_Id = size_t
 
using Compiler_Bytecode_Function_Id = size_t
 
using Compiler_Bytecode_Block_Id = size_t
 
using Compiler_Bytecode_PC = size_t
 
using Compiler_CFG_Block_Id = size_t
 Typedef for unique block identifiers within a function.
 
using Compiler_IR_Value_Id = size_t
 
using Compiler_IR_Local_Slot_Id = size_t
 
using Compiler_IR_Global_Slot_Id = size_t
 
using Compiler_IR_Function_Id = size_t
 
using Compiler_IR_Block_Id = size_t
 
using Compiler_Symbol_Id = size_t
 
using Compiler_Type_Id = size_t
 
template<typename T >
using bounded_channel = BoundedChannel< T >
 Alias for Aleph::BoundedChannel.
 
template<typename T , typename Mutex = std::mutex>
using synchronized = Synchronized< T, Mutex >
 Alias for Aleph::Synchronized.
 
template<typename T , typename SharedMutex = std::shared_mutex>
using rw_synchronized = RwSynchronized< T, SharedMutex >
 Alias for Aleph::RwSynchronized.
 
template<typename T >
using spsc_queue = SpscQueue< T >
 Alias for Aleph::SpscQueue.
 
using Df_Low_Tree_Node = Tree_Node< Df_Low_Key >
 Node of the depth-first tree that build_df_low_tree() returns.
 
using Df_Low_Non_Tree_Arc = std::pair< Df_Low_Tree_Node *, Df_Low_Tree_Node * >
 Arc of the graph that is not in the depth-first tree.
 
template<class GT , class Itor , class Show_Arc = Dft_Show_Arc<GT>>
using Graph_Traverse_DFS_Generator = Graph_Traverse_Generator< GT, Itor, DynListStack, Show_Arc >
 Lazy depth-first traversal: Graph_Traverse_Generator with a DynListStack frontier.
 
template<class GT , class Itor , class Show_Arc = Dft_Show_Arc<GT>>
using Graph_Traverse_BFS_Generator = Graph_Traverse_Generator< GT, Itor, DynListQueue, Show_Arc >
 Lazy breadth-first traversal: Graph_Traverse_Generator with a DynListQueue frontier.
 
using Symbol_Map = DynMapTree< std::string, Huffman_Node *, Treap_Vtl >
 
using Freq_Node = BinNode< std::pair< std::string, size_t > >
 
typedef BinHeap< size_t > Huffman_Heap
 
typedef DynMapTree< std::string, BitArray, Treap_Vtl > Code_Map
 
using Interpreter_Host_Function = bool(*)(void *user_data, const DynArray< Interpreter_Value > &arguments, Interpreter_Value &result, Interpreter_Runtime_Error &error)
 Host callback signature used by runtime built-ins or embeddings.
 
template<class GT , class SA = Dft_Show_Arc<GT>>
using Karger_Stein_Min_Cut = Karger_Min_Cut< GT, SA >
 Alias for Karger_Min_Cut (use fast() method for Karger-Stein)
 
template<class GT , class SA = Dft_Show_Arc<GT>>
using Binary_Lifting_LCA = Gen_Binary_Lifting_LCA< GT, SA >
 Convenience alias for binary-lifting LCA.
 
template<class GT , class SA = Dft_Show_Arc<GT>>
using Euler_RMQ_LCA = Gen_Euler_RMQ_LCA< GT, SA >
 Convenience alias for Euler+RMQ LCA.
 
using Info_Nodo = std::pair< std::string, DynDlist< std::string > >
 Node payload: (id, fields) where fields come from the input row.
 
using Nodo = Graph_Node< Info_Nodo >
 Node type for the digraph.
 
using Arco = Graph_Arc< std::string >
 Arc type for the digraph (edge info is a string).
 
using Digrafo = List_Digraph< Nodo, Arco >
 Digraph type used by the loader.
 
using ModularMatrix = Modular_Matrix< Array< Array< uint64_t > > >
 Alias for common Array-based modular matrix.
 
using ModularSparseMatrix = Modular_Matrix< DynMatrix< uint64_t > >
 Alias for sparse DynMatrix-based modular matrix.
 
template<typename StateKey , SearchMove Move, AdversarialScore Score, template< typename, typename, class > class HashMapTable = MapOLhash, class Cmp = Aleph::equal_to<AdversarialTranspositionKey<StateKey>>>
using AdversarialTranspositionTable = Transposition_Table< AdversarialTranspositionKey< StateKey >, AdversarialTranspositionEntry< Move, Score >, HashMapTable, Cmp, Prefer_Exact_Adversarial_Entry< Move, Score > >
 
template<class GT >
using Default_Planar_Dual_Graph = List_Graph< Graph_Node< size_t >, Graph_Arc< Planar_Dual_Edge_Info< GT > > >
 
using Geom_Number = mpq_class
 Numeric type used by the geometry module.
 
typedef unsigned char Color
 
using Compiler_SSA_Value_Id = size_t
 
using Compiler_SSA_Block_Id = size_t
 
template<SearchMove Move>
using SearchPath = Array< Move >
 Default Aleph container used to store a move path.
 
using SearchClock = std::chrono::steady_clock
 Monotonic clock used for search timings.
 
template<typename Key , typename Data , template< typename, typename, class > class HashMapTable = MapOLhash, class Cmp = Aleph::equal_to<Key>>
using SearchStorageMap = DynHashMap< Key, Data, HashMapTable, Cmp >
 Aleph hash map alias for memoization/transposition storage.
 
template<typename Key , template< typename, class > class HashSetTable = OLhashTable, class Cmp = Aleph::equal_to<Key>>
using SearchStorageSet = DynHashSet< Key, HashSetTable, Cmp >
 Aleph hash set alias for visited-state storage.
 
template<typename Solution , typename Compare = KeepFirstSolution<Solution>>
using Incumbent = BestSolution< Solution, Compare >
 Alias used by optimization/search engines for their current best.
 
using ExceptionCallback = std::function< void(std::exception_ptr)>
 Type for exception callback in detached tasks.
 
using FunnelPortal = detail::SPP_Portal
 
template<typename __Graph_Node = Graph_Anode<int>, typename __Graph_Arc = Graph_Aarc<int>>
using Array_Digraph = Digraph< Array_Graph< __Graph_Node, __Graph_Arc > >
 Directed graph (digraph) implemented with array-based adjacency lists.
 
template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
using B_Tree = Gen_B_Tree< Key, Compare, MinDegree >
 Convenient B-Tree alias.
 
template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
using BPlus_Tree = Gen_BPlus_Tree< Key, Compare, MinDegree >
 Convenient B+ Tree alias.
 
using Compiler_Type_Constraint = Equality_Constraint< Compiler_Type_Id >
 
using Compiler_Type_Constraint_Set = Constraint_Set< Compiler_Type_Id >
 
template<class T >
using Dfs_Here = std::conditional_t< std::is_move_assignable_v< T >, T, std::optional< T > >
 The variable that holds the frame of the node that a depth-first search visits.
 
template<typename Key , class Cmp = Aleph::equal_to<Key>>
using DynSetHash = DynHashTable< Key, LhashTable, Cmp >
 
template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>>
using DynMapLinHash = DynMapHashTable< Key, Data, LinearHashTable, Cmp >
 
template<typename Key , typename Data , class Cmp = Aleph::equal_to<Key>>
using DynMapHash = DynMapHashTable< Key, Data, LhashTable, Cmp >
 
template<typename Key , typename Value , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename KeyCodec = detail::Paged_Value_Codec<Key>, typename ValueCodec = detail::Paged_Value_Codec<Value>>
using File_B_Map = Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >
 Convenient alias for a persistent B-Tree map.
 
template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using File_B_Tree = Gen_File_B_Tree< Key, Compare, MinDegree, Codec >
 Convenient alias for a page-managed persistent B-Tree.
 
template<typename Key , typename Value , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename KeyCodec = detail::Paged_Value_Codec<Key>, typename ValueCodec = detail::Paged_Value_Codec<Value>>
using File_BPlus_Map = Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >
 Convenient alias for a persistent B+ Tree map.
 
template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using File_BPlus_Tree = Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >
 Convenient alias for a page-managed persistent B+ Tree.
 
template<typename __Graph_Node = Graph_Node<int>, typename __Graph_Arc = Graph_Arc<int>>
using List_Digraph = Digraph< List_Graph< __Graph_Node, __Graph_Arc > >
 Directed graph (digraph) implemented with double-linked adjacency lists.
 
template<class GT >
using ArcPair = std::tuple< typename GT::Arc *, typename GT::Node * >
 Alias used for encapsulating a pair of arc and node (related between them).
 
template<class GT >
using _Out_Iterator = Digraph_Iterator< GT, __Out_Filt< GT > >
 Basic iterator for outcoming arcs of a node.
 
template<class GT >
using _In_Iterator = Digraph_Iterator< GT, __In_Filt< GT > >
 Basic iterator for incoming arcs of a node.
 
template<typename Key , template< typename, class > class HashSetTable = OLhashTable, class Cmp = Aleph::equal_to<Key>>
using DynHashSet = HashSet< Key, HashSetTable, Cmp >
 Alias for HashSet (for consistency with other Dyn containers).
 
template<typename Key , typename Data , template< typename, typename, class > class HashMapTable = MapOLhash, class Cmp = Aleph::equal_to<Key>>
using DynHashMap = HashMap< Key, Data, HashMapTable, Cmp >
 Alias for HashMap (for consistency with other Dyn containers).
 
template<typename Key >
using interval_endpoint_t = typename interval_endpoint< Key >::type
 
template<typename Key >
using LhashBucket = Dnode< Key >
 Bucket without virtual destructor for a hash table with collision resolution by separate chaining.
 
template<typename Key , class Cmp = Aleph::equal_to<Key>>
using LinearHashTable = GenLinearHashTable< Key, LinHashBucket, Cmp >
 Linear hash table with buckets without virtual destructor.
 
template<typename Key , class Cmp = Aleph::equal_to<Key>>
using LinearHashTableVtl = GenLinearHashTable< Key, LinHashBucketVtl, Cmp >
 Linear hash table with virtual destructor in its buckets.
 
using Link_Cut_Tree = Gen_Link_Cut_Tree< int >
 Convenience alias for a connectivity-only Link-Cut Tree.
 
template<typename EdgeT = int, class Monoid = DefaultMonoid<EdgeT>>
using Link_Cut_Tree_WithEdges = Gen_Link_Cut_Tree_WithEdges< int, EdgeT, Monoid >
 Convenience alias for edge-weighted Link-Cut Tree.
 
template<typename T >
using Distinct_Count_Mo = Gen_Mo_Algorithm< T, Distinct_Count_Policy< T > >
 Mo's algorithm specialised for counting distinct elements.
 
template<typename T >
using Powerful_Array_Mo = Gen_Mo_Algorithm< T, Powerful_Array_Policy< T > >
 Mo's algorithm specialised for the "powerful array" query.
 
template<typename T >
using Range_Mode_Mo = Gen_Mo_Algorithm< T, Range_Mode_Policy< T > >
 Mo's algorithm specialised for range mode queries.
 
template<class GT >
using Distinct_Count_Mo_On_Trees = Gen_Mo_On_Trees< GT, Distinct_Count_Policy< typename GT::Node::Node_Type > >
 Mo on Trees specialised for counting distinct node values.
 
template<class GT >
using Powerful_Array_Mo_On_Trees = Gen_Mo_On_Trees< GT, Powerful_Array_Policy< typename GT::Node::Node_Type > >
 Mo on Trees specialised for the "powerful array" query.
 
template<class GT >
using Range_Mode_Mo_On_Trees = Gen_Mo_On_Trees< GT, Range_Mode_Policy< typename GT::Node::Node_Type > >
 Mo on Trees specialised for range mode queries.
 
template<typename T >
using Distinct_Count_Mo_On_Tree_Node = Gen_Mo_On_Tree_Node< T, Distinct_Count_Policy< T > >
 Mo on Tree_Node specialised for counting distinct values.
 
template<typename T >
using Powerful_Array_Mo_On_Tree_Node = Gen_Mo_On_Tree_Node< T, Powerful_Array_Policy< T > >
 Mo on Tree_Node specialised for the "powerful array" query.
 
template<typename T >
using Range_Mode_Mo_On_Tree_Node = Gen_Mo_On_Tree_Node< T, Range_Mode_Policy< T > >
 Mo on Tree_Node specialised for range mode queries.
 
template<typename T >
using mpsc_queue = MpscQueue< T >
 Alias for Aleph::MpscQueue.
 
using MultiPolynomial = Gen_MultiPolynomial< double, Grevlex_Order >
 Multivariate polynomial with double coefficients, grevlex.
 
using MultiPolynomial_Lex = Gen_MultiPolynomial< double, Lex_Order >
 Multivariate polynomial with lex ordering.
 
using MultiPolynomial_Grlex = Gen_MultiPolynomial< double, Grlex_Order >
 Multivariate polynomial with grlex ordering.
 
using IntMultiPolynomial = Gen_MultiPolynomial< long long, Grevlex_Order >
 Multivariate polynomial with integer (long long) coefficients, grevlex.
 
using IntMultiPolynomial_Lex = Gen_MultiPolynomial< long long, Lex_Order >
 Multivariate polynomial with integer (long long) coefficients, lex.
 
template<class Net >
using __Net_Iterator = Digraph_Iterator< Net, Net_Filt< Net > >
 
template<class Net , class Show_Arc = Dft_Show_Arc<Net>>
using Net_Iterator = Filter_Iterator< typename Net::Node *, __Net_Iterator< Net >, Show_Arc >
 Residual-graph iterator adapter for flow networks.
 
template<typename Node_Info = Empty_Class>
using Net_Node = Graph_Anode< Node_Info >
 Node type for flow networks.
 
template<class Net >
using Parc = std::tuple< typename Net::Arc *, bool >
 Arc entry for a semi-path.
 
template<class Net >
using SemiPath = std::tuple< bool, typename Net::Flow_Type, DynList< Parc< Net > > >
 Semi-path tuple:
 
template<class Net >
using Find_Aumenting_Path_DFS = Find_Aumenting_Path< Net, DynListStack >
 Augmenting-path finder using DFS (stack).
 
template<class Net >
using Find_Aumenting_Path_BFS = Find_Aumenting_Path< Net, DynListQueue >
 Augmenting-path finder using BFS (queue).
 
template<class Net >
using AP_Res_Net = Array_Digraph< Net_Node< Empty_Class >, __Res_Arc< Net > >
 Residual network for augmenting-path algorithms.
 
template<class Net >
using PP_Res_Net = Array_Digraph< PP_Res_Node< Net >, __Res_Arc< Net > >
 Residual network for preflow-push algorithms.
 
template<typename Node_Info = Empty_Class>
using Net_Cost_Node = Net_Node< Node_Info >
 Node type alias for cost networks.
 
template<typename Ftype >
using Residual_Net = Net_Cost_Graph< Net_Node< Empty_Class >, Res_Arc< Ftype > >
 Residual network type alias.
 
template<class Net >
using Feasible_Tree = std::tuple< DynList< typename Net::Arc * >, DynList< typename Net::Arc * >, DynList< typename Net::Arc * > >
 Feasible spanning tree classification.
 
template<typename Key , class Cmp = Aleph::equal_to<Key>>
using SetODhash = ODhashTable< Key, Cmp >
 
template<typename Key , class Cmp = Aleph::equal_to<Key>>
using SetOLhash = OLhashTable< Key, Cmp >
 
template<packed_matrix_detail::Column_Array auto Columns>
using Packed_Row_Of = typename packed_matrix_detail::Columns_At< Columns, std::make_index_sequence< Columns.size()> >::Row
 Packed_Row whose columns are the entries of an array.
 
template<packed_matrix_detail::Column_Array auto Columns>
using Packed_Matrix_Of = typename packed_matrix_detail::Columns_At< Columns, std::make_index_sequence< Columns.size()> >::Matrix
 Packed_Matrix whose columns are the entries of an array.
 
using Polynomial = Gen_Polynomial< double >
 Polynomial with double coefficients.
 
using PolynomialF = Gen_Polynomial< float >
 Polynomial with float coefficients.
 
using PolynomialLD = Gen_Polynomial< long double >
 Polynomial with long double coefficients.
 
using IntPolynomial = Gen_Polynomial< long long >
 Polynomial with long long (integer) coefficients.
 
template<typename Payload , size_t MaxEntries = 16, size_t MinEntries = MaxEntries / 2>
using RStarTree = RTree< Payload, MaxEntries, MinEntries, RTreeVariant::RStar >
 Dynamic R*-tree spatial index (R-tree with the R*-tree heuristics).
 
template<typename __Graph_Node = Graph_Snode<int>, typename __Graph_Arc = Graph_Sarc<int>>
using List_SDigraph = Digraph< List_SGraph< __Graph_Node, __Graph_Arc > >
 Directed graph (digraph) implemented with simple adjacency lists.
 
template<typename T , class Compare >
using Compare_Snodenc = Compare_Tnode< Slinknc, Snodenc, T, Compare >
 Comparator specialization for Snodenc objects.
 
template<class GT , class SA = Dft_Show_Arc<GT>>
using Heavy_Light_Decomposition = Gen_Heavy_Light_Decomposition< GT, SA >
 Convenience alias for heavy-light decomposition.
 
template<class GT , typename T = typename GT::Node::Node_Type, class Op = Aleph::plus<T>, class SA = Dft_Show_Arc<GT>>
using HLD_Path_Query = Gen_HLD_Path_Query< GT, T, Op, SA >
 Convenience alias for segment-tree-backed HLD queries.
 
template<class GT , class SA = Dft_Show_Arc<GT>>
using Centroid_Decomposition = Gen_Centroid_Decomposition< GT, SA >
 Convenience alias for centroid decomposition.
 
template<class GT , typename T , class SA = Dft_Show_Arc<GT>>
using Tree_DP = Gen_Tree_DP< GT, T, SA >
 Convenient alias for Gen_Tree_DP.
 
template<class GT , typename T , class SA = Dft_Show_Arc<GT>>
using Reroot_DP = Gen_Reroot_DP< GT, T, SA >
 Convenient alias for Gen_Reroot_DP.
 

Enumerations

enum class  Diagnostic_Severity { Note , Warning , Error , Fatal }
 Severity level of a diagnostic message. More...
 
enum class  Diagnostic_Label_Kind { Primary , Secondary }
 Kind of source label attached to a diagnostic. More...
 
enum  Graph_Bits {
  Depth_First , Breadth_First , Test_Cycle , Find_Path ,
  Euler , Maximum_Flow , Spanning_Tree , Build_Subtree ,
  Convert_Tree , Cut , Min , Num_Bits_Graph
}
 Bit numbers of nodes or arcs. More...
 
enum class  OptimizationSense { Minimize , Maximize }
 Optimization direction supported by branch and bound. More...
 
enum class  Compiler_Bytecode_Constant_Kind {
  Unit , Boolean , Integer , String ,
  Character , Raw_Text
}
 Constant kinds supported by the bytecode constant pool. More...
 
enum class  Compiler_Bytecode_Opcode {
  Load_Constant , Load_Local , Store_Local , Load_Global ,
  Store_Global , Load_Function , Unary , Binary ,
  Call , Jump , Branch , Return ,
  Halt , Trap
}
 VM opcodes supported by the bytecode MVP. More...
 
enum class  Compiler_Bytecode_Value_Kind { Invalid , Value , Function_Ref }
 Runtime categories that can live inside bytecode registers/slots. More...
 
enum class  Compiler_Bytecode_Completion_Kind { Returned , Halted , Runtime_Error }
 Final status produced by one VM execution request. More...
 
enum class  Compiler_Expr_Kind {
  Invalid , Identifier , Integer_Literal , String_Literal ,
  Char_Literal , Bool_Literal , Grouping , Unary ,
  Binary , Call
}
 Enumeration of expression node kinds. More...
 
enum class  Compiler_Stmt_Kind {
  Invalid , Expr , Let , Return ,
  Block , If , While , Break ,
  Continue
}
 Enumeration of statement node kinds. More...
 
enum class  Compiler_Type_Expr_Kind { Invalid , Named , Tuple , Function }
 Enumeration of parsed type-expression node kinds. More...
 
enum class  Compiler_Type_Decl_Kind { Invalid , Alias , Struct , Enum }
 Enumeration of top-level type declaration node kinds. More...
 
enum class  Compiler_Import_Decl_Kind { Invalid , Import }
 Enumeration of top-level import declaration node kinds. More...
 
enum class  Compiler_CFG_Terminator_Kind {
  None , Jump , Branch , Return ,
  Exit , Unreachable
}
 Categories of basic block terminators. More...
 
enum class  Compiler_Dataflow_Constant_Kind {
  Unknown , Undefined , Integer , Boolean ,
  Unit
}
 Constant-lattice states used by local constant propagation. More...
 
enum class  Compiler_Driver_Action {
  Parse_Only , Sema_Only , HIR , IR ,
  Run , Emit_C , Emit_Bytecode
}
 High-level actions supported by compiler pipeline drivers. More...
 
enum class  Compiler_HIR_Expr_Kind {
  Invalid , Constant , Variable , Unary ,
  Binary , Call
}
 Kinds of HIR expressions. More...
 
enum class  Compiler_HIR_Stmt_Kind {
  Invalid , Eval , Let , Return ,
  Block , If , While , Break ,
  Continue
}
 Kinds of HIR statements. More...
 
enum class  Compiler_HIR_Constant_Kind {
  Integer , String , Character , Bool ,
  Unit
}
 Kinds of HIR constants. More...
 
enum class  Compiler_IR_Slot_Kind { Parameter , Local , Global }
 Storage-space classification for slots. More...
 
enum class  Compiler_IR_Instruction_Kind {
  Constant , Load , Store , Unary ,
  Binary , Call , Function_Ref
}
 Instruction kinds supported by the MVP IR. More...
 
enum class  Compiler_IR_Terminator_Kind {
  None , Jump , Branch , Return ,
  Exit , Unreachable
}
 Terminator kinds supported by the MVP IR. More...
 
enum class  Compiler_Module_Binding_Issue_Kind { Missing_Metadata , Ambiguous_Value_Name , Ambiguous_Type_Name }
 Structural issues emitted while binding linked module surfaces. More...
 
enum class  Compiler_Module_Linkage_Issue_Kind { Missing_Metadata , Duplicate_Value_Export , Duplicate_Type_Export }
 Structural issues emitted while linking module surfaces. More...
 
enum class  Compiler_Module_Export_Kind { Function , Global , Type }
 Export kinds currently modeled by reusable module metadata. More...
 
enum class  Compiler_Module_Name_Filter {
  Any , Value , Function , Global ,
  Type
}
 Query filters supported by reusable module-name resolution. More...
 
enum class  Compiler_Module_Name_Resolution_Status {
  Resolved , Missing_Module , Missing_Name , Wrong_Kind ,
  Ambiguous_Name
}
 Result status for one module-name query. More...
 
enum class  Compiler_Module_Resolution_Issue_Kind { Missing_Dependency , Cyclic_Dependency }
 Structural issue kinds produced by module dependency resolution. More...
 
enum class  Compiler_Operator_Kind {
  Invalid , Assign , Plus , Minus ,
  Star , Slash , Percent , EqEq ,
  NotEq , Less , LessEq , Greater ,
  GreaterEq , AndAnd , OrOr , Bang ,
  Amp , Pipe , Caret , Tilde ,
  PlusEq , MinusEq , StarEq , SlashEq ,
  PercentEq , PlusPlus , MinusMinus
}
 Stable operator kinds shared by reusable compiler layers. More...
 
enum class  Compiler_Integer_Status { Ok , Overflow , Division_By_Zero , Modulo_By_Zero }
 Outcome of one integer operation of the language. More...
 
enum class  Compiler_Symbol_Kind {
  Function , Parameter , Local , Global ,
  Type
}
 Generic symbol kinds reusable across multiple frontends. More...
 
enum class  Compiler_Symbol_Declare_Status { Inserted , Duplicate_Local , Inserted_Shadowing }
 Result status for one declaration attempt. More...
 
enum class  Compiler_Associativity { None , Left , Right }
 Associativity metadata for binary operators. More...
 
enum class  Compiler_Token_Kind {
  Invalid , End_Of_File , Identifier , Integer_Literal ,
  String_Literal , Char_Literal , Line_Comment , Block_Comment ,
  Kw_If , Kw_Else , Kw_While , Kw_For ,
  Kw_Return , Kw_Break , Kw_Continue , Kw_Func ,
  Kw_Fn = Kw_Func , Kw_Var , Kw_Let , Kw_Const ,
  Kw_Type , Kw_Struct , Kw_Enum , Kw_Class ,
  Kw_Import , Kw_Export , Kw_Namespace , Kw_Try ,
  Kw_Catch , Kw_Throw , Kw_True , Kw_False ,
  LParen , RParen , LBrace , RBrace ,
  LBracket , RBracket , Comma , Semicolon ,
  Colon , Dot , Arrow , Double_Colon ,
  Question , Assign , Plus , Minus ,
  Star , Slash , Percent , EqEq ,
  NotEq , Less , LessEq , Greater ,
  GreaterEq , AndAnd , OrOr , Bang ,
  Amp , Pipe , Caret , Tilde ,
  PlusEq , MinusEq , StarEq , SlashEq ,
  PercentEq , PlusPlus , MinusMinus
}
 Token kinds supported by the compiler MVP. More...
 
enum class  Compiler_Type_Kind {
  Builtin , Tuple , Function , Struct ,
  Enum , Type_Variable
}
 Category of one stored type node. More...
 
enum class  Compiler_Builtin_Type {
  Invalid , Unit , Bool , Integer ,
  String , Character
}
 Built-in scalar types available in the MVP type graph. More...
 
enum class  Eulerian_Type { Cycle , Path , None }
 Enumeration for Eulerian graph classification. More...
 
enum class  Howard_Fallback_Reason { Howard_Fallback_Reason::None , Howard_Fallback_Reason::Iteration_Limit , Howard_Fallback_Reason::Arithmetic_Overflow , Howard_Fallback_Reason::Cost_Out_Of_Range }
 Why howard_minimum_mean_cycle() handed the problem over to Karp's algorithm (see the documentation of Howard_Min_Mean_Cycle.H). More...
 
enum class  Interpreter_Value_Kind {
  Invalid , Unit , Bool , Integer ,
  String , Character , Tuple , Function ,
  Host_Function
}
 Runtime categories supported by the interpreter MVP. More...
 
enum class  Interpreter_Control_Flow_Kind {
  None , Return , Break , Continue ,
  Runtime_Error
}
 Structured control-flow outcomes during evaluation. More...
 
enum class  AdversarialTraceEventKind {
  Enter_Node , Exit_Node , Terminal_Node , Depth_Cutoff ,
  Domain_Prune , Expansion_Limit , Alpha_Beta_Cutoff , Transposition_Hit ,
  Iteration_Begin , Iteration_End , Aspiration_Retry
}
 Trace event kinds emitted by adversarial search engines. More...
 
enum class  Negative_Cycle_Exclusion { Negative_Cycle_Exclusion::Min_Weight_Arc , Negative_Cycle_Exclusion::All_Arcs }
 Which arcs of a found negative cycle are excluded before searching for the next one in find_disjoint_negative_cycles(). More...
 
enum class  Cycle_Numeric_Quality { Cycle_Numeric_Quality::Exact , Cycle_Numeric_Quality::Rounded }
 How far the numbers behind the result of a cycle search can be trusted. More...
 
enum class  TokenType {
  END_OF_FILE , IDENTIFIER , INTEGER , FLOAT ,
  STRING , CHAR , OPERATOR , PUNCTUATION ,
  KEYWORD , COMMENT , UNKNOWN
}
 Enumeration of basic token types. More...
 
enum class  Planarity_Certificate_Type { Planarity_Certificate_Type::None , Planarity_Certificate_Type::K5_Subdivision , Planarity_Certificate_Type::K33_Subdivision , Planarity_Certificate_Type::Minimal_NonPlanar_Obstruction }
 Non-planarity witness classification. More...
 
enum class  Orientation { CCW , CW , COLLINEAR }
 Classification of three-point orientation. More...
 
enum class  InCircleResult { INSIDE , ON_CIRCLE , OUTSIDE , DEGENERATE }
 Classification of a point with respect to a triangle circumcircle. More...
 
enum class  MoveOrderingMode { Domain , Estimated_Score , Estimated_Bound }
 Built-in move-ordering modes supported by the framework. More...
 
enum class  ConstraintType { LE , GE , EQ }
 Constraint type for linear programming. More...
 
enum class  OptimizationType { Maximize , Minimize }
 Optimization direction for linear programming. More...
 
enum class  Compiler_SSA_Instruction_Kind {
  Constant , Load_Global , Store_Global , Unary ,
  Binary , Call , Function_Ref
}
 Instruction kinds supported by the SSA form. More...
 
enum class  SearchStatus { NotStarted , Exhausted , StoppedOnSolution , LimitReached }
 Final state of a search execution. More...
 
enum  ThreeWayCmp : int { CmpLess = -1 , CmpEqual = 0 , CmpGreater = 1 }
 Constants for three-way comparison results. More...
 
enum  Bipartite_Color { Bp_White , Bp_Red , Bp_Blue }
 
enum class  Compiler_Unify_Result_Kind {
  Success , Invalid_Type , Kind_Mismatch , Arity_Mismatch ,
  Occurs_Check_Failed , Rigid_Variable
}
 Result category returned by type unification. More...
 
enum class  Simplex_Arc_State : unsigned char { Lower , Upper , Tree }
 Arc state in Network Simplex. More...
 
enum class  Paged_File_Open_Mode : std::uint8_t { Read_Write , Read_Only }
 Open mode for paged persistent tree files. More...
 
enum class  RTreeVariant { Guttman , RStar }
 Node-split / insertion strategy for RTree. More...
 
enum class  TranspositionBound { Exact , Lower_Bound , Upper_Bound }
 Stored bound classification for memoized search entries. More...
 
enum class  TranspositionStoreStatus { Inserted , Replaced , Rejected }
 Outcome of one store/update attempt in a transposition table. More...
 

Functions

template<class T , typename... Args>
T * allocate (AhArenaAllocator &arena, Args &&... args)
 Allocate and construct an object in an arena.
 
template<class T >
void deallocate (AhArenaAllocator &arena, T *ptr) noexcept
 Destruct and deallocate an object from an arena.
 
template<class T >
void dealloc (AhArenaAllocator &arena, T *ptr) noexcept
 Alias for deallocate (backward compatibility).
 
double duration_to_seconds (const std::chrono::duration< double > &d)
 
double duration_to_milliseconds (const std::chrono::duration< double > &d)
 
double duration_to_microseconds (const std::chrono::duration< double > &d)
 
double duration_to_nanoseconds (const std::chrono::duration< double > &d)
 
double duration_to_minutes (const std::chrono::duration< double > &d)
 
double duration_to_hours (const std::chrono::duration< double > &d)
 
double duration_to_days (const std::chrono::duration< double > &d)
 
template<typename T , class Compare = Aleph::less<T>>
Aleph::Generator< Array< T > > lazy_permutations (Array< T > a, Compare cmp=Compare())
 Lazily enumerate all permutations of a, in lexicographic order.
 
template<typename T >
Aleph::Generator< Array< T > > lazy_combinations (Array< T > a, size_t k)
 Lazily enumerate all k-element combinations of a's elements.
 
template<typename T >
DynList< DynList< T > > transpose (const DynList< DynList< T > > &l)
 *‍/
 
template<template< typename > class C, typename T >
void in_place_transpose (C< C< T > > &l)
 In-place transpose of a rectangular matrix stored as a nested container.
 
template<typename T >
void in_place_transpose (DynList< DynList< T > > &l)
 In-place transpose of a matrix stored as DynList<DynList<T>>.
 
template<typename T , class Op >
bool traverse_perm (const DynList< DynList< T > > &l, Op &op)
 *‍/
 
template<typename T , class Op >
bool traverse_perm (const DynList< DynList< T > > &l, Op &&op)
 Convenience overload accepting an rvalue callable.
 
template<typename T , class Op >
void for_each_perm (const DynList< DynList< T > > &l, Op &op)
 Apply a procedure to every permutation produced by traverse_perm.
 
template<typename T , class Op >
void for_each_perm (const DynList< DynList< T > > &l, Op &&op)
 Convenience overload accepting an rvalue callable.
 
template<typename T >
DynList< DynList< T > > build_perms (const DynList< DynList< T > > &l)
 Materialize all permutations from a list of lists.
 
template<typename T >
DynList< DynList< T > > build_combs (const DynList< DynList< T > > &l)
 Build the set of unique combinations from a list of lists.
 
template<typename T , typename Tc , class Op = Dft_Fold_Op<Tc, T>>
T fold_perm (const T &init, const DynList< DynList< Tc > > &l, Op &op)
 Left-fold over all permutations.
 
template<typename T , typename Tc , class Op = Dft_Fold_Op<Tc, T>>
T fold_perm (const T &init, const DynList< DynList< Tc > > &l, Op &&op)
 Convenience overload accepting an rvalue callable.
 
template<typename T >
size_t perm_count (const DynList< DynList< T > > &l)
 Count the total number of permutations from a list of lists.
 
template<typename T , class Pred >
bool exists_perm (const DynList< DynList< T > > &l, Pred &pred)
 Check if any permutation satisfies a predicate.
 
template<typename T , class Pred >
bool exists_perm (const DynList< DynList< T > > &l, Pred &&pred)
 Convenience overload accepting an rvalue callable.
 
template<typename T , class Pred >
bool all_perm (const DynList< DynList< T > > &l, Pred &pred)
 Check if all permutations satisfy a predicate.
 
template<typename T , class Pred >
bool all_perm (const DynList< DynList< T > > &l, Pred &&pred)
 Convenience overload accepting an rvalue callable.
 
template<typename T , class Pred >
bool none_perm (const DynList< DynList< T > > &l, Pred &pred)
 Check if no permutation satisfies a predicate.
 
template<typename T , class Pred >
bool none_perm (const DynList< DynList< T > > &l, Pred &&pred)
 Convenience overload accepting an rvalue callable.
 
template<typename T , class Pred >
DynList< DynList< T > > filter_perm (const DynList< DynList< T > > &l, Pred &pred)
 Filter permutations that satisfy a predicate.
 
template<typename T , class Pred >
DynList< DynList< T > > filter_perm (const DynList< DynList< T > > &l, Pred &&pred)
 Convenience overload accepting an rvalue callable.
 
template<typename R , typename T , class Op >
DynList< R > map_perm (const DynList< DynList< T > > &l, Op &op)
 Transform each permutation via a mapping operation.
 
template<typename R , typename T , class Op >
DynList< R > map_perm (const DynList< DynList< T > > &l, Op &&op)
 Convenience overload accepting an rvalue callable.
 
template<typename T , class Compare = Aleph::less<T>>
bool next_permutation (Array< T > &a, Compare cmp=Compare(), const bool reset_on_last=true)
 Compute the next lexicographic permutation of an Array.
 
template<typename T , class Compare = Aleph::less<T>>
bool next_permutation (DynArray< T > &a, Compare cmp=Compare(), const bool reset_on_last=true)
 Overload of next_permutation for DynArray.
 
size_t combination_count (size_t n, size_t k)
 Compute n choose k with overflow checks.
 
bool next_combination_indices (Array< size_t > &idx, const size_t n, const bool reset_on_last=true)
 Advance an index-combination [i0 < i1 < ... < i(k-1)] to the next one.
 
bool next_combination_indices (DynArray< size_t > &idx, const size_t n, const bool reset_on_last=true)
 Overload of next_combination_indices for DynArray<size_t>.
 
uint64_t first_combination_mask (const size_t k)
 Build the first k-of-64 combination mask (k low bits set).
 
bool next_combination_mask (uint64_t &mask, const size_t n, const bool reset_on_last=true)
 Advance a fixed-popcount bitmask to the next combination (Gosper hack).
 
template<typename T , class Op >
bool for_each_combination (const Array< T > &values, const size_t k, Op &&op)
 *‍/
 
template<typename T , class Op >
bool for_each_combination (const DynArray< T > &values, const size_t k, Op &&op)
 Overload of for_each_combination for DynArray<T>.
 
template<typename T >
Array< Array< T > > build_combinations (const Array< T > &values, const size_t k)
 Materialize all k-combinations of Array<T>.
 
template<typename T >
Array< Array< T > > build_combinations (const DynArray< T > &values, const size_t k)
 Overload of build_combinations for DynArray<T>.
 
template<std::unsigned_integral T>
constexpr T bin_to_gray (const T n) noexcept
 Convert a binary number to its Gray code representation.
 
template<std::unsigned_integral T>
constexpr T gray_to_bin (T g) noexcept
 Convert a Gray code number to its binary representation.
 
Array< uint32_t > build_gray_code (const size_t n)
 Generate the sequence of n-bit Gray codes.
 
template<class C >
std::vector< typename C::Item_Type > to_vector (const C &c)
 Convert a container to a std::vector.
 
template<class T >
DynList< T > vector_to_DynList (const std::vector< T > &v)
 Convert a std::vector to a DynList.
 
template<class T >
DynArray< T > vector_to_DynArray (const std::vector< T > &v)
 Convert a std::vector to a DynArray.
 
template<class T >
DynList< T > to_DynList (const Array< T > &a)
 Convert an Array to a DynList.
 
template<class C >
requires AlephArrayConvertible<C>
Array< typename C::Item_Type > to_Array (const C &c)
 Convert a container to an Array.
 
template<class C >
Array< typename C::Item_Type > to_array (const C &c)
 Convenience wrapper identical to to_Array (copy contents).
 
template<class T >
DynList< T > dynarray_to_DynList (const DynArray< T > &a)
 Convert a DynArray to a DynList.
 
template<class T >
DynArray< T > dynlist_to_DynArray (const DynList< T > &l)
 Convert a DynList to a DynArray.
 
template<class T >
Array< T > vector_to_Array (const std::vector< T > &v)
 Convert a std::vector to an Array.
 
template<class C >
DynArray< typename C::Item_Type > to_DynArray (const C &c)
 Convert a container to a DynArray.
 
template<class T >
DynArray< T > array_to_DynArray (const Array< T > &a)
 Convert an Array to a DynArray.
 
template<class T >
Array< T > dynarray_to_Array (const DynArray< T > &a)
 Convert a DynArray to an Array.
 
template<class C >
std::deque< typename C::Item_Type > to_deque (const C &c)
 Convert a container to a std::deque.
 
template<class T >
DynList< T > deque_to_DynList (const std::deque< T > &d)
 Convert a std::deque to a DynList.
 
template<class T >
Array< T > deque_to_Array (const std::deque< T > &d)
 Convert a std::deque to an Array.
 
template<class T >
DynArray< T > deque_to_DynArray (const std::deque< T > &d)
 Convert a std::deque to a DynArray.
 
template<class T >
DynList< T > dyndlist_to_DynList (const DynDlist< T > &l)
 Convert a DynDlist to a DynList.
 
template<class T >
DynDlist< T > dynlist_to_DynDlist (const DynList< T > &l)
 Convert a DynList to a DynDlist.
 
template<class T >
DynArray< T > dyndlist_to_DynArray (const DynDlist< T > &l)
 Convert a DynDlist to a DynArray.
 
template<class T >
DynDlist< T > dynarray_to_DynDlist (const DynArray< T > &a)
 Convert a DynArray to a DynDlist.
 
template<class T >
DynDlist< T > vector_to_DynDlist (const std::vector< T > &v)
 Convert a std::vector to a DynDlist.
 
template<class T >
DynList< T > vector_to_DynList (std::vector< T > &&v)
 Convert a std::vector to a DynList using move semantics.
 
template<class T >
Array< T > vector_to_Array (std::vector< T > &&v)
 Convert a std::vector to an Array using move semantics.
 
template<class T >
DynArray< T > vector_to_DynArray (std::vector< T > &&v)
 Convert a std::vector to a DynArray using move semantics.
 
template<class T >
DynDlist< T > vector_to_DynDlist (std::vector< T > &&v)
 Convert a std::vector to a DynDlist using move semantics.
 
template<class T , class Compare , class Alloc >
DynList< T > set_to_DynList (const std::set< T, Compare, Alloc > &s)
 Convert a std::set to a DynList.
 
template<class T , class Compare , class Alloc >
Array< T > set_to_Array (const std::set< T, Compare, Alloc > &s)
 Convert a std::set to an Array.
 
template<class T , class Compare , class Alloc >
DynArray< T > set_to_DynArray (const std::set< T, Compare, Alloc > &s)
 Convert a std::set to a DynArray.
 
template<class C >
std::set< typename C::Item_Type > to_set (const C &c)
 Convert a container to a std::set.
 
template<class K , class V , class Compare , class Alloc >
DynList< std::pair< K, V > > map_to_DynList (const std::map< K, V, Compare, Alloc > &m)
 Convert a std::map to a DynList of pairs.
 
template<class K , class V , class Compare , class Alloc >
Array< std::pair< K, V > > map_to_Array (const std::map< K, V, Compare, Alloc > &m)
 Convert a std::map to an Array of pairs.
 
template<class K , class V , class Compare , class Alloc >
DynList< K > map_keys_to_DynList (const std::map< K, V, Compare, Alloc > &m)
 Extract keys from a std::map to a DynList.
 
template<class K , class V , class Compare , class Alloc >
DynList< V > map_values_to_DynList (const std::map< K, V, Compare, Alloc > &m)
 Extract values from a std::map to a DynList.
 
template<class T >
DynList< T > init_to_DynList (std::initializer_list< T > il)
 Convert an initializer_list to a DynList.
 
template<class T >
Array< T > init_to_Array (std::initializer_list< T > il)
 Convert an initializer_list to an Array.
 
template<class T >
DynArray< T > init_to_DynArray (std::initializer_list< T > il)
 Convert an initializer_list to a DynArray.
 
template<class T >
DynDlist< T > init_to_DynDlist (std::initializer_list< T > il)
 Convert an initializer_list to a DynDlist.
 
template<typename Key , template< typename, class > class Tree, class Compare >
DynList< Key > settree_to_DynList (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a DynList.
 
template<typename Key , template< typename, class > class Tree, class Compare >
Array< Key > settree_to_Array (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to an Array.
 
template<typename Key , template< typename, class > class Tree, class Compare >
DynArray< Key > settree_to_DynArray (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a DynArray.
 
template<typename Key , template< typename, class > class Tree, class Compare >
std::vector< Key > settree_to_vector (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a std::vector.
 
template<typename Key , template< typename, class > class Tree, class Compare >
std::set< Key > settree_to_stdset (const DynSetTree< Key, Tree, Compare > &s)
 Convert a DynSetTree to a std::set.
 
template<class C >
DynSetTree< typename C::Item_Type > to_DynSetTree (const C &c)
 Convert a container to a DynSetTree (AVL by default).
 
template<class T >
DynSetTree< T > vector_to_DynSetTree (const std::vector< T > &v)
 Convert a std::vector to a DynSetTree.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
DynList< Key > sethash_to_DynList (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to a DynList.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
Array< Key > sethash_to_Array (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to an Array.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
DynArray< Key > sethash_to_DynArray (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to a DynArray.
 
template<typename Key , template< typename, class > class HashTable, class Cmp >
std::vector< Key > sethash_to_vector (const DynHashTable< Key, HashTable, Cmp > &s)
 Convert a DynHashTable (hash set) to a std::vector.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< std::pair< Key, Data > > maptree_to_DynList (const DynMapTree< Key, Data, Tree, Compare > &m)
 Convert a DynMapTree to a DynList of pairs.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
Array< std::pair< Key, Data > > maptree_to_Array (const DynMapTree< Key, Data, Tree, Compare > &m)
 Convert a DynMapTree to an Array of pairs.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
std::map< Key, Data > maptree_to_stdmap (const DynMapTree< Key, Data, Tree, Compare > &m)
 Convert a DynMapTree to a std::map.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< Key > maptree_keys_to_DynList (const DynMapTree< Key, Data, Tree, Compare > &m)
 Extract keys from a DynMapTree to a DynList.
 
template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< Data > maptree_values_to_DynList (const DynMapTree< Key, Data, Tree, Compare > &m)
 Extract values from a DynMapTree to a DynList.
 
template<class K , class V , class Compare , class Alloc >
DynMapTree< K, V > stdmap_to_DynMapTree (const std::map< K, V, Compare, Alloc > &m)
 Convert a std::map to a DynMapTree.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< std::pair< Key, Data > > maphash_to_DynList (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Convert a MapOpenHash to a DynList of pairs.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
Array< std::pair< Key, Data > > maphash_to_Array (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Convert a MapOpenHash to an Array of pairs.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
std::map< Key, Data > maphash_to_stdmap (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Convert a MapOpenHash to a std::map.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< Key > maphash_keys_to_DynList (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Extract keys from a MapOpenHash to a DynList.
 
template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< Data > maphash_values_to_DynList (const MapOpenHash< Key, Data, Cmp, HashTable > &m)
 Extract values from a MapOpenHash to a DynList.
 
template<class E >
 unexpected (E) -> unexpected< E >
 
bool is_leap_year (const size_t yy) noexcept
 Return true if the provided year is a leap year.
 
bool valid_month (const size_t mm) noexcept
 Check whether the month number is within the [1, 12] range.
 
bool valid_day (const size_t yy, const size_t mm, const size_t dd) noexcept
 Check whether a given day exists for the supplied month/year.
 
time_t to_time_t (const size_t dd, const size_t mm, const size_t yy)
 Convert a (day, month, year) triple to a POSIX time_t value.
 
time_t to_time_t (const std::string &s, const std::string &format)
 Convert a formatted string to time_t using the provided format.
 
time_t to_time_t (const std::string &s)
 Convenience overload for ISO strings (YYYY-MM-DD HH:MM:SS).
 
size_t to_days (const time_t t)
 Return the number of whole days represented by t.
 
std::string to_string (const time_t t, const std::string &format)
 Format a time_t value into a string using format.
 
template<class C >
requires (not std::is_const_v<C>)
auto iterator_for (C &c)
 Iterator on c positioned on its first item: the container's own iterator on a modifiable container.
 
template<class C >
auto iterator_for (const C &c)
 Iterator on c positioned on its first item: the read-only view on a constant container.
 
template<typename... Args>
std::string build_string (Args &&... args)
 Concatenate arbitrary streamable arguments into a string.
 
template<typename... Args>
std::string build_error_msg (Args &&... args)
 Alias kept for backwards compatibility with historic API.
 
template<typename ResultT = void, typename Container , typename Op >
auto pmaps (ThreadPool &pool, const Container &c, Op op, size_t chunk_size=0)
 Parallel map operation.
 
template<typename ResultT = void, typename Container , typename Op >
auto pmaps (const Container &c, Op op, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
auto pfilter (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel filter operation.
 
template<typename Container , typename Pred >
auto pfilter (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename T , typename Container , typename BinaryOp >
T pfoldl (ThreadPool &pool, const Container &c, T init, BinaryOp op, size_t chunk_size=0)
 Parallel left fold (reduce).
 
template<typename T , typename Container , typename BinaryOp >
T pfoldl (const Container &c, T init, BinaryOp op, const ParallelOptions &options={})
 
template<typename Container , typename Op >
void pfor_each (ThreadPool &pool, Container &c, Op op, size_t chunk_size=0)
 Parallel for_each operation.
 
template<typename Container , typename Op >
void pfor_each (Container &c, Op op, const ParallelOptions &options={})
 
template<typename Container , typename Op >
void pfor_each (ThreadPool &pool, const Container &c, Op op, size_t chunk_size=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Parallel for_each for const containers.
 
template<typename Container , typename Op >
void pfor_each (const Container &c, Op op, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
bool pall (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel all predicate (short-circuit).
 
template<typename Container , typename Pred >
bool pall (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
bool pexists (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel exists predicate (short-circuit).
 
template<typename Container , typename Pred >
bool pexists (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
bool pnone (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel none predicate.
 
template<typename Container , typename Pred >
bool pnone (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
size_t pcount_if (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel count_if operation.
 
template<typename Container , typename Pred >
size_t pcount_if (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
std::optional< size_t > pfind (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel find operation (returns index).
 
template<typename Container , typename Pred >
std::optional< size_t > pfind (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
auto pfind_value (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel find with value return.
 
template<typename Container , typename Pred >
auto pfind_value (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T psum (ThreadPool &pool, const Container &c, T init=T{}, size_t chunk_size=0)
 Parallel sum of elements.
 
template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T psum (const Container &c, T init, const ParallelOptions &options)
 
template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T pproduct (ThreadPool &pool, const Container &c, T init=T{1}, size_t chunk_size=0)
 Parallel product of elements.
 
template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T pproduct (const Container &c, T init, const ParallelOptions &options)
 
template<typename Container >
auto pmin (ThreadPool &pool, const Container &c, size_t chunk_size=0)
 Parallel minimum element.
 
template<typename Container >
auto pmin (const Container &c, const ParallelOptions &options={})
 
template<typename Container >
auto pmax (ThreadPool &pool, const Container &c, size_t chunk_size=0)
 Parallel maximum element.
 
template<typename Container >
auto pmax (const Container &c, const ParallelOptions &options={})
 
template<typename Container >
auto pminmax (ThreadPool &pool, const Container &c, size_t chunk_size=0)
 Parallel min and max elements.
 
template<typename Container , typename Compare = std::less<>>
void psort (ThreadPool &pool, Container &c, Compare cmp=Compare{}, const size_t min_parallel_size=1024)
 Parallel sort (in-place).
 
template<typename Container , typename Compare = std::less<>>
void psort (Container &c, Compare cmp=Compare{}, const ParallelOptions &options={})
 
template<typename Container1 , typename Container2 , typename Op >
void pzip_for_each (ThreadPool &pool, const Container1 &c1, const Container2 &c2, Op op, size_t chunk_size=0)
 Parallel zip + for_each.
 
template<typename Container1 , typename Container2 , typename Op >
void pzip_for_each (const Container1 &c1, const Container2 &c2, Op op, const ParallelOptions &options={})
 
template<typename Container1 , typename Container2 , typename Op >
auto pzip_maps (ThreadPool &pool, const Container1 &c1, const Container2 &c2, Op op, size_t chunk_size=0)
 Parallel zip + map.
 
template<typename Container1 , typename Container2 , typename Op >
auto pzip_maps (const Container1 &c1, const Container2 &c2, Op op, const ParallelOptions &options={})
 
template<typename Container1 , typename Container2 , typename T , typename Op >
T pzip_foldl (ThreadPool &pool, const Container1 &c1, const Container2 &c2, T init, Op op, size_t chunk_size=0)
 Parallel zip + fold.
 
template<typename Container1 , typename Container2 , typename T , typename Op >
T pzip_foldl (const Container1 &c1, const Container2 &c2, T init, Op op, const ParallelOptions &options={})
 
template<typename Container , typename Pred >
auto ppartition (ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
 Parallel partition (stable).
 
template<typename Container , typename Pred >
auto ppartition (const Container &c, Pred pred, const ParallelOptions &options={})
 
template<typename Container , typename BinaryOp >
auto pscan (ThreadPool &pool, const Container &c, BinaryOp op, size_t chunk_size=0)
 Parallel inclusive scan over a container.
 
template<typename Container , typename BinaryOp >
auto pscan (const Container &c, BinaryOp op, const ParallelOptions &options={})
 Parallel inclusive scan over a container with explicit options.
 
template<typename Container , typename T , typename BinaryOp >
auto pexclusive_scan (ThreadPool &pool, const Container &c, T init, BinaryOp op, size_t chunk_size=0)
 Parallel exclusive scan over a container.
 
template<typename Container , typename T , typename BinaryOp >
auto pexclusive_scan (const Container &c, T init, BinaryOp op, const ParallelOptions &options={})
 Parallel exclusive scan over a container with explicit options.
 
template<typename Container1 , typename Container2 , typename Compare = std::less<>>
auto pmerge (ThreadPool &pool, const Container1 &c1, const Container2 &c2, Compare comp=Compare{}, size_t chunk_size=0)
 Parallel merge of two sorted containers.
 
template<typename Container1 , typename Container2 , typename Compare = std::less<>>
auto pmerge (const Container1 &c1, const Container2 &c2, Compare comp=Compare{}, const ParallelOptions &options={})
 Parallel merge of two sorted containers with explicit options.
 
template<typename Op , typename... Containers>
void pzip_for_each_n (ThreadPool &pool, Op op, const Containers &... cs)
 Parallel for_each over N zipped containers (variadic).
 
template<typename Op , typename... Containers>
void pzip_for_each_n (Op op, const ParallelOptions &options, const Containers &... cs)
 
template<typename Op , typename... Containers>
auto pzip_maps_n (ThreadPool &pool, Op op, const Containers &... cs)
 Parallel map over N zipped containers (variadic).
 
template<typename Op , typename... Containers>
auto pzip_maps_n (Op op, const ParallelOptions &options, const Containers &... cs)
 
template<typename T , typename Op , typename Combiner , typename... Containers>
T pzip_foldl_n (ThreadPool &pool, T init, Op op, Combiner combiner, const Containers &... cs)
 Parallel fold/reduce over N zipped containers (variadic).
 
template<typename T , typename Op , typename Combiner , typename... Containers>
T pzip_foldl_n (T init, Op op, Combiner combiner, const ParallelOptions &options, const Containers &... cs)
 
template<typename Pred , typename... Containers>
bool pzip_all_n (ThreadPool &pool, Pred pred, const Containers &... cs)
 Parallel all predicate over N zipped containers (variadic).
 
template<typename Pred , typename... Containers>
bool pzip_all_n (Pred pred, const ParallelOptions &options, const Containers &... cs)
 
template<typename Pred , typename... Containers>
bool pzip_exists_n (ThreadPool &pool, Pred pred, const Containers &... cs)
 Parallel exists predicate over N zipped containers (variadic).
 
template<typename Pred , typename... Containers>
bool pzip_exists_n (Pred pred, const ParallelOptions &options, const Containers &... cs)
 
template<typename Pred , typename... Containers>
size_t pzip_count_if_n (ThreadPool &pool, Pred pred, const Containers &... cs)
 Parallel count over N zipped containers (variadic).
 
template<typename Pred , typename... Containers>
size_t pzip_count_if_n (Pred pred, const ParallelOptions &options, const Containers &... cs)
 
template<typename Container , typename Op >
void penumerate_for_each (ThreadPool &pool, Container &c, Op op, size_t chunk_size=0)
 Parallel for_each with index (enumerate).
 
template<typename Container , typename Op >
void penumerate_for_each (Container &c, Op op, const ParallelOptions &options={})
 
template<typename Container , typename Op >
void penumerate_for_each (ThreadPool &pool, const Container &c, Op op, size_t chunk_size=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Parallel enumerate_for_each for const containers.
 
template<typename Container , typename Op >
void penumerate_for_each (const Container &c, Op op, const ParallelOptions &options={})
 
template<typename Container , typename Op >
auto penumerate_maps (ThreadPool &pool, const Container &c, Op op, size_t chunk_size=0)
 Parallel enumerate with map.
 
template<typename Container , typename Op >
auto penumerate_maps (const Container &c, Op op, const ParallelOptions &options={})
 
ThreadPool & parallel_default_pool ()
 Global default pool for parallel operations.
 
template<typename Range , typename Cmp >
void sort_range (Range &r, Cmp cmp)
 Sort a whole range in place, portably across the ranges divide.
 
template<typename Range >
void sort_range (Range &r)
 Sort a whole range in place using the default < ordering.
 
template<typename T = int>
std::vector< T > stl_range (T start, T end, T step=1)
 Generate a range of values [start, end] with given step.
 
template<typename T = int>
std::vector< T > stl_range (T n)
 Generate a range [0, n-1].
 
template<typename T = double>
std::vector< T > stl_linspace (T start, T end, size_t n)
 Generate n evenly spaced values between start and end.
 
template<typename T >
std::vector< T > stl_rep (size_t n, const T &value)
 Generate a vector of n repeated values.
 
template<typename Gen >
auto stl_generate (size_t n, Gen &&gen)
 Generate a vector using a generator function.
 
template<typename Op , typename Container >
void stl_for_each (Op &&op, const Container &c)
 Apply operation to each element (for_each).
 
template<typename Op , typename Container >
void stl_for_each_indexed (Op &&op, const Container &c)
 Apply operation to each element with index.
 
template<typename Op , typename Container >
auto stl_map (Op &&op, const Container &c)
 Map operation - transform each element.
 
template<typename Op , typename Container >
auto stl_mapi (Op &&op, const Container &c)
 Map with index (mapi in ML).
 
template<typename Pred , typename Container >
auto stl_filter (Pred &&pred, const Container &c)
 Filter elements satisfying predicate.
 
template<typename Pred , typename Container >
auto stl_filteri (Pred &&pred, const Container &c)
 Filter with index (filteri in ML).
 
template<typename T , typename Op , typename Container >
T stl_foldl (T init, Op &&op, const Container &c)
 Left fold (foldl) - reduce from left to right.
 
template<typename T , typename Op , typename Container >
T stl_foldr (T init, Op &&op, const Container &c)
 Right fold (foldr) - reduce from right to left.
 
template<typename T , typename Op , typename Container >
std::vector< T > stl_scan_left (T init, Op &&op, const Container &c)
 Scan left - fold with all intermediate results.
 
template<typename T , typename Op , typename Container >
std::vector< T > stl_scan_right (T init, Op &&op, const Container &c)
 Scan right - right fold with all intermediate results.
 
template<typename T , typename Op , typename Container >
T stl_reduce (T init, Op &&op, const Container &c)
 Alias for stl_foldl.
 
template<typename Pred , typename Container >
bool stl_all (Pred &&pred, const Container &c)
 Check if all elements satisfy predicate.
 
template<typename Pred , typename Container >
bool stl_exists (Pred &&pred, const Container &c)
 Check if any element satisfies predicate.
 
template<typename Pred , typename Container >
bool stl_any (Pred &&pred, const Container &c)
 Alias for stl_exists.
 
template<typename Pred , typename Container >
bool stl_none (Pred &&pred, const Container &c)
 Check if no element satisfies predicate.
 
template<typename Pred , typename Container >
auto stl_find (Pred &&pred, const Container &c)
 Find first element satisfying predicate.
 
template<typename Pred , typename Container >
auto stl_find_last (Pred &&pred, const Container &c)
 Find last element satisfying predicate.
 
template<typename Pred , typename Container >
std::optional< size_t > stl_find_index (Pred &&pred, const Container &c)
 Find index of first element satisfying predicate.
 
template<typename Op , typename Container >
auto stl_find_mapi (Op &&op, const Container &c)
 Find and map with index (find_mapi in ML).
 
template<typename T , typename Container >
bool stl_mem (const T &target, const Container &c)
 Check if element exists in container (mem in ML).
 
template<typename Pred , typename Container >
size_t stl_count (Pred &&pred, const Container &c)
 Count elements satisfying predicate.
 
template<typename T , typename Container >
size_t stl_count_value (const T &target, const Container &c)
 Count occurrences of a value.
 
template<typename Container >
auto stl_take (size_t n, const Container &c)
 Take first n elements.
 
template<typename Container >
auto stl_drop (size_t n, const Container &c)
 Drop first n elements, return the rest.
 
template<typename Container >
auto stl_take_last (size_t n, const Container &c)
 Take last n elements.
 
template<typename Pred , typename Container >
auto stl_take_while (Pred &&pred, const Container &c)
 Take elements while predicate is true.
 
template<typename Pred , typename Container >
auto stl_drop_while (Pred &&pred, const Container &c)
 Drop elements while predicate is true, return the rest.
 
template<typename Container >
auto stl_first (const Container &c)
 Get first element.
 
template<typename Container >
auto stl_last (const Container &c)
 Get last element.
 
template<typename Container >
auto stl_nth (const size_t n, const Container &c)
 Get n-th element.
 
template<typename Container >
auto stl_min (const Container &c)
 Get minimum element.
 
template<typename Container >
auto stl_max (const Container &c)
 Get maximum element.
 
template<typename Container >
auto stl_min_max (const Container &c)
 Get both min and max in a single pass.
 
template<typename Key , typename Container >
auto stl_min_by (Key &&key, const Container &c)
 Get minimum element by key function.
 
template<typename Key , typename Container >
auto stl_max_by (Key &&key, const Container &c)
 Get maximum element by key function.
 
template<typename Container >
auto stl_sum (const Container &c)
 Sum all elements.
 
template<typename Container >
auto stl_product (const Container &c)
 Product of all elements.
 
template<typename Pred , typename Container >
auto stl_partition (Pred &&pred, const Container &c)
 Partition elements by predicate.
 
template<typename Container1 , typename Container2 >
auto stl_zip_to_pairs (const Container1 &c1, const Container2 &c2)
 Zip two containers into pairs.
 
template<typename Container >
auto stl_unzip_pairs (const Container &c)
 Unzip pairs into two vectors.
 
template<typename Container >
auto stl_enumerate_to_pairs (const Container &c)
 Enumerate container (return pairs of index and element).
 
template<typename Container1 , typename Container2 >
bool stl_equal (const Container1 &c1, const Container2 &c2)
 Check equality of two containers.
 
template<typename Container1 , typename Container2 >
int stl_compare (const Container1 &c1, const Container2 &c2)
 Compare two containers lexicographically.
 
template<typename Container >
auto stl_reverse (const Container &c)
 Return reversed copy of container.
 
template<typename Container >
auto stl_sort (const Container &c)
 Return sorted copy of container.
 
template<typename Cmp , typename Container >
auto stl_sort_by (Cmp &&cmp, const Container &c)
 Return sorted copy using custom comparator.
 
template<typename Container >
auto stl_unique (const Container &c)
 Remove consecutive duplicates.
 
template<typename Container >
auto stl_distinct (const Container &c)
 Remove all duplicates (keeps first occurrence).
 
template<typename Container1 , typename Container2 >
auto stl_concat (const Container1 &c1, const Container2 &c2)
 Concatenate two containers.
 
template<typename Container >
auto stl_flatten (const Container &c)
 Flatten a container of containers.
 
template<typename Op , typename Container >
auto stl_flat_map (Op &&op, const Container &c)
 Flat map - map then flatten.
 
template<typename Container >
auto stl_group (const Container &c)
 Group consecutive equal elements.
 
template<typename Key , typename Container >
auto stl_group_by (Key &&key, const Container &c)
 Group elements by key function.
 
template<typename Op , typename Container >
bool stl_traverse_permutations (Op &&op, const Container &c)
 Traverse all permutations of a container.
 
template<typename Container >
auto stl_permutations (const Container &c)
 Generate all permutations of a container.
 
template<typename Op , typename Container >
bool stl_traverse_combinations (size_t k, Op &&op, const Container &c)
 Traverse all k-combinations of a container.
 
template<typename Container >
auto stl_combinations (size_t k, const Container &c)
 Generate all k-combinations of a container.
 
template<typename Op , typename Container >
bool stl_traverse_arrangements (size_t k, Op &&op, const Container &c)
 Traverse all k-arrangements (k-permutations) of a container.
 
template<typename Container >
auto stl_arrangements (size_t k, const Container &c)
 Generate all k-arrangements (k-permutations) of a container.
 
template<typename T >
auto stl_cartesian_product (const std::vector< std::vector< T > > &containers)
 Generate cartesian product of multiple containers.
 
template<typename Container >
auto stl_power_set (const Container &c)
 Generate power set (all subsets) of a container.
 
template<typename Container >
auto stl_sliding_window (size_t n, const Container &c)
 Sliding window of size n over container (each_cons in Ruby).
 
template<typename Container >
auto stl_chunks (size_t n, const Container &c)
 Split container into chunks of size n (each_slice in Ruby).
 
template<typename T , typename Container >
auto stl_intersperse (const T &sep, const Container &c)
 Insert element between each pair (intersperse in Haskell).
 
template<typename Container >
auto stl_split_at (size_t n, const Container &c)
 Split at position n, returning (take n, drop n) in one pass.
 
template<typename Pred , typename Container >
auto stl_span (Pred &&pred, const Container &c)
 Split at predicate boundary (span in Haskell).
 
template<typename Container >
auto stl_init (const Container &c)
 Get all elements except the last (init in Haskell).
 
template<typename Container >
auto stl_tail (const Container &c)
 Get all elements except the first (tail in Haskell).
 
template<typename Container >
auto stl_tally (const Container &c)
 Count occurrences of each element (tally in Ruby, frequencies).
 
template<typename Pred , typename Container >
auto stl_reject (Pred &&pred, const Container &c)
 Filter out elements (reject in Ruby, opposite of filter).
 
template<class F , class... Ts, std::size_t... Is>
void tuple_for_each (const std::tuple< Ts... > &tuple, F func, std::index_sequence< Is... >)
 Apply a function to each element in a tuple (tuple first).
 
template<class F , class... Ts>
void tuple_for_each (const std::tuple< Ts... > &tuple, F func)
 Convenience overload that automatically generates the index sequence.
 
template<typename T >
DynList< T > to_DynList (const std::vector< T > &v)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Alias for vector_to_DynList.
 
template<typename Iterator >
auto range_to_DynList (Iterator begin, Iterator end) -> DynList< std::decay_t< decltype(*begin)> >
 Convert an iterator range to a DynList.
 
template<typename T >
Array< T > to_Array (const std::vector< T > &v)
 Convert a std::vector to an Array.
 
template<typename T , class Op >
auto map_vector (const std::vector< T > &v, Op op) -> std::vector< std::decay_t< decltype(op(v[0]))> >
 Map a function over a std::vector.
 
template<typename T , typename... Args>
std::vector< T > variadic_to_vector (Args &&... args)
 Convert a variadic parameter pack to a std::vector.
 
template<typename T , typename... Args>
DynList< T > variadic_to_DynList (Args &&... args)
 Convert a variadic parameter pack to a DynList.
 
template<class Container , typename T , typename... U>
Container tuple_to_container (const std::tuple< T, U... > &t)
 Convert a tuple to an Aleph-w container.
 
template<typename T , typename... U>
DynList< T > tuple_to_dynlist (const std::tuple< T, U... > &t)
 Convert a tuple to a DynList.
 
template<typename T , typename... U>
Array< T > tuple_to_array (const std::tuple< T, U... > &t)
 Convert a tuple to an Array.
 
template<typename StlContainer >
auto stl_container_to_dynList (const StlContainer &container) -> DynList< typename StlContainer::value_type >
 Convert any STL container to a DynList.
 
template<typename T >
DynList< T > list_to_DynList (const std::list< T > &l)
 Convert a std::list to a DynList.
 
template<typename T >
std::list< T > DynList_to_list (const DynList< T > &l)
 Convert a DynList to a std::list.
 
template<typename T >
std::vector< T > DynArray_to_vector (const DynArray< T > &arr)
 Convert a DynArray to a std::vector.
 
template<typename... Containers>
constexpr auto stl_zip (const Containers &... cs)
 Create a lazy zip view over STL containers.
 
template<typename... Containers>
constexpr auto stl_zip_it (const Containers &... cs)
 Get a zip iterator over STL containers.
 
template<typename Pred , typename... Containers>
bool stl_zip_all (Pred &&pred, const Containers &... cs)
 Check if predicate holds for all zipped tuples.
 
template<typename Pred , typename... Containers>
bool stl_zip_all_eq (Pred &&pred, const Containers &... cs)
 Check if predicate holds for all tuples AND containers have equal length.
 
template<typename Pred , typename... Containers>
bool stl_zip_exists (Pred &&pred, const Containers &... cs)
 Check if predicate holds for any zipped tuple.
 
template<typename Pred , typename... Containers>
bool stl_zip_any (Pred &&pred, const Containers &... cs)
 Alias for stl_zip_exists (Python/JS style name)
 
template<typename Pred , typename... Containers>
bool stl_zip_none (Pred &&pred, const Containers &... cs)
 Check if no tuple satisfies the predicate.
 
template<typename Op , typename... Containers>
void stl_zip_for_each (Op &&op, const Containers &... cs)
 Apply operation to each zipped tuple (for side effects).
 
template<typename Op , typename... Containers>
void stl_zip_for_each_indexed (Op &&op, const Containers &... cs)
 Apply operation to each tuple with its index.
 
template<typename T , typename Op , typename... Containers>
T stl_zip_foldl (T init, Op &&op, const Containers &... cs)
 Left fold over zipped tuples.
 
template<typename T , typename Op , typename... Containers>
T stl_zip_reduce (T init, Op &&op, const Containers &... cs)
 Alias for stl_zip_foldl (alternative name)
 
template<typename Op , typename... Containers>
auto stl_zip_map (Op &&op, const Containers &... cs)
 Map operation over zipped tuples, returning a vector.
 
template<typename Pred , typename... Containers>
auto stl_zip_filter (Pred &&pred, const Containers &... cs)
 Filter zipped tuples by predicate.
 
template<typename Pred , typename... Containers>
auto stl_zip_find_first (Pred &&pred, const Containers &... cs)
 Find first tuple satisfying predicate.
 
template<typename Pred , typename... Containers>
size_t stl_zip_count (Pred &&pred, const Containers &... cs)
 Count tuples satisfying predicate.
 
template<typename... Containers>
size_t stl_zip_length (const Containers &... cs)
 Count total tuples (minimum length of containers).
 
template<typename... Containers>
bool stl_zip_equal_length (const Containers &... cs)
 Check if all containers have equal length.
 
template<typename... Containers>
auto stl_zip_nth (const size_t n, const Containers &... cs)
 Get n-th tuple from zipped containers.
 
template<typename... Containers>
auto stl_zip_take (const size_t n, const Containers &... cs)
 Take first n tuples from zipped containers.
 
template<typename... Containers>
auto stl_zip_drop (const size_t n, const Containers &... cs)
 Skip first n tuples, return the rest.
 
template<typename Pred , typename... Containers>
auto stl_zip_partition (Pred &&pred, const Containers &... cs)
 Partition tuples by predicate.
 
template<typename... Containers>
auto stl_zip_to_vector (const Containers &... cs)
 Materialize zipped tuples into a vector.
 
template<typename Pred , typename... Containers>
bool stl_zip_traverse (Pred &&pred, const Containers &... cs)
 Traverse while predicate returns true.
 
template<typename Pred , typename... Containers>
bool stl_zip_traverse_eq (Pred &&pred, const Containers &... cs)
 Traverse while predicate returns true, verify equal lengths.
 
template<typename Cmp , typename... Containers>
bool stl_zip_cmp (Cmp &&cmp, const Containers &... cs)
 Compare elements across containers using a comparator.
 
template<typename Container >
constexpr auto stl_enumerate (const Container &c)
 Create an enumerate view over a container.
 
template<typename Pred , typename... Containers>
auto stl_zip_take_while (Pred &&pred, const Containers &... cs)
 Take tuples while predicate returns true.
 
template<typename Pred , typename... Containers>
auto stl_zip_drop_while (Pred &&pred, const Containers &... cs)
 Skip tuples while predicate returns true, then return the rest.
 
template<typename... Containers>
auto stl_zip_first (const Containers &... cs)
 Get first tuple from zipped containers.
 
template<typename... Containers>
auto stl_zip_last (const Containers &... cs)
 Get last tuple from zipped containers.
 
template<typename Pred , typename... Containers>
auto stl_zip_find_last (Pred &&pred, const Containers &... cs)
 Find last tuple satisfying predicate.
 
template<typename Pred , typename... Containers>
size_t stl_zip_find_index (Pred &&pred, const Containers &... cs)
 Find index of first tuple satisfying predicate.
 
template<typename T , typename U >
auto stl_unzip (const std::vector< std::pair< T, U > > &pairs)
 Unzip a vector of pairs into two vectors.
 
template<typename... Ts>
auto stl_unzip_tuple (const std::vector< std::tuple< Ts... > > &tuples)
 Unzip a vector of tuples into a tuple of vectors.
 
template<typename Container >
auto stl_adjacent (const Container &c)
 Zip adjacent (consecutive) elements of a container.
 
template<typename Op , typename Container >
auto stl_adjacent_map (Op &&op, const Container &c)
 Apply function to adjacent pairs of elements.
 
template<typename Pred , typename Container >
bool stl_adjacent_all (Pred &&pred, const Container &c)
 Check if predicate holds for all adjacent pairs.
 
template<typename Pred , typename Container >
bool stl_adjacent_exists (Pred &&pred, const Container &c)
 Check if predicate holds for any adjacent pair.
 
template<typename Op , typename... Containers>
auto stl_zip_mapi (Op &&op, const Containers &... cs)
 Map with index (mapi in ML).
 
template<typename Pred , typename... Containers>
auto stl_zip_filteri (Pred &&pred, const Containers &... cs)
 Filter with index (filteri in ML).
 
template<typename T , typename Op , typename... Containers>
auto stl_zip_scan_left (T init, Op &&op, const Containers &... cs)
 Scan left (scan_left in ML) - fold with intermediate results.
 
template<typename Op , typename... Containers>
auto stl_zip_find_mapi (Op &&op, const Containers &... cs)
 Find and map with index (find_mapi in ML).
 
template<typename... Containers>
bool stl_zip_equal (const Containers &... cs)
 Check equality of zipped sequences.
 
template<typename Eq , typename... Containers>
bool stl_zip_equal_by (Eq &&eq, const Containers &... cs)
 Check equality with custom comparator.
 
template<typename... Containers1, typename... Containers2>
int stl_zip_compare (const std::tuple< const Containers1 &... > &cs1, const std::tuple< const Containers2 &... > &cs2)
 Compare two zipped sequences lexicographically.
 
template<typename Tuple , typename... Containers>
bool stl_zip_mem (const Tuple &target, const Containers &... cs)
 Check if a tuple exists in the zipped sequence (mem in ML).
 
template<typename Key , typename... Containers>
auto stl_zip_assoc (const Key &key, const Containers &... cs)
 Find value associated with key in zipped pairs (assoc in ML).
 
template<typename... Containers>
auto stl_zip_min (const Containers &... cs)
 Get minimum tuple according to comparator.
 
template<typename... Containers>
auto stl_zip_max (const Containers &... cs)
 Get maximum tuple according to comparator.
 
template<typename... Containers>
auto stl_zip_min_max (const Containers &... cs)
 Get both min and max in a single pass.
 
template<typename... Containers>
auto stl_zip_sum (const Containers &... cs)
 Sum all tuples element-wise (requires + operator on tuple elements).
 
template<typename T >
std::string to_string (const std::vector< T > &v)
 Convert a std::vector<T> to a comma-separated std::string.
 
template<typename T >
std::string to_string (const Array< T > &v)
 Convert an Aleph::Array<T> to a comma-separated std::string.
 
void ltrim (std::string &s)
 Remove leading whitespace from a std::string in-place.
 
void rtrim (std::string &s)
 Remove trailing whitespace from a std::string in-place.
 
template<class... Args>
std::string concat (const Args &...args)
 Concatenate multiple arguments into a single std::string.
 
std::string trim (const std::string &s)
 Return a trimmed copy of a std::string (leading + trailing whitespace removed).
 
std::string & trim_in_place (std::string &s)
 Trim a std::string in-place (leading + trailing whitespace removed).
 
bool contains (const std::string_view &str, const std::string_view &substr)
 Check if substr appears inside str.
 
std::string to_string (const double d, const size_t precision)
 Format a double using fixed notation with the given precision.
 
std::string to_str (const double d)
 Convert double to a std::string with maximum round-trip precision.
 
std::string tolower (const char *str)
 Convert a C std::string to lower-case.
 
std::string toupper (const char *str)
 Convert a C std::string to upper-case.
 
std::string tolower (const std::string &str)
 Convert a std::string to lower-case.
 
std::string toupper (const std::string &str)
 Convert a std::string to upper-case.
 
std::string & mutable_tolower (std::string &str)
 Convert a std::string to lower-case in-place.
 
std::string & mutable_toupper (std::string &str)
 Convert a std::string to upper-case in-place.
 
std::string only_alpha (const std::string &str)
 Extract alphanumeric ASCII characters and normalize letters to lower-case.
 
std::string remove_spaces (const std::string &str)
 Remove all whitespace characters from a std::string.
 
std::string remove_symbols (const std::string &str, const std::string &symbols)
 Remove any character appearing in symbols.
 
template<class C >
std::ostream & join (const C &c, const std::string &sep, std::ostream &out)
 Join elements of an Aleph-style container into a stream.
 
template<class C >
std::string join (const C &c, const std::string &sep=" ")
 Join elements of an Aleph-style container into a std::string.
 
bool is_double (const std::string &str)
 Check whether a std::string fully parses as a finite double.
 
bool is_float (const std::string &str)
 Check whether a std::string fully parses as a finite float.
 
bool is_long (const std::string &str)
 Check whether a std::string fully parses as a long.
 
bool is_size_t (const std::string &str)
 Check whether a std::string fully parses as a non-negative size_t.
 
long safe_atol (const std::string &s)
 Convert a std::string to long and throw on parse errors.
 
double safe_atof (const std::string &s)
 Convert a std::string to double and throw on parse errors.
 
bool is_prefix (const std::string &str, const std::string &prefix)
 Check whether prefix is a prefix of str.
 
std::string remove_prefix (std::string &str, const std::string &prefix)
 Remove prefix from str if present.
 
std::string to_lower (const std::string &str)
 Convert a std::string to lower-case (byte-wise).
 
std::string to_upper (const std::string &str)
 Convert a std::string to upper-case (byte-wise).
 
std::string to_name (const std::string &str)
 Uppercase the first character of str and return the resulting copy.
 
DynList< std::string > split_camel_case (const char *const str)
 Split a camelCase / PascalCase std::string into tokens.
 
DynList< std::string > split_camel_case (const std::string &str)
 Split a camelCase / PascalCase std::string into tokens.
 
void fill_string (std::string &str, char sym)
 Fill all the content of std::string with a defined char.
 
std::vector< std::string > & split (const std::string &s, const char delim, std::vector< std::string > &elems)
 Split a std::string by a single delimiter character.
 
std::vector< std::string > split (const std::string &s, const char delim)
 Split a std::string by a single delimiter character.
 
template<template< typename > class Container = DynList>
Container< std::string > split_string (const std::string &s, const std::string &delim)
 Split a std::string by a set of delimiter characters.
 
DynList< std::string > split_to_list (const std::string &s, const std::string &delim)
 Split a std::string into an Aleph::DynList<std::string>.
 
std::string to_Pascalcase (const std::string &str)
 Convert an identifier-like std::string to PascalCase.
 
Array< std::string > split_to_array (const std::string &s, const std::string &delim)
 Split a std::string into an Aleph::Array<std::string>.
 
std::pair< std::string, std::string > split_pos (const std::string &str, const size_t pos)
 Split a std::string at a fixed position.
 
DynList< std::string > split_n (const std::string &str, const size_t n)
 Split a std::string into n parts.
 
template<typename T >
DynList< DynList< T > > complete_rows (DynList< DynList< T > > &m)
 Pad all rows of a matrix to the maximum row length.
 
DynList< DynList< std::string > > format_string (const DynList< size_t > &lens, const DynList< DynList< std::string > > &mat)
 
std::ostream & format_string (std::ostream &out, const DynList< size_t > &lens, const DynList< DynList< std::string > > &mat)
 Write a formatted matrix to a stream.
 
DynList< DynList< std::string > > format_string (const DynList< DynList< std::string > > &mat)
 Format a matrix by computing column widths.
 
DynList< DynList< std::string > > format_string_csv (const DynList< DynList< std::string > > &mat)
 Produce a CSV-like matrix (commas added to all but last element in each row).
 
std::string to_string (const DynList< DynList< std::string > > &mat)
 Convert a matrix of strings to a single std::string.
 
DynList< std::string > split_text_into_words (const std::string &text)
 Split a text into whitespace-separated words.
 
DynList< std::string > split_text_into_lines (const std::string &text)
 Split a text into lines by "\n".
 
std::string to_string (const DynList< std::string > &lines)
 Join lines into a single std::string separated by newlines.
 
std::string justify_line (std::string line, const size_t page_width)
 Justify a single line by inserting extra spaces.
 
std::string justify_text (const std::string &text, const size_t width, const size_t left_margin=0)
 Justify a text to a target width.
 
std::string justify_line_except_first (const std::string &text, const size_t width, const size_t left_margin=0)
 Justify all lines except the first one.
 
std::string align_text_to_left (const std::string &text, const size_t page_width, const size_t left_margin=0)
 Align text to the left by wrapping lines at page_width.
 
std::string align_text_to_left_except_first (const std::string &text, const size_t width, const size_t left_margin=0)
 Align all lines except the first one.
 
std::string shift_lines_to_left (const std::string &str, const size_t n)
 Indent every line in a multi-line std::string by n spaces.
 
void build_pars_list (std::string &unused)
 Base case for build_pars_list(std::string&, ...).
 
template<typename T >
requires requires(std::ostream &out, const T &v) { out << v; }
void build_pars_list (std::string &str, const T &item)
 
template<class T , class... Args>
void build_pars_list (std::string &str, const T &item, Args... args)
 Append multiple parameters to a comma-separated parameter list.
 
template<class First , class... Rest>
requires (not requires(const std::remove_reference_t<First> &c) { c.is_empty(); c.get_last(); c.get_it(); })
std::string build_pars_list (const First &first, const Rest &...rest)
 Build a stringified parameters' list.
 
template<class C >
requires requires(const C &c) { c.is_empty(); c.get_last(); c.get_it(); }
std::string build_pars_list (const C &c, const std::string &sep=",")
 
template<typename Op , typename Container >
void uni_for_each (Op &&op, const Container &c)
 Apply operation to each element (for_each).
 
template<typename Op , typename Container >
void uni_for_each_indexed (Op &&op, const Container &c)
 Apply operation to each element with index.
 
template<typename Op , typename Container >
auto uni_map (Op &&op, const Container &c)
 Map operation - transform each element.
 
template<typename Op , typename Container >
auto uni_mapi (Op &&op, const Container &c)
 Map with index (mapi in ML).
 
template<typename Pred , typename Container >
auto uni_filter (Pred &&pred, const Container &c)
 Filter elements satisfying predicate.
 
template<typename Pred , typename Container >
auto uni_filteri (Pred &&pred, const Container &c)
 Filter with index (filteri in ML).
 
template<typename T , typename Op , typename Container >
T uni_foldl (T init, Op &&op, const Container &c)
 Left fold (foldl) - reduce from left to right.
 
template<typename T , typename Op , typename Container >
T uni_reduce (T init, Op &&op, const Container &c)
 Alias for uni_foldl.
 
template<typename T , typename Op , typename Container >
std::vector< T > uni_scan_left (T init, Op &&op, const Container &c)
 Scan left - fold with all intermediate results.
 
template<typename Pred , typename Container >
bool uni_all (Pred &&pred, const Container &c)
 Check if all elements satisfy predicate.
 
template<typename Pred , typename Container >
bool uni_exists (Pred &&pred, const Container &c)
 Check if any element satisfies predicate.
 
template<typename Pred , typename Container >
bool uni_any (Pred &&pred, const Container &c)
 Alias for uni_exists.
 
template<typename Pred , typename Container >
bool uni_none (Pred &&pred, const Container &c)
 Check if no element satisfies predicate.
 
template<typename Pred , typename Container >
auto uni_find (Pred &&pred, const Container &c)
 Find first element satisfying predicate.
 
template<typename Pred , typename Container >
std::optional< size_t > uni_find_index (Pred &&pred, const Container &c)
 Find index of first element satisfying predicate.
 
template<typename Op , typename Container >
auto uni_find_mapi (Op &&op, const Container &c)
 Find and map with index (find_mapi in ML).
 
template<typename T , typename Container >
bool uni_mem (const T &target, const Container &c)
 Check if element exists in container (mem in ML).
 
template<typename Pred , typename Container >
size_t uni_count (Pred &&pred, const Container &c)
 Count elements satisfying predicate.
 
template<typename Container >
size_t uni_length (const Container &c)
 Get container length.
 
template<typename Container >
auto uni_take (size_t n, const Container &c)
 Take first n elements.
 
template<typename Container >
auto uni_drop (size_t n, const Container &c)
 Drop first n elements, return the rest.
 
template<typename Pred , typename Container >
auto uni_take_while (Pred &&pred, const Container &c)
 Take elements while predicate is true.
 
template<typename Pred , typename Container >
auto uni_drop_while (Pred &&pred, const Container &c)
 Drop elements while predicate is true, return the rest.
 
template<typename Container >
auto uni_first (const Container &c)
 Get first element.
 
template<typename Container >
auto uni_last (const Container &c)
 Get last element.
 
template<typename Container >
auto uni_nth (size_t n, const Container &c)
 Get n-th element.
 
template<typename Container >
auto uni_min (const Container &c)
 Get minimum element.
 
template<typename Container >
auto uni_max (const Container &c)
 Get maximum element.
 
template<typename Container >
auto uni_min_max (const Container &c)
 Get both min and max in a single pass.
 
template<typename Container >
auto uni_sum (const Container &c)
 Sum all elements.
 
template<typename Container >
auto uni_product (const Container &c)
 Product of all elements.
 
template<typename Pred , typename Container >
auto uni_partition (Pred &&pred, const Container &c)
 Partition elements by predicate.
 
template<typename Container1 , typename Container2 >
auto uni_concat (const Container1 &c1, const Container2 &c2)
 Concatenate two containers.
 
template<typename Container >
auto uni_flatten (const Container &c)
 Flatten a container of containers.
 
template<typename Op , typename Container >
auto uni_flat_map (Op &&op, const Container &c)
 Flat map - map then flatten.
 
template<typename Container >
auto uni_distinct (const Container &c)
 Remove all duplicates (keeps first occurrence).
 
template<typename Key , typename Container >
auto uni_group_by (Key &&key, const Container &c)
 Group elements by key function.
 
template<typename Container >
auto uni_tally (const Container &c)
 Count occurrences of each element (frequency count).
 
template<typename Container >
auto uni_to_vector (const Container &c)
 Convert container to std::vector.
 
template<typename Container1 , typename Container2 >
bool uni_equal (const Container1 &c1, const Container2 &c2)
 Check equality of two containers.
 
template<typename Container1 , typename Container2 >
int uni_compare (const Container1 &c1, const Container2 &c2)
 Compare two containers lexicographically.
 
template<AlephSequential Container, class Compare = std::less<typename Container::Key_Type>>
requires Aleph::StrictWeakOrder<Compare, typename Container::Key_Type>
void in_place_unique (Container &c, Compare cmp={})
 Remove duplicates in-place preserving first occurrence order.
 
template<typename... Containers>
auto uni_zip (const Containers &...cs)
 Create a lazy zip view over any combination of STL/Aleph containers.
 
template<typename... Containers>
auto uni_zip_it (const Containers &...cs)
 Get a unified zip iterator.
 
template<typename Pred , typename... Containers>
bool uni_zip_all (Pred &&pred, const Containers &...cs)
 Check if predicate holds for all zipped tuples.
 
template<typename Pred , typename... Containers>
bool uni_zip_all_eq (Pred &&pred, const Containers &...cs)
 Check if all tuples satisfy predicate AND containers have equal length.
 
template<typename Pred , typename... Containers>
bool uni_zip_exists (Pred &&pred, const Containers &...cs)
 Check if predicate holds for any zipped tuple.
 
template<typename Pred , typename... Containers>
bool uni_zip_any (Pred &&pred, const Containers &...cs)
 Alias for uni_zip_exists.
 
template<typename Pred , typename... Containers>
bool uni_zip_none (Pred &&pred, const Containers &...cs)
 Check if no tuple satisfies the predicate.
 
template<typename Op , typename... Containers>
void uni_zip_for_each (Op &&op, const Containers &...cs)
 Apply operation to each zipped tuple.
 
template<typename Op , typename... Containers>
void uni_zip_for_each_indexed (Op &&op, const Containers &...cs)
 Apply operation to each tuple with index.
 
template<typename T , typename Op , typename... Containers>
T uni_zip_foldl (T init, Op &&op, const Containers &...cs)
 Left fold over zipped tuples.
 
template<typename T , typename Op , typename... Containers>
T uni_zip_reduce (T init, Op &&op, const Containers &...cs)
 Alias for uni_zip_foldl.
 
template<typename Op , typename... Containers>
auto uni_zip_map (Op &&op, const Containers &...cs)
 Map operation over zipped tuples.
 
template<typename Pred , typename... Containers>
auto uni_zip_filter (Pred &&pred, const Containers &...cs)
 Filter zipped tuples by predicate.
 
template<typename Pred , typename... Containers>
auto uni_zip_find_first (Pred &&pred, const Containers &...cs)
 Find first tuple satisfying predicate.
 
template<typename Pred , typename... Containers>
size_t uni_zip_count (Pred &&pred, const Containers &...cs)
 Count tuples satisfying predicate.
 
template<typename... Containers>
size_t uni_zip_length (const Containers &...cs)
 Get zip length (minimum of all container sizes).
 
template<typename... Containers>
bool uni_zip_equal_length (const Containers &...cs)
 Check if all containers have equal length.
 
template<typename... Containers>
auto uni_zip_nth (size_t n, const Containers &...cs)
 Get n-th tuple from zipped containers.
 
template<typename... Containers>
auto uni_zip_take (size_t n, const Containers &...cs)
 Take first n tuples.
 
template<typename... Containers>
auto uni_zip_drop (size_t n, const Containers &...cs)
 Skip first n tuples, return the rest.
 
template<typename Pred , typename... Containers>
auto uni_zip_take_while (Pred &&pred, const Containers &...cs)
 Take tuples while predicate is true.
 
template<typename Pred , typename... Containers>
auto uni_zip_drop_while (Pred &&pred, const Containers &...cs)
 Skip tuples while predicate is true, return the rest.
 
template<typename... Containers>
auto uni_zip_first (const Containers &...cs)
 Get first tuple.
 
template<typename... Containers>
auto uni_zip_last (const Containers &...cs)
 Get last tuple.
 
template<typename Pred , typename... Containers>
auto uni_zip_partition (Pred &&pred, const Containers &...cs)
 Partition tuples by predicate.
 
template<typename... Containers>
auto uni_zip_to_vector (const Containers &...cs)
 Materialize zipped tuples into a vector.
 
template<typename Pred , typename... Containers>
bool uni_zip_traverse (Pred &&pred, const Containers &...cs)
 Traverse while predicate returns true.
 
template<typename Op , typename... Containers>
auto uni_zip_mapi (Op &&op, const Containers &...cs)
 Map with index (mapi in ML).
 
template<typename Pred , typename... Containers>
auto uni_zip_filteri (Pred &&pred, const Containers &...cs)
 Filter with index (filteri in ML).
 
template<typename T , typename Op , typename... Containers>
auto uni_zip_scan_left (T init, Op &&op, const Containers &...cs)
 Scan left - fold with intermediate results.
 
template<typename Op , typename... Containers>
auto uni_zip_find_mapi (Op &&op, const Containers &...cs)
 Find and map with index (find_mapi in ML).
 
template<typename Eq , typename... Containers>
bool uni_zip_equal_by (Eq &&eq, const Containers &...cs)
 Check equality with custom comparator.
 
template<typename Tuple , typename... Containers>
bool uni_zip_mem (const Tuple &target, const Containers &...cs)
 Check if a tuple exists in the zipped sequence (mem in ML).
 
template<typename Key , typename... Containers>
auto uni_zip_assoc (const Key &key, const Containers &...cs)
 Find value associated with key in zipped pairs (assoc in ML).
 
template<typename... Containers>
auto uni_zip_min (const Containers &...cs)
 Get minimum tuple.
 
template<typename... Containers>
auto uni_zip_max (const Containers &...cs)
 Get maximum tuple.
 
template<typename... Containers>
auto uni_zip_min_max (const Containers &...cs)
 Get both min and max in a single pass.
 
template<typename Container >
auto uni_unzip (const Container &c)
 Unzip a container of pairs into two DynLists.
 
template<typename Container >
auto uni_unzip_tuple (const Container &c)
 Unzip a container of tuples into a tuple of DynLists.
 
template<typename... Containers>
auto uni_zip_to_dynlist (const Containers &...cs)
 Materialize a zipped view into a DynList of tuples.
 
 ZipIterator (const HeadC &head, const TailC &...tail)
 Construct a zip iterator over multiple Aleph containers.
 
bool has_curr () const noexcept
 Return true if all underlying iterators are positioned on a valid item.
 
bool completed () const noexcept
 Return true if all underlying iterators are finished.
 
auto get_curr () const
 Return the current tuple (bounds-checked).
 
auto get_curr_ne () const noexcept(zip_detail::nothrow_curr_copy< Aleph::const_iterator_t< HeadC >, T > and zip_detail::nothrow_item_copy< T > and zip_detail::nothrow_tail_curr< ZipIterator< TailC... > >)
 Return the current tuple (unchecked variant).
 
DynList< T > get_curr_list () const
 Returns current elements as a DynList (requires homogeneous Item_Type)
 
void next ()
 Advance all underlying iterators (bounds-checked).
 
void next_ne () noexcept(noexcept(std::declval< Aleph::const_iterator_t< HeadC > & >().next_ne()) and noexcept(std::declval< ZipIterator< TailC... > & >().next_ne()))
 Advance all underlying iterators (unchecked variant).
 
template<class... Cs>
ZipIterator< Cs... > get_zip_it (const Cs &...cs)
 Create a ZipIterator over the given containers.
 
template<class... Cs>
ZipIterator< Cs... > get_zip_it_pos (size_t pos, const Cs &...cs)
 Create a ZipIterator positioned at index pos.
 
template<class... Cs>
ZipIterator< Cs... > zip_it (const Cs &...cs)
 Alias for get_zip_it.
 
template<class... Cs>
ZipIterator< Cs... > zip_it_pos (size_t pos, const Cs &...cs)
 Alias for get_zip_it_pos.
 
template<class... Cs>
bool equal_length (const Cs &...cs)
 Return true if all containers have the same length.
 
template<class Op , class... Cs>
bool zip_traverse (Op &&op, const Cs &...cs)
 Traverse zipped containers while op returns true.
 
template<class Op , class... Cs>
bool zip_traverse_eq (Op &&op, const Cs &...cs)
 Traverse zipped containers while op returns true; verify equal lengths.
 
template<class Op , class... Cs>
void zip_for_each (Op &&op, const Cs &...cs)
 Apply op to every zipped tuple.
 
template<class Op , class... Cs>
void zip_for_each_eq (Op &&op, const Cs &...cs)
 Apply op to every zipped tuple; throw if containers differ in length.
 
template<class Op , class... Cs>
bool zip_all (Op &&op, const Cs &...cs)
 Return true if op returns true for all tuples and containers have equal length.
 
template<class Op , class... Cs>
bool zip_all_short (Op &&op, const Cs &...cs)
 Return true if op returns true for all tuples (without length check).
 
template<class Op , class... Cs>
bool zip_forall (Op &&op, const Cs &...cs)
 Alias for zip_all.
 
template<class Op , class... Cs>
bool zip_forall_short (Op &&op, const Cs &...cs)
 Alias for zip_all_short.
 
template<class Op , class... Cs>
bool zip_exists (Op &&op, const Cs &...cs)
 Return true if op returns true for at least one tuple.
 
template<class Op , class... Cs>
bool zip_any (Op &&op, const Cs &...cs)
 Alias for zip_exists.
 
template<class Op , class... Cs>
bool zip_none (Op &&op, const Cs &...cs)
 Return true if op returns false for all tuples.
 
template<class Op , class... Cs>
size_t zip_count (Op &&op, const Cs &...cs)
 Count tuples that satisfy predicate op.
 
template<class... Cs>
size_t zip_length (const Cs &...cs)
 Count all tuples (minimum length of containers).
 
template<class Op , class... Cs>
auto zip_find_first (Op &&op, const Cs &...cs)
 Return the first tuple that satisfies predicate op.
 
template<class Op , class... Cs>
auto zip_find_last (Op &&op, const Cs &...cs)
 Return the last tuple that satisfies predicate op.
 
template<class... Cs>
auto zip_nth (size_t n, const Cs &...cs)
 Return the n-th tuple from zipped containers.
 
template<class... Cs>
auto zip_first (const Cs &...cs)
 Return the first tuple from zipped containers.
 
template<typename T , class Op , class... Cs>
DynList< T > zip_maps (Op op, const Cs &...cs)
 Map op over zipped tuples, returning a list of results.
 
template<typename T , class Prop , class Op , class... Cs>
DynList< T > zip_maps_if (Prop prop, Op op, const Cs &...cs)
 Map op over zipped tuples that satisfy prop.
 
template<typename T , class Op , class... Cs>
T zip_foldl (const T &init, Op op, const Cs &...cs)
 Left fold (reduce) over zipped tuples.
 
template<typename T , class Op , class... Cs>
T zip_foldl_eq (const T &init, Op op, const Cs &...cs)
 Left fold over zipped tuples; throw if containers differ in length.
 
template<typename T , class Op , class... Cs>
DynList< T > zip_maps_eq (Op op, const Cs &...cs)
 Map op over zipped tuples; throw if containers differ in length.
 
template<typename T , class Prop , class Op , class... Cs>
DynList< T > zip_maps_if_eq (Prop prop, Op op, const Cs &...cs)
 Map op over zipped tuples that satisfy prop; throw if lengths differ.
 
template<class Op , class... Cs>
auto zip_map (Op &&op, const Cs &...cs)
 Map op over zipped tuples with auto-deduced return type.
 
template<class Op , class... Cs>
auto zip_map_eq (Op &&op, const Cs &...cs)
 Map op over zipped tuples with auto-deduced return type; throw if lengths differ.
 
template<class Op , class... Cs>
auto zip_filter (Op op, const Cs &...cs)
 Filter zipped tuples by predicate op.
 
template<class Op , class... Cs>
auto zip_filter_eq (Op op, const Cs &...cs)
 Filter zipped tuples by predicate op; throw if containers differ in length.
 
template<class Cmp , class... Cs>
bool zip_cmp (Cmp cmp, const Cs &...cs)
 Return true if cmp(t) is true for each built tuple t.
 
template<class Op , class... Cs>
size_t zip_find_index (Op op, const Cs &...cs)
 Find the first index where op returns true.
 
template<class Op , class... Cs>
auto zip_partition (Op op, const Cs &...cs)
 Partition zipped tuples by predicate op.
 
template<class... Cs>
auto t_zip (const Cs &...cs)
 Materialize zipped tuples into a DynList.
 
template<class... Cs>
auto t_zip_eq (const Cs &...cs)
 Materialize zipped tuples; throw if containers differ in length.
 
 EnumZipIterator (const HeadC &head, const TailC &...tail)
 Construct an enumerating zip iterator over multiple containers.
 
template<class... Cs>
EnumZipIterator< Cs... > get_enum_zip_it (const Cs &...cs)
 Create an EnumZipIterator over the given containers.
 
template<class C , class... Cs>
EnumZipIterator< C, Cs... > get_enum_zip_it_pos (size_t pos, const C &c, const Cs &...cs)
 Create an EnumZipIterator positioned at index pos.
 
template<class... Cs>
EnumZipIterator< Cs... > enum_zip_it (const Cs &...cs)
 Alias for get_enum_zip_it.
 
template<class... Cs>
EnumZipIterator< Cs... > enum_zip_it_pos (size_t pos, const Cs &...cs)
 Alias for get_enum_zip_it_pos.
 
template<class... Cs>
auto t_enum_zip (const Cs &...cs)
 Materialize enumerated zipped tuples into a DynList.
 
template<class... Cs>
auto t_enum_zip_eq (const Cs &...cs)
 Materialize enumerated zipped tuples; throw if containers differ in length.
 
template<typename... Ts, size_t... is>
static auto t_unzip_impl (const DynList< std::tuple< Ts... > > &l, std::index_sequence< is... >)
 
template<class... Ts>
auto t_unzip (const DynList< std::tuple< Ts... > > &tuples)
 Unzip a list of tuples into a tuple of lists.
 
template<class C , typename... Lists>
auto zip_lists (const C &c, const Lists &...lists)
 Take several container of same type and some length and builds a list of lists.
 
template<class C , typename... Lists>
auto zip_lists_eq (const C &c, const Lists &...lists)
 Like zip_lists but throws if containers differ in length.
 
template<typename C1 , typename C2 >
auto std_zip (const C1 &c1, const C2 &c2)
 Build a vector of pairs from two STL containers.
 
template<typename... Cs>
auto tzip_std (const Cs &...cs)
 Build a vector of tuples from 2 or more STL containers (variadic).
 
template<typename... Cs>
auto std_zip_n (const Cs &...cs)
 Build a vector of tuples from 2 or more STL containers (variadic).
 
template<class Op , class... Cs>
auto zip_transform (Op &&op, const Cs &...cs)
 Transform zipped tuples using op and return results in a vector.
 
template<class Op , class... Cs>
auto zip_transform_eq (Op &&op, const Cs &...cs)
 Transform zipped tuples; throw if containers differ in length.
 
template<class Op , class... Cs>
void zip_for_each_indexed (Op &&op, const Cs &...cs)
 Apply op to each zipped tuple along with its index.
 
template<class Op , class... Cs>
void zip_for_each_indexed_eq (Op &&op, const Cs &...cs)
 Apply op to each zipped tuple with index; throw if lengths differ.
 
template<class... Cs>
auto zip_take (size_t n, const Cs &...cs)
 Take at most n tuples from the zipped containers.
 
template<class... Cs>
auto zip_drop (const size_t n, const Cs &...cs)
 Skip n tuples and return the rest.
 
template<class Pred , class... Cs>
auto zip_take_while (Pred &&pred, const Cs &...cs)
 Take tuples while predicate pred returns true.
 
template<class Pred , class... Cs>
auto zip_drop_while (Pred &&pred, const Cs &...cs)
 Skip tuples while predicate pred returns true, then return the rest.
 
template<class Op , class Tuple >
void for_each_in_tuple (Op &&op, Tuple &&t)
 Apply op to each element of a tuple.
 
template<class Op , class Tuple >
auto transform_tuple (Op &&op, Tuple &&t)
 Transform each element of a tuple, returning a new tuple.
 
template<class Pred , class Tuple >
bool all_of_tuple (Pred &&pred, const Tuple &t)
 Return true if all tuple elements satisfy pred.
 
template<class Pred , class Tuple >
bool any_of_tuple (Pred &&pred, const Tuple &t)
 Return true if any tuple element satisfies pred.
 
template<class Pred , class Tuple >
bool none_of_tuple (Pred &&pred, const Tuple &t)
 Return true if no tuple element satisfies pred.
 
template<typename CleanupFunc >
 Init_Guard (CleanupFunc) -> Init_Guard< CleanupFunc >
 Deduction guide for Init_Guard.
 
template<typename CleanupFunc >
auto make_init_guard (CleanupFunc f)
 Create an Init_Guard with a cleanup function.
 
template<typename Container , typename Iterator >
void verify_container_and_iterator (const Container &container, const Iterator &itor)
 Verifies that an iterator belongs to a specific container.
 
template<typename Iterator >
void verify_iterators (const Iterator &itor1, const Iterator &itor2)
 Verifies that two iterators belong to the same container.
 
template<typename Container , typename Iterator >
void verify_container_and_iterators (const Container &container, const Iterator &itor_container, const Iterator &itor1, const Iterator &itor2)
 Verifies container-iterator relationships with distinctness check.
 
template<typename Container , typename Iterator >
void verify_container_and_iterators (const Container &container, const Iterator &itor1, const Iterator &itor2)
 Verifies that two iterators both belong to a specific container.
 
template<class Itor , class Operation >
Operation for_each (Itor beg, const Itor &end, Operation op)
 Apply an operation to each element in a range.
 
template<class Itor , class Operation >
Itor::difference_type count_if (Itor beg, const Itor &end, Operation op)
 Count elements satisfying a predicate.
 
template<class Itor , class T >
Itor::difference_type count (const Itor &beg, const Itor &end, const T &value)
 Count elements equal to a value.
 
template<class Itor , class CompFunc = Aleph::less<typename Itor::value_type>>
Itor min_element (Itor beg, const Itor &end, CompFunc op=CompFunc())
 Find the minimum element in a range.
 
template<class Itor , class CompFunc = Aleph::greater<typename Itor::value_type>>
Itor max_element (const Itor &beg, const Itor &end, CompFunc op=CompFunc())
 Find the maximum element in a range.
 
template<class Itor , class UnaryPredicate >
Itor find_if (Itor beg, const Itor &end, UnaryPredicate op)
 Find the first element satisfying a predicate.
 
template<class Itor , class T >
Itor find (const Itor &beg, const Itor &end, const T &value)
 Find the first element equal to a value.
 
template<class Itor , class Size , class T , class BinaryPredicate = Aleph::equal_to<T>>
Itor search_n (Itor beg, const Itor &end, Size count, const T &value, BinaryPredicate op=BinaryPredicate())
 Find n consecutive elements equal to a value.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 search (Itor1 beg, const Itor1 &end, Itor2 searchBeg, const Itor2 &searchEnd, BinaryPredicate op=BinaryPredicate())
 Search for a subrange within a range.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 find_end (Itor1 beg, Itor1 end, Itor2 searchBeg, Itor2 searchEnd, BinaryPredicate op=BinaryPredicate())
 Find the last occurrence of a subrange.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 find_first_of (const Itor1 &beg, const Itor1 &end, Itor2 searchBeg, const Itor2 &searchEnd, BinaryPredicate op=BinaryPredicate())
 Find first element from a set.
 
template<class Itor , class BinaryPredicate = Aleph::equal_to<typename Itor::value_type>>
Itor adjacent_find (Itor beg, const Itor &end, BinaryPredicate op=BinaryPredicate())
 Find first pair of adjacent equal elements.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
bool equal (Itor1 beg, const Itor1 &end, Itor2 cmpBeg, BinaryPredicate op=BinaryPredicate())
 Test if two ranges are equal.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
std::pair< Itor1, Itor2 > mismatch (Itor1 beg, const Itor1 &end, Itor2 cmpBeg, BinaryPredicate op=BinaryPredicate())
 Find the first mismatching elements in two ranges.
 
template<class Itor1 , class Itor2 , class Comp = Aleph::less<typename Itor1::value_type>>
bool lexicographical_compare (Itor1 beg1, const Itor1 &end1, Itor2 beg2, const Itor2 &end2, Comp op=Comp())
 Lexicographical comparison of two ranges.
 
template<class Itor1 , class Itor2 >
Itor2 copy (Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg)
 Copy elements from one range to another.
 
template<class Itor1 , class Itor2 >
Itor2 copy_backward (const Itor1 &sourceBeg, Itor1 sourceEnd, Itor2 destEnd)
 Copy elements backward from one range to another.
 
template<class Itor1 , class Itor2 , class UnaryFunc >
Itor2 transform (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg, UnaryFunc op)
 Transform elements using a unary operation.
 
template<class Itor1 , class Itor2 , class Itor3 , class BinaryFunc >
Itor3 transform (Itor1 source1Beg, Itor1 source1End, Itor2 source2Beg, Itor3 destBeg, BinaryFunc op)
 Transform elements using a binary operation.
 
template<class Itor1 , class Itor2 >
Itor2 swap_ranges (Itor1 beg1, const Itor1 &end1, Itor2 beg2)
 Swap elements between two ranges.
 
template<class Itor , class T >
void fill (Itor beg, const Itor &end, const T &value)
 Fill a range with a value.
 
template<class Itor , class T , class Size >
void fill_n (Itor beg, Size num, const T &value)
 Fill n elements with a value.
 
template<class Itor , class Func >
void generate (Itor beg, const Itor &end, Func op)
 Generate values for a range.
 
template<class Itor , class Size , class Func >
void generate_n (Itor beg, Size num, Func op)
 Generate values for n elements.
 
template<class Itor , class UnaryPredicate , class T >
void replace_if (Itor beg, const Itor &end, UnaryPredicate op, const T &value)
 Replace elements satisfying a predicate.
 
template<class Itor , class T >
void replace (Itor beg, const Itor &end, const T &old_value, const T &new_value)
 Replace elements equal to a value.
 
template<class Itor1 , class Itor2 , class UnaryPredicate , class T >
Itor2 replace_copy_if (Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg, UnaryPredicate op, const T &value)
 Copy and replace elements satisfying a predicate.
 
template<class Itor1 , class Itor2 , class T >
Itor2 replace_copy (const Itor1 &sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg, const T &old_value, const T &new_value)
 Copy and replace elements equal to a value.
 
template<class In_Itor , class Out_Itor , class Predicate >
Out_Itor remove_copy_if (In_Itor __first, const In_Itor &__last, Out_Itor __result, Predicate __pred)
 Copy elements not satisfying a predicate.
 
template<class Fw_Itor , class Predicate >
Fw_Itor remove_if (Fw_Itor __first, const Fw_Itor &__last, Predicate __pred)
 Remove elements satisfying a predicate.
 
template<class Fw_Itor , class T >
Fw_Itor remove (Fw_Itor __first, const Fw_Itor &__last, const T &__value)
 Remove elements equal to a value.
 
template<class In_Itor , class Out_Itor >
Out_Itor unique_copy (In_Itor __first, In_Itor __last, Out_Itor __result)
 Copy unique elements.
 
template<class In_Itor , class Out_Itor , class BinaryPredicate >
Out_Itor unique_copy (In_Itor __first, In_Itor __last, Out_Itor __result, BinaryPredicate __binary_pred)
 Copy unique elements with custom comparison.
 
template<class Itor , class BinaryPredicate = Aleph::equal_to<typename Itor::value_type>>
Itor unique (Itor __first, Itor __last, BinaryPredicate __binary_pred=BinaryPredicate())
 Remove consecutive duplicates in place.
 
template<class Itor >
void reverse (Itor beg, Itor end)
 Reverse elements in a range.
 
template<class Itor1 , class Itor2 >
Itor2 reverse_copy (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg)
 Copy elements in reverse order.
 
template<class Itor >
void rotate (Itor beg, Itor pos, Itor end)
 Rotate elements in a range.
 
template<class Itor1 , class Itor2 >
Itor2 rotate_copy (const Itor1 &beg, const Itor1 &pos, const Itor1 &end, Itor2 tgt_beg)
 Copy and rotate elements.
 
template<class Itor , class T >
Itor lower_bound (Itor beg, Itor end, const T &value)
 Find lower bound in a sorted range.
 
template<class Itor , class T , class BinaryPredicate >
Itor lower_bound (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Find lower bound with custom comparison.
 
template<class Itor , class T >
Itor upper_bound (Itor beg, Itor end, const T &value)
 Find upper bound in a sorted range.
 
template<class Itor , class T , class BinaryPredicate >
Itor upper_bound (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Find upper bound with custom comparison.
 
template<class Itor , class T >
bool binary_search (Itor beg, Itor end, const T &value)
 Binary search for a value.
 
template<class Itor , class T , class BinaryPredicate >
bool binary_search (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Binary search with custom comparison.
 
template<class Itor , class T >
std::pair< Itor, Itor > equal_range (Itor beg, Itor end, const T &value)
 Find equal range in a sorted sequence.
 
template<class Itor , class T , class BinaryPredicate >
std::pair< Itor, Itor > equal_range (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Find equal range with custom comparison.
 
template<class Itor1 , class Itor2 >
bool includes (Itor1 beg, Itor1 end, Itor2 searchBeg, Itor2 searchEnd)
 Test if one sorted range includes another.
 
template<class Itor1 , class Itor2 , class Itor3 >
Itor3 merge (Itor1 source1Beg, Itor1 source1End, Itor2 source2Beg, Itor2 source2End, Itor3 destBeg)
 Merge two sorted ranges.
 
template<class Itor1 , class Itor2 , class Itor3 , class BinaryPredicate >
Itor3 merge (Itor1 source1Beg, Itor1 source1End, Itor2 source2Beg, Itor2 source2End, Itor3 destBeg, BinaryPredicate op)
 Merge two sorted ranges with custom comparison.
 
template<class Itor , class T >
T accumulate (Itor beg, Itor end, T initValue)
 Accumulate values in a range.
 
template<class Itor , class T , class BinaryFunc >
T accumulate (Itor beg, Itor end, T initValue, BinaryFunc op)
 Accumulate values with custom operation.
 
template<class Itor1 , class Itor2 , class T >
T inner_product (Itor1 beg1, Itor1 end1, Itor2 beg2, T initValue)
 Compute inner product of two ranges.
 
template<class Itor1 , class Itor2 , class T , class BinaryFunc1 , class BinaryFunc2 >
T inner_product (Itor1 beg1, Itor1 end1, Itor2 beg2, T initValue, BinaryFunc1 op1, BinaryFunc2 op2)
 Compute inner product with custom operations.
 
template<class Itor1 , class Itor2 >
Itor2 partial_sum (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg)
 Compute partial sums of a range.
 
template<class Itor1 , class Itor2 , class BinaryFunc >
Itor2 partial_sum (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg, BinaryFunc op)
 Compute partial sums with custom operation.
 
template<class Itor1 , class Itor2 >
Itor2 adjacent_difference (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg)
 Compute adjacent differences.
 
template<class Itor1 , class Itor2 , class BinaryFunc >
Itor2 adjacent_difference (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg, BinaryFunc op)
 Compute adjacent differences with custom operation.
 
void message (const char *file, int line, const char *format,...)
 Print an informational message with file and line info.
 
void error (const char *file, int line, const char *format,...)
 Print an error message with file and line info.
 
void exit (const char *file, int line, const char *format,...)
 Print a message and exit the program.
 
void warning (const char *file, int line, const char *format,...)
 Print a warning message with file and line info.
 
void syslog (const char *format, va_list ap)
 Write a message to syslog.
 
template<typename Type >
std::string to_str (const Type &d)
 Converts any streamable value to string.
 
template<typename Key , typename Data >
std::pair< Key, Data > * key_to_pair (Key *ptr)
 Converts a pointer to Key to a pointer to the containing pair.
 
template<typename Key , typename Data >
const std::pair< Key, Data > * key_to_pair (const Key *ptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename Key , typename Data >
std::pair< Key, Data > * data_to_pair (Data *ptr)
 Converts a pointer to Data to a pointer to the containing pair.
 
template<typename Key , typename Data >
const std::pair< Key, Data > * data_to_pair (const Data *ptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class T >
std::ostream & operator<< (std::ostream &osObject, const Field< T > &rightOp)
 
template<class _Predicate >
unary_negate< _Predicate > not1 (const _Predicate &__pred)
 
template<class _Predicate >
binary_negate< _Predicate > not2 (const _Predicate &__pred)
 
template<class _Operation , class _Tp >
binder1st< _Operation > bind1st (const _Operation &__fn, const _Tp &__x)
 
template<class _Operation , class _Tp >
binder2nd< _Operation > bind2nd (const _Operation &__fn, const _Tp &__x)
 
template<class _Arg , class _Result >
pointer_to_unary_function< _Arg, _Result > ptr_fun (_Result(*__x)(_Arg))
 
template<class _Arg1 , class _Arg2 , class _Result >
pointer_to_binary_function< _Arg1, _Arg2, _Result > ptr_fun (_Result(*__x)(_Arg1, _Arg2))
 
template<class _Ret , class _Tp >
mem_fun_t< _Ret, _Tp > mem_fun (_Ret(_Tp::*__f)())
 
template<class _Ret , class _Tp >
const_mem_fun_t< _Ret, _Tp > mem_fun (_Ret(_Tp::*__f)() const)
 
template<class _Ret , class _Tp >
mem_fun_ref_t< _Ret, _Tp > mem_fun_ref (_Ret(_Tp::*__f)())
 
template<class _Ret , class _Tp >
const_mem_fun_ref_t< _Ret, _Tp > mem_fun_ref (_Ret(_Tp::*__f)() const)
 
template<class _Ret , class _Tp , class _Arg >
mem_fun1_t< _Ret, _Tp, _Arg > mem_fun (_Ret(_Tp::*__f)(_Arg))
 
template<class _Ret , class _Tp , class _Arg >
const_mem_fun1_t< _Ret, _Tp, _Arg > mem_fun (_Ret(_Tp::*__f)(_Arg) const)
 
template<class _Ret , class _Tp , class _Arg >
mem_fun1_ref_t< _Ret, _Tp, _Arg > mem_fun_ref (_Ret(_Tp::*__f)(_Arg))
 
template<class _Ret , class _Tp , class _Arg >
const_mem_fun1_ref_t< _Ret, _Tp, _Arg > mem_fun_ref (_Ret(_Tp::*__f)(_Arg) const)
 
template<class T , class Compare >
bool less_than (const T &op1, const T &op2, Compare &cmp)
 Determines if op1 is less than op2 using a comparison operator.
 
template<class T , class Compare >
bool less_than (const T &op1, const T &op2, Compare &&cmp=Compare())
 See less_than().
 
template<class T , class Compare >
bool less_or_equal_than (const T &op1, const T &op2, Compare &cmp)
 Determines if op1 is less than or equal to op2 using a comparison operator.
 
template<class T , class Compare >
bool less_or_equal_than (const T &op1, const T &op2, Compare &&cmp=Compare())
 See less_or_equal_than().
 
template<class T , class Compare >
bool greater_than (const T &op1, const T &op2, Compare &&cmp=Compare())
 Determines if op1 is greater than op2 using a comparison operator.
 
template<class T , class Compare >
bool greater_than (const T &op1, const T &op2, Compare &cmp)
 See greater_than().
 
template<class T , class Compare >
bool greater_or_equal_than (const T &op1, const T &op2, Compare &&cmp=Compare())
 Determines if op1 is greater than or equal to op2 using a comparison operator.
 
template<class T , class Compare >
bool greater_or_equal_than (const T &op1, const T &op2, Compare &cmp)
 See greater_or_equal_than().
 
template<class T , class Compare >
bool no_equals (const T &op1, const T &op2, Compare &&cmp=Compare())
 Determines if operands are not equal using a comparison operator.
 
template<class T , class Compare >
bool no_equals (const T &op1, const T &op2, Compare &cmp)
 See no_equals().
 
template<class T , class Compare >
bool are_equals (const T &op1, const T &op2, Compare &&cmp=Compare())
 Determines if operands are equal using a comparison operator.
 
template<class T , class Compare >
bool are_equals (const T &op1, const T &op2, Compare &cmp)
 See are_equals().
 
template<typename T = int, template< typename > class Container = DynList>
Container< T > range (const T start, const T end, const T step=1)
 Generate a range of values [start, end] with a given step.
 
template<typename T = int, template< typename > class Container = DynList>
Container< T > nrange (const T start, const T end, const size_t n)
 Generate exactly n values evenly spaced between [start, end].
 
template<typename T = int, template< typename > class Container = DynList, class Op >
auto set_range (const T start, const T end, const T step, Op &op) -> Container< std::decay_t< decltype(op(start))> >
 Generate a range [start, end] and apply an operation to each value.
 
template<typename T = int, template< typename > class Container = DynList, class Op >
auto set_range (const T start, const T end, const T step=1, Op &&op=Op()) -> Container< std::decay_t< decltype(op(start))> >
 Overload of set_range.
 
template<typename T = int, template< typename > class Container = DynList>
Container< T > contiguous_range (T start, const size_t n)
 Generate n contiguous values starting from start.
 
template<typename T = int, template< typename > class Container = DynList>
Container< T > range (const T n)
 Return a range 0, 1, ... n - 1.
 
template<typename T = int>
DynList< T > rep (const size_t n, const T &item)
 Create a sequence of repeated items.
 
template<typename T = int>
DynList< T > rep (const size_t n, T &&item=T())
 Overload of rep.
 
template<AlephSequentialContainer C>
void fill (C &container, const typename C::Item_Type &value)
 Fill all elements of a container with a fixed value.
 
template<AlephSequentialContainer C>
requires requires(typename C::Item_Type v) { ++v; }
void iota (C &container, typename C::Item_Type start)
 Fill all elements of a container with unit-step sequential values.
 
template<AlephSequentialContainer C>
requires requires(typename C::Item_Type v, typename C::Item_Type s) { v += s; }
void iota (C &container, typename C::Item_Type start, const typename C::Item_Type step)
 Fill all elements of a container with custom-step sequential values.
 
template<class Container >
DynList< typename Container::Item_Type * > pointers_list (Container &c)
 Create a list of pointers to items in a container.
 
template<class Container >
DynList< const typename Container::Item_Type * > pointers_list (const Container &c)
 Const container overload.
 
template<class Op >
requires CallableWith<Op &>
void each (const size_t start, const size_t end, Op &op)
 Execute an operation repeatedly over a range of indices.
 
template<class Op >
requires CallableWith<Op &>
void each (size_t start, size_t end, Op &&op)
 Overload of each.
 
template<class Op >
requires CallableWith<Op &>
void each (const size_t n, Op &op)
 Overload of each.
 
template<class Op >
requires CallableWith<Op &>
void each (size_t n, Op &&op)
 Overload of each.
 
template<class Container >
DynList< typename Container::Item_Type > sublist (const Container &c, size_t pos, const size_t stride)
 Extract a sublist using a stride.
 
template<class Container >
DynList< typename Container::Item_Type > sublist (const Container &c, size_t stride)
 Overload of sublist from start.
 
template<class Container , class Operation >
Container & for_each (Container &container, Operation &operation)
 Apply an operation to each element in a container.
 
template<class Container , class Operation >
const Container & for_each (const Container &container, Operation &operation)
 Overload of for_each.
 
template<class Container , class Operation >
Container & for_each (Container &container, Operation &&operation=Operation())
 Overload of for_each.
 
template<class Container , class Operation >
const Container & for_each (const Container &container, Operation &&operation=Operation())
 Overload of for_each.
 
template<class Container , class Operation >
requires CallableWith<Operation &, functional_detail::get_curr_t<Container>, std::size_t &>
void enum_for_each (const Container &container, Operation &operation)
 Apply an operation to each element and its index.
 
template<class Container , class Operation >
requires CallableWith<Operation &, functional_detail::get_curr_t<Container>, std::size_t &>
void enum_for_each (const Container &container, Operation &&operation)
 Overload of enum_for_each.
 
template<class Container , class Operation >
requires requires(Container &c, Operation &op) { { c.traverse(op) } -> std::convertible_to<bool>; }
bool all (Container &container, Operation &operation)
 Return true if all elements satisfy a predicate.
 
template<class Container , class Operation >
requires requires(const Container &c, Operation &op) { { c.template traverse<Operation>(op) } -> std::convertible_to<bool>; }
bool all (const Container &container, Operation &operation)
 Overload of all.
 
template<class Container , class Operation >
requires requires(Container &c, Operation &op) { { c.traverse(op) } -> std::convertible_to<bool>; }
bool all (Container &container, Operation &&operation=Operation())
 Overload of all.
 
template<class Container , class Operation >
requires requires(const Container &c, Operation &op) { { c.template traverse<Operation>(op) } -> std::convertible_to<bool>; }
bool all (const Container &container, Operation &&operation=Operation())
 Overload of all.
 
template<class Container , class Operation >
bool exists (Container &container, Operation &operation)
 Return true if at least one element satisfies a predicate.
 
template<class Container , class Operation >
bool exists (const Container &container, Operation &operation)
 Overload of exists.
 
template<class Container , class Operation >
bool exists (Container &container, Operation &&operation=Operation())
 Overload of exists.
 
template<class Container , class Operation >
bool exists (const Container &container, Operation &&operation=Operation())
 Overload of exists.
 
template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > filter (Container1 &container, Operation &operation)
 Filter elements that satisfy operation.
 
template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > filter (const Container1 &container, Operation &operation)
 Overload of filter.
 
template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > filter (Container1 &container, Operation &&operation)
 Overload of filter.
 
template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > filter (const Container1 &container, Operation &&operation)
 Overload of filter.
 
template<typename T , class C , class Op >
requires requires(DynList<T> &ret, Op &op) { ret.append(op(std::declval<functional_detail::get_curr_t<C>>())); }
DynList< T > maps (const C &c, Op op)
 Classic map operation.
 
template<typename T , class Container , class Operation >
T foldl (const Container &container, const T &init, Operation operation)
 Classic left fold (reduce).
 
template<class Container1 , class Container2 >
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > zip (const Container1 &a, const Container2 &b)
 Zip two containers into a list of pairs.
 
template<class Container1 , class Container2 >
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > tzip (const Container1 &a, const Container2 &b)
 Zip two containers into a list of tuples.
 
template<class Container1 , class Container2 >
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > zipEq (const Container1 &a, const Container2 &b)
 Zip two containers; throw if lengths differ.
 
template<class Container1 , class Container2 >
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > tzipEq (const Container1 &a, const Container2 &b)
 Zip two containers into tuples; throw if lengths differ.
 
template<class Container >
auto enumerate (const Container &c)
 Return pairs of (element, index).
 
template<class C1 , class C2 , class Eq = std::equal_to<typename C1::Item_Type>>
bool eq (const C1 &c1, const C2 &c2, Eq e=Eq())
 Check equality of two containers using a predicate.
 
template<typename T >
bool operator== (const DynList< T > &l1, const DynList< T > &l2)
 Equality operator for DynList.
 
template<class C1 , class C2 , class Eq >
bool containers_eq (const C1 &c1, const C2 &c2, Eq e)
 See eq.
 
template<class C1 , class C2 , class Eq = std::equal_to<typename C1::Item_Type>>
std::tuple< bool, size_t, typename C1::Item_Type, typename C2::Item_Type > are_eq (const C1 &c1, const C2 &c2, Eq e=Eq())
 Detailed equality check returning mismatch position and values.
 
template<class C1 , class C2 , class Cmp = std::less<typename C1::Item_Type>>
bool lesser (const C1 &c1, const C2 &c2, Cmp cmp=Cmp())
 Lexicographical comparison between two containers.
 
template<class C1 , class C2 , class Eq = std::equal_to<typename C1::Item_Type>>
bool diff (const C1 &c1, const C2 &c2, Eq e=Eq())
 Check if two containers differ.
 
template<class Container >
auto unzip (const Container &l)
 Separate a list of pairs into two lists.
 
template<template< typename > class Container, typename T1 , typename T2 >
std::tuple< Container< T1 >, Container< T2 > > tunzip (const Container< std::tuple< T1, T2 > > &l)
 Separate a list of tuples into two containers.
 
template<class SrcContainer , template< typename > class TgtContainer = Aleph::DynList>
std::pair< TgtContainer< typename SrcContainer::Item_Type >, TgtContainer< typename SrcContainer::Item_Type > > partition (const SrcContainer &c, std::function< bool(const typename SrcContainer::Item_Type &)> operation)
 Partition a container into two based on a predicate.
 
template<class Container >
DynList< std::pair< size_t, typename Container::Key_Type > > indexes (const Container &c)
 Return pairs of (index, key).
 
template<class Container >
DynList< std::tuple< size_t, typename Container::Key_Type > > tindexes (const Container &c)
 Return tuples of (index, key).
 
template<typename T , template< typename > class Container>
Container< T > reverse (const Container< T > &l)
 Return a reversed copy of the container.
 
template<class Container >
auto gen_seq_list_tuples (const Container &c, size_t n)
 Generate all sequential tuples (sliding windows) of size n.
 
template<typename T , template< typename > class Container, class Equal >
std::pair< DynList< DynList< T > >, size_t > sequential_groups (const Container< T > &c, Equal &eq)
 Group consecutive equal elements together.
 
template<typename T , template< typename > class Container, class Equal = std::equal_to<T>>
std::pair< DynList< DynList< T > >, size_t > sequential_groups (const Container< T > &c, Equal &&eq=Equal())
 Overload of sequential_groups.
 
template<typename T , template< typename > class Container, class Equal >
std::pair< DynList< T >, size_t > unique_sequential (const Container< T > &c, Equal &eq)
 Extract unique consecutive items.
 
template<typename T , template< typename > class Container, class Equal = std::equal_to<T>>
std::pair< DynList< T >, size_t > unique_sequential (const Container< T > &c, Equal &&eq=Equal())
 Overload of unique_sequential.
 
template<class C1 , class C2 >
auto get_pair_it (C1 &c1, C2 &c2)
 Create a Pair_Iterator for two containers.
 
template<class C1 , class C2 >
auto get_pair_it (C1 &c1, C2 &c2, const size_t pos)
 Overload of get_pair_it with start position.
 
template<class C , typename... Args>
size_t insert_in_container (C &c, Args &&... args)
 Insert multiple items into a container.
 
template<class C , typename... Args>
size_t append_in_container (C &c, Args &&... args)
 Append multiple items into a container.
 
template<class C , typename... Args>
C build_container (Args &&... args)
 Build a container with the given items.
 
template<class SrcC , class TgtC >
TgtC assign_container (const SrcC &srcc)
 Convert one container type to another.
 
template<typename T , typename... Args>
DynList< T > build_dynlist (Args &&... args)
 Build a DynList with the given items; an rvalue is moved.
 
template<class C , typename... Args>
size_t remove_from_container (C &c, Args... args)
 Remove multiple items from a container.
 
template<typename T , template< typename > class Container>
DynList< T > join (const Container< T > &c1, const Container< T > &c2)
 Return union of two containers as a DynList (no duplicates).
 
template<typename T , template< typename > class Container>
DynList< T > intercept (const Container< T > &c1, const Container< T > &c2)
 Return intersection of two containers as a DynList.
 
template<typename T , template< typename > class Container>
DynList< T > unique (const Container< T > &c)
 Return elements that appear exactly once across the container.
 
template<typename T , template< typename > class Container>
DynList< T > repeated (const Container< T > &c)
 Return elements that appear more than once in the container.
 
template<typename T , template< typename > class Container>
DynList< std::pair< T, size_t > > repeated_with_index (const Container< T > &c)
 Return repeated elements paired with their occurrence count.
 
template<typename T , template< typename > class C1, template< typename > class C2>
DynList< T > flatten (const C2< C1< T > > &c)
 Flatten a nested container of one level.
 
template<typename T , template< typename > class C1, template< typename > class C2, template< typename > class C3>
DynList< T > flatten (const C3< C2< C1< T > > > &c)
 Flatten a nested container of two levels.
 
template<typename T , template< typename > class C1, template< typename > class C2, template< typename > class C3, template< typename > class C4>
DynList< T > flatten (const C4< C3< C2< C1< T > > > > &c)
 Flatten a nested container of three levels.
 
template<typename T , template< typename > class C1, template< typename > class C2, template< typename > class C3, template< typename > class C4, template< typename > class C5>
DynList< T > flatten (const C5< C4< C3< C2< C1< T > > > > > &c)
 Flatten a nested container of four levels.
 
template<typename T >
bool is_inside (const T &val, const DynList< T > &values)
 Check if a value is present in a list.
 
template<typename T >
bool is_equal (const T &val)
 Variadic check for equality against multiple values.
 
template<typename T , typename U , typename... Args>
bool is_equal (const T &val, const U &rhs, const Args &...args)
 Overload of is_equal.
 
template<class Container , class Operation >
bool none (const Container &container, Operation &operation)
 Return true if no element satisfies operation.
 
template<class Container , class Operation >
bool none (const Container &container, Operation &&operation=Operation())
 Overload of none.
 
template<class Container , class Pred >
Container::Item_Type * find_ptr (Container &container, Pred &pred)
 Find the first element satisfying pred.
 
template<class Container , class Pred >
const Container::Item_Type * find_ptr (const Container &container, Pred &pred)
 Overload of find_ptr.
 
template<class Container , class Pred >
Container::Item_Type * find_ptr (Container &container, Pred &&pred)
 Overload of find_ptr.
 
template<class Container , class Pred >
const Container::Item_Type * find_ptr (const Container &container, Pred &&pred)
 Overload of find_ptr.
 
template<class Container , class Pred >
std::optional< typename Container::Item_Type > find_opt (const Container &container, Pred &pred)
 Find the first element satisfying pred (safe version).
 
template<class Container , class Pred >
std::optional< typename Container::Item_Type > find_opt (const Container &container, Pred &&pred)
 Overload of find_opt.
 
template<typename T , class Container , class Operation >
requires requires(T &acc, Operation &op, T &x) { acc = op(x, acc); }
T foldr (const Container &container, const T &init, Operation operation)
 Right fold (reduce).
 
template<class Container , typename T = typename Container::Item_Type>
T sum (const Container &container, const T &init=T{})
 Compute sum of all elements.
 
template<class Container , typename T = typename Container::Item_Type>
T product (const Container &container, const T &init=T{1})
 Compute product of all elements.
 
template<class C1 , class C2 >
DynList< typename C1::Item_Type > concat (const C1 &c1, const C2 &c2)
 Concatenate two containers into a new DynList.
 
template<class Container , class Pred >
requires PredicateWith<Pred &, functional_detail::get_curr_cref_t<Container>>
DynList< typename Container::Item_Type > take_while (const Container &c, Pred pred)
 Return elements while predicate is true (take_while).
 
template<class Container , class Pred >
requires PredicateWith<Pred &, functional_detail::get_curr_cref_t<Container>>
DynList< typename Container::Item_Type > drop_while (const Container &c, Pred pred)
 Skip elements while predicate is true (drop_while).
 
template<class Container , class Op >
auto flat_map (const Container &container, Op op) -> DynList< typename std::decay_t< decltype(op(std::declval< typename Container::Item_Type >()))>::Item_Type >
 Apply operation and flatten results (flatMap/concatMap).
 
template<typename T , class Container >
DynList< T > scanl_sum (const Container &container, const T &init)
 Compute running sums (scanl with addition).
 
template<typename T , class Container , class Op >
requires requires(T &acc, Op &op) { acc = op(acc, std::declval<functional_detail::get_curr_t<Container>>()); }
DynList< T > scanl (const Container &container, const T &init, Op op)
 Prefix scan with custom operation.
 
template<class Container , class Cmp = std::less<typename Container::Item_Type>>
requires PredicateWith<Cmp &, functional_detail::get_curr_cref_t<Container>, const typename Container::Item_Type &>
const Container::Item_Type * min_ptr (const Container &container, Cmp cmp=Cmp())
 Find the minimum element in a container.
 
template<class Container , class Cmp = std::less<typename Container::Item_Type>>
requires PredicateWith<Cmp &, const typename Container::Item_Type &, functional_detail::get_curr_cref_t<Container>>
const Container::Item_Type * max_ptr (const Container &container, Cmp cmp=Cmp())
 Find the maximum element in a container.
 
template<class Container , class Cmp = std::less<typename Container::Item_Type>>
requires PredicateWith<Cmp &, functional_detail::get_curr_cref_t<Container>, const typename Container::Item_Type &>
and PredicateWith< Cmp &, const typename Container::Item_Type &, functional_detail::get_curr_cref_t< Container > > std::pair< const typename Container::Item_Type *, const typename Container::Item_Type * > minmax_ptr (const Container &container, Cmp cmp=Cmp())
 Find both min and max elements in a single pass.
 
template<class Container , class Pred >
requires PredicateWith<Pred &, functional_detail::get_curr_t<Container>>
size_t count_if (const Container &container, Pred pred)
 Count elements satisfying a predicate.
 
template<AlephSequentialIterableContainer Container, class Equal >
bool all_unique (const Container &container, Equal &eq)
 Check if all elements in a container are unique using a comparator.
 
template<AlephSequentialIterableContainer Container, class Equal = std::equal_to<typename Container::Item_Type>>
bool all_unique (const Container &container, Equal &&eq=Equal())
 Check if all elements in a container are unique using an rvalue/lvalue comparator.
 
bool all_unique (const Container &container, Hash &hash, Equal &eq)
 
bool all_unique (const Container &container, Hash &&hash, Equal &&eq)
 See all_unique(container, hash, eq).
 
template<class Container >
bool contains (const Container &container, const typename Container::Item_Type &value)
 Check if container contains a specific value.
 
template<class Container >
DynList< std::tuple< size_t, typename Container::Item_Type > > enumerate_tuple (const Container &container)
 Zip containers with an index (enumerate with zip).
 
template<class Container1 , class Container2 >
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > zip_longest (const Container1 &a, const Container2 &b, const typename Container1::Item_Type &fill_a=typename Container1::Item_Type(), const typename Container2::Item_Type &fill_b=typename Container2::Item_Type())
 Zip two containers, padding the shorter one with a fill value.
 
template<class Container1 , class Container2 >
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > tzip_longest (const Container1 &a, const Container2 &b, const typename Container1::Item_Type &fill_a=typename Container1::Item_Type(), const typename Container2::Item_Type &fill_b=typename Container2::Item_Type())
 Zip two containers into tuples, padding the shorter one.
 
template<class Container1 , class Container2 >
DynList< std::pair< std::optional< typename Container1::Item_Type >, std::optional< typename Container2::Item_Type > > > zip_longest_opt (const Container1 &a, const Container2 &b)
 Zip two containers using optionals for missing values.
 
template<typename T , template< typename > class Container, class KeyFunc >
DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, DynList< T > > > group_by (const Container< T > &c, KeyFunc key_func)
 Group consecutive elements by a key function.
 
template<typename T , template< typename > class Container, class KeyFunc , class KeyEqual >
DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, DynList< T > > > group_by_eq (const Container< T > &c, KeyFunc key_func, KeyEqual key_equal)
 Group consecutive elements by a key function with custom equality.
 
template<typename T , template< typename > class Container, class KeyFunc , class Reducer >
auto group_by_reduce (const Container< T > &c, KeyFunc key_func, Reducer reducer) -> DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, std::invoke_result_t< Reducer, const DynList< T > & > > >
 Group consecutive elements and apply a reducer to each group.
 
void * allocate (const std::size_t size)
 Allocate size bytes using the C heap.
 
void * allocate_zeroed (const std::size_t size)
 Allocate size zero-initialized bytes.
 
void deallocate (void *ptr) noexcept
 Release memory previously obtained through Aleph allocation helpers.
 
 List_Sort (DynList)
 
 List_Sort (DynDlist)
 
template<typename T , class Cmp = Aleph::less<T>>
DynArray< T > sort (const DynArray< T > &a, Cmp &&cmp=Cmp())
 Returns a sorted copy of a DynArray.
 
template<typename T , class Cmp = Aleph::less<T>>
DynArray< T > sort (DynArray< T > &&a, Cmp &&cmp=Cmp())
 Sorts an rvalue DynArray in place and returns it.
 
template<typename T , class Cmp = Aleph::less<T>>
Array< T > sort (const Array< T > &a, Cmp &&cmp=Cmp())
 Returns a sorted copy of an Array.
 
template<typename T , class Cmp = Aleph::less<T>>
Array< T > sort (Array< T > &&a, Cmp &&cmp=Cmp())
 Sorts an rvalue Array in place and returns it.
 
template<typename Container , class Cmp = std::less<typename Container::value_type>>
Container stdsort (const Container &c, Cmp cmp=Cmp())
 Sorts an STL-compatible container using std::sort.
 
template<typename T , class Cmp = Aleph::less<T>>
DynArray< T > & in_place_sort (DynArray< T > &c, Cmp cmp=Cmp())
 Sorts a DynArray in place.
 
template<typename T , class Cmp = Aleph::less<T>>
Array< T > & in_place_sort (Array< T > &c, Cmp cmp=Cmp())
 Sorts an Array in place.
 
template<class C , class Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > argsort (const C &a, const Compare &cmp=Compare())
 Return indices that visit an array-like container in sorted order.
 
template<class C , class Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > stable_argsort (const C &a, const Compare &cmp=Compare())
 Return stable sorted-order indices for an array-like container.
 
template<typename T >
Array< size_t > ranks (const Array< T > &array)
 Computes the rank of each element in an Array.
 
template<typename T >
DynArray< size_t > ranks (const DynArray< T > &array)
 Computes the rank of each element in a DynArray.
 
template<typename T >
DynArray< size_t > ranks (const DynList< T > &l)
 Computes the rank of each element in a DynList.
 
template<typename T >
DynArray< size_t > ranks (const DynDlist< T > &l)
 Computes the rank of each element in a DynDlist.
 
template<typename T >
auto pair_ranks (const Array< T > &c)
 Computes (value, rank) pairs for each element in an Array.
 
template<typename T >
auto pair_ranks (const DynArray< T > &c)
 Computes (value, rank) pairs for each element in a DynArray.
 
template<typename T >
auto pair_ranks (const DynList< T > &l)
 Computes (value, rank) pairs for each element in a DynList.
 
template<typename T >
auto pair_ranks (const DynDlist< T > &l)
 Computes (value, rank) pairs for each element in a DynDlist.
 
template<typename C , typename... Args, typename Cmp = std::less<typename C::value_type>>
void in_place_multisort_arrays (Cmp cmp, const bool stable, C &first, Args &... args)
 Sorts multiple arrays in place, using the first array as the key.
 
template<typename C , typename... Args, typename Cmp = std::less<typename C::value_type>>
void in_place_multisort_arrays (Cmp cmp, C &first, Args &... args)
 
template<typename T >
bool is_primitive_type ()
 Check if type T is a primitive C++ type.
 
template<>
bool is_primitive_type< char > ()
 
template<>
bool is_primitive_type< unsigned char > ()
 
template<>
bool is_primitive_type< short > ()
 
template<>
bool is_primitive_type< unsigned short > ()
 
template<>
bool is_primitive_type< int > ()
 
template<>
bool is_primitive_type< unsigned int > ()
 
template<>
bool is_primitive_type< long > ()
 
template<>
bool is_primitive_type< unsigned long > ()
 
template<>
bool is_primitive_type< long long > ()
 
template<>
bool is_primitive_type< unsigned long long > ()
 
template<>
bool is_primitive_type< float > ()
 
template<>
bool is_primitive_type< double > ()
 
template<>
bool is_primitive_type< long double > ()
 
template<class T >
T & swap (T &t1, T &t2)
 Generic swap using object's swap method.
 
template<>
char & swap< char > (char &t1, char &t2)
 
template<>
unsigned char & swap< unsigned char > (unsigned char &t1, unsigned char &t2)
 
template<>
short & swap< short > (short &t1, short &t2)
 
template<>
unsigned short & swap< unsigned short > (unsigned short &t1, unsigned short &t2)
 
template<>
int & swap< int > (int &t1, int &t2)
 
template<>
unsigned int & swap< unsigned int > (unsigned int &t1, unsigned int &t2)
 
template<>
long & swap< long > (long &t1, long &t2)
 
template<>
unsigned long & swap< unsigned long > (unsigned long &t1, unsigned long &t2)
 
template<>
long long & swap< long long > (long long &t1, long long &t2)
 
template<>
unsigned long long & swap< unsigned long long > (unsigned long long &t1, unsigned long long &t2)
 
template<>
float & swap< float > (float &t1, float &t2)
 
template<>
double & swap< double > (double &t1, double &t2)
 
template<>
long double & swap< long double > (long double &t1, long double &t2)
 
template<class T , class Compare = Aleph::less<T>>
const T * median (const T &a, const T &b, const T &c, const Compare &cmp=Compare())
 Return a pointer to the median value among three elements.
 
bool is_even (const long n)
 Return true if n is even.
 
bool is_odd (const long n)
 Return true if n is odd.
 
char nibble_to_char (const int i)
 Convert a 4-bit nibble stored in an int to its hex character.
 
int char_to_nibble (const char c)
 Convert a hex character in 0..9A..F to its 4-bit nibble value.
 
bool resize_process_stack (size_t new_size)
 Resize the process stack to new_size.
 
constexpr size_t u_index (const size_t &i)
 Map a binary heap index to the index of its parent.
 
constexpr size_t l_index (const size_t i)
 Map a binary heap index to the index of its left child.
 
bool is_power_of_2 (size_t x)
 Taken from http://stackoverflow.com/questions/3638431/determine-if-an-int-is-a-power-of-2-or-not-in-a-single-line.
 
size_t next_power_of_2 (size_t x)
 Return the smallest power of 2 that is not less than x.
 
std::string demangle (const char *name)
 Given a linker symbol name generated by a c++ compiler, this functions decodes it into a user level name.
 
void error_msg (const std::string &msg)
 Display message and abort program execution.
 
bool exists_file (const std::string &name)
 Return true if it exists a file of name
 
template<class C >
std::string Rvector (const std::string &name, const C &c)
 Return a string with R specification of a vector with name and data stored in container c
 
template<class C >
std::string Rvector (const C &c)
 Return a string with an R assignment for a container interpreted as [name, value1, value2, ...].
 
double interpolate (const double x1, const double x2, const double y1, const double y2, const double x)
 Basic linear interpolation.
 
double extrapolate_left (const double x1, const double x2, const double y1, const double y2, const double x)
 Basic linear extrapolation.
 
double pow2 (const double x)
 Return x^2.
 
double pow3 (const double x)
 Return x^3.
 
double extrapolate_right (const double x1, const double x2, const double y1, const double y2, const double x)
 Basic linear extrapolation.
 
double next_value (const double val)
 Return the next representable floating-point value to val
 
double prev_value (const double val)
 Return the next representable floating-point value of val towards the smallest positive normal number.
 
constexpr bool are_near (const double v1, const double v2, const double e) noexcept
 Return true if v1 is within absolute distance e of v2.
 
void execute_R_script (const std::string &scr, const std::string &file_name="tmp.R")
 Generate and execute a R script from a string (containing the script)
 
bool is_normal_number (const double n)
 Return true if a floating-point number is normal or zero.
 
template<typename T >
requires AlOrderedDomainKey<T>
and AlStreamable< T > std::ostream & operator<< (std::ostream &s, const AlDomain< T > &dom)
 Output stream operator for AlDomain.
 
template<typename Trow , typename Tcol , typename NumType >
requires AlMultiplicativeNumber<NumType>
Matrix< Trow, Tcol, NumType > operator* (const NumType &scalar, const Matrix< Trow, Tcol, NumType > &m)
 Scalar-matrix multiplication (scalar * matrix).
 
template<typename Trow , typename Tcol , typename NumType >
requires AlAdditiveNumber<NumType>
and AlMultiplicativeNumber< NumType > Vector< Tcol, NumType > operator* (const Vector< Trow, NumType > &vec, const Matrix< Trow, Tcol, NumType > &m)
 Vector-matrix multiplication (vector * matrix).
 
template<typename Trow , typename Tcol , typename NumType >
requires AlOrderedDomainKey<Trow>
and AlOrderedDomainKey< Tcol > and AlStreamable< Trow > and AlStreamable< Tcol > and AlStreamable< NumType > std::ostream & operator<< (std::ostream &s, const Matrix< Trow, Tcol, NumType > &m)
 Stream output operator for Matrix.
 
template<typename Trow , typename Tcol , typename NumType = double>
requires AlMultiplicativeNumber<NumType>
Matrix< Trow, Tcol, NumType > outer_product (const Vector< Trow, NumType > &v1, const Vector< Tcol, NumType > &v2)
 Compute the outer product of two vectors.
 
template<typename T , typename NumType >
requires AlMultiplicativeNumber<NumType>
Vector< T, NumType > operator* (const NumType &scalar, const Vector< T, NumType > &v)
 The vector v multiplied by scalar.
 
std::ostream & operator<< (std::ostream &s, const Vector< T, NumType > &vec)
 
template<AdversarialGameDomain Domain>
auto alpha_beta_search (Domain domain, typename Domain::State initial_state, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for one-shot Alpha-Beta search.
 
template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto alpha_beta_search (Domain domain, typename Domain::State initial_state, Tracer &tracer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for one-shot Alpha-Beta search with tracing.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Alpha-Beta search with transposition table.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, Tracer &tracer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Alpha-Beta search with TT/keyer and tracing.
 
template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Alpha-Beta search with domain-provided state key.
 
template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, Tracer &tracer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Alpha-Beta search with domain-provided key and tracing.
 
template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto iterative_deepening_alpha_beta_search (Domain domain, typename Domain::State initial_state, Tracer &tracer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Alpha-Beta with optional aspiration windows.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto iterative_deepening_alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, Tracer &tracer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Alpha-Beta with TT/keyer reuse.
 
template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto iterative_deepening_alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, Tracer &tracer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Alpha-Beta using domain.state_key().
 
template<AdversarialGameDomain Domain>
auto iterative_deepening_alpha_beta_search (Domain domain, typename Domain::State initial_state, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Alpha-Beta without tracing.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto iterative_deepening_alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Alpha-Beta with TT/keyer reuse and no tracing.
 
template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto iterative_deepening_alpha_beta_search (Domain domain, typename Domain::State initial_state, Table &table, ExplorationPolicy policy=Alpha_Beta< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Alpha-Beta using domain.state_key() and no tracing.
 
template<typename T >
Array_Iterator< T > get_array_it (const T *array, size_t n)
 Create an iterator for a raw array.
 
template<typename T >
Array_Container< T > make_array_container (T *array, size_t n)
 Create an Array_Container from a raw array.
 
template<class Tarray >
void open_gap (Tarray &ptr, size_t n, size_t pos=0, size_t num_entries=1)
 Open a gap in an array by shifting elements right.
 
template<typename T >
void close_gap (T *ptr, size_t n, size_t pos, size_t num_entries=1)
 Close a gap in an array by shifting elements left.
 
template<typename T >
void reverse (T *ptr, const size_t n) noexcept
 Reverse an array in-place.
 
template<typename T >
void rotate_left (T *ptr, const size_t n, size_t m) noexcept
 Rotate array elements left by m positions.
 
template<typename T >
void rotate_right (T *ptr, const size_t n, size_t m) noexcept
 Rotate array elements right by m positions.
 
template<class Node >
int checked_avl_height_rk (Node *p) noexcept
 Height of a ranked AVL subtree, checking all its nodes.
 
template<class Node >
bool is_avl_rk (Node *p)
 Verify if tree rooted at p is a valid AVL tree with correct counters.
 
template<BacktrackingDomain Domain>
auto backtracking_search (Domain domain, typename Domain::State initial_state, ExplorationPolicy policy={}, SearchLimits limits={})
 Convenience wrapper that runs a one-shot DFS/backtracking search.
 
template<BacktrackingDomain Domain, typename OnSolution >
requires SearchSolutionVisitor<OnSolution, SearchSolution<typename Domain::State, typename Domain::Move>>
auto backtracking_search (Domain domain, typename Domain::State initial_state, OnSolution &on_solution, ExplorationPolicy policy={}, SearchLimits limits={})
 Convenience wrapper with a solution callback/collector.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t compute_maximum_cardinality_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
 Computes a maximum cardinality matching in a general graph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t blossom_maximum_cardinality_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
 Alias of compute_maximum_cardinality_general_matching().
 
template<AlephGraph GT, class Weight = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Blossom_Weighted_Result< long long > compute_maximum_weight_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Weight weight=Weight(), SA sa=SA(), const bool max_cardinality=false)
 Compute maximum-weight matching in a general undirected graph.
 
template<AlephGraph GT, class Weight = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Blossom_Weighted_Result< long long > blossom_maximum_weight_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Weight weight=Weight(), SA sa=SA(), const bool max_cardinality=false)
 Alias for compute_maximum_weight_general_matching().
 
template<BranchAndBoundDomain Domain, typename ObjectivePolicy = Maximize_Objective<typename Domain::Objective>>
requires BranchAndBoundObjectivePolicy<ObjectivePolicy, typename Domain::Objective>
auto branch_and_bound_search (Domain domain, typename Domain::State initial_state, ExplorationPolicy policy=Branch_And_Bound< Domain, ObjectivePolicy >::default_policy(), SearchLimits limits={}, ObjectivePolicy objective={})
 Convenience wrapper for one-shot branch and bound.
 
template<BranchAndBoundDomain Domain, typename OnSolution , typename ObjectivePolicy = Maximize_Objective<typename Domain::Objective>>
requires BranchAndBoundObjectivePolicy<ObjectivePolicy, typename Domain::Objective>
and SearchSolutionVisitor< OnSolution, OptimizationSolution< typename Domain::State, typename Domain::Move, typename Domain::Objective > > auto branch_and_bound_search (Domain domain, typename Domain::State initial_state, OnSolution &on_solution, ExplorationPolicy policy=Branch_And_Bound< Domain, ObjectivePolicy >::default_policy(), SearchLimits limits={}, ObjectivePolicy objective={})
 Convenience wrapper for branch and bound with a solution callback.
 
constexpr size_t compiler_bytecode_invalid_id () noexcept
 Returns the sentinel invalid bytecode id.
 
const char * compiler_bytecode_constant_kind_name (const Compiler_Bytecode_Constant_Kind kind) noexcept
 Stable debug name for one constant kind.
 
const char * compiler_bytecode_opcode_name (const Compiler_Bytecode_Opcode opcode) noexcept
 Stable debug name for one bytecode opcode.
 
Compiler_Bytecode_Validation_Report validate_bytecode_function (const Compiler_Bytecode_Function &function, const Compiler_Bytecode_Module *module=nullptr)
 Validates one lowered bytecode function structurally.
 
Compiler_Bytecode_Validation_Report validate_bytecode_module (const Compiler_Bytecode_Module &module)
 Validates all bytecode functions in one module.
 
std::string compiler_dump_bytecode_function (const Compiler_Bytecode_Function *function, const Compiler_Bytecode_Module *module=nullptr, const Compiler_Type_Context *types=nullptr)
 Dumps one lowered bytecode function deterministically.
 
std::string compiler_dump_bytecode_module (const Compiler_Bytecode_Module *module, const Compiler_Type_Context *types=nullptr)
 Dumps all lowered bytecode in one module deterministically.
 
const char * compiler_bytecode_value_kind_name (const Compiler_Bytecode_Value_Kind kind) noexcept
 Stable debug name for one bytecode runtime value kind.
 
const char * compiler_bytecode_completion_kind_name (const Compiler_Bytecode_Completion_Kind kind) noexcept
 Stable debug name for one execution completion kind.
 
bool compiler_bytecode_values_equal (const Compiler_Bytecode_Value &lhs, const Compiler_Bytecode_Value &rhs)
 Returns whether two bytecode values compare equal.
 
std::string compiler_bytecode_value_to_string (const Compiler_Bytecode_Value &value, const Compiler_Bytecode_Module *module=nullptr)
 Renders one bytecode value deterministically.
 
std::string compiler_dump_bytecode_globals (const Compiler_Bytecode_Module *module, const DynArray< Compiler_Bytecode_Value > &globals)
 Dumps the current global state associated with one bytecode module.
 
Source_Span compiler_merge_spans (const Source_Span &lhs, const Source_Span &rhs) noexcept
 Merges two spans from the same source file.
 
const char * compiler_expr_kind_name (const Compiler_Expr_Kind kind) noexcept
 Returns a stable debug name for an expression kind.
 
const char * compiler_stmt_kind_name (const Compiler_Stmt_Kind kind) noexcept
 Returns a stable debug name for a statement kind.
 
const char * compiler_type_expr_kind_name (const Compiler_Type_Expr_Kind kind) noexcept
 Returns a stable debug name for a type-expression kind.
 
const char * compiler_type_decl_kind_name (const Compiler_Type_Decl_Kind kind) noexcept
 Returns a stable debug name for a type-declaration kind.
 
std::string compiler_dump_expr (const Compiler_Expr *expr)
 Dumps an expression subtree in a deterministic text format.
 
std::string compiler_dump_stmt (const Compiler_Stmt *stmt)
 Dumps a statement subtree in a deterministic text format.
 
std::string compiler_dump_import_decl (const Compiler_Import_Decl *decl)
 Dumps an import declaration subtree in a deterministic text format.
 
std::string compiler_dump_type_decl (const Compiler_Type_Decl *decl)
 Dumps a type declaration subtree in a deterministic text format.
 
std::string compiler_dump_function (const Compiler_Function_Decl *fn)
 Dumps a function declaration in a deterministic text format.
 
std::string compiler_dump_module (const Compiler_Module *module)
 Dumps a parsed module in a deterministic text format.
 
Compiler_C_Backend_Emission compiler_emit_c_module (const Compiler_IR_Module *module, const Compiler_C_Backend_Options &options={}, const Compiler_Type_Context *types=nullptr)
 Convenience wrapper that emits one IR module to portable C.
 
constexpr Compiler_CFG_Block_Id compiler_cfg_invalid_block_id () noexcept
 Returns the sentinel value for an invalid block ID.
 
const char * compiler_cfg_terminator_kind_name (const Compiler_CFG_Terminator_Kind kind) noexcept
 Returns a stable string name for a CFG terminator kind.
 
Compiler_CFG_Validation_Report validate_cfg_function (const Compiler_CFG_Function &function)
 Validates one lowered CFG function structurally.
 
Compiler_CFG_Validation_Report validate_cfg_module (const Compiler_CFG_Module &module)
 Validates all CFGs in a lowered module.
 
std::string compiler_dump_cfg_function (const Compiler_CFG_Function *function, const Compiler_Type_Context *types=nullptr)
 Dumps a single CFG function in text format for debugging.
 
std::string compiler_dump_cfg_module (const Compiler_CFG_Module *module, const Compiler_Type_Context *types=nullptr)
 Dumps a complete CFG module in text format for debugging.
 
const char * compiler_dataflow_constant_kind_name (const Compiler_Dataflow_Constant_Kind kind) noexcept
 Returns a stable debug name for one constant-lattice kind.
 
Compiler_Dataflow_Function_Analysis analyze_dataflow_function (const Compiler_IR_Function &function)
 Computes reachability, liveness, definite assignment, and constant propagation for one IR function.
 
Compiler_Dataflow_Validation_Report validate_dataflow_analysis (const Compiler_IR_Function &function, const Compiler_Dataflow_Function_Analysis &analysis)
 Validates structural invariants of a dataflow result against its source function.
 
std::string compiler_dump_dataflow_analysis (const Compiler_IR_Function *function, const Compiler_Dataflow_Function_Analysis &analysis, const Compiler_Type_Context *types=nullptr)
 Produces a deterministic, human-readable dump of a dataflow result.
 
Compiler_Dead_Code_Elimination_Result eliminate_dead_code (const Compiler_IR_Function &function)
 Eliminates unreachable blocks, dead pure instructions, dead local stores, and folds constant-condition branches.
 
Compiler_Dataflow_Validation_Report validate_dead_code_elimination (const Compiler_Dead_Code_Elimination_Result &result, const Compiler_IR_Module *module=nullptr)
 Validates the result of dead-code elimination.
 
const char * compiler_driver_action_name (const Compiler_Driver_Action action) noexcept
 Returns the canonical external spelling for one driver action.
 
bool compiler_parse_driver_action (std::string_view text, Compiler_Driver_Action &action) noexcept
 Parses one canonical driver action spelling.
 
Source_Span compiler_hir_merge_spans (const Source_Span &lhs, const Source_Span &rhs) noexcept
 Merges two spans without depending on the parser-oriented AST layer.
 
const char * compiler_hir_expr_kind_name (const Compiler_HIR_Expr_Kind kind) noexcept
 Returns a stable debug name for an HIR expression kind.
 
const char * compiler_hir_stmt_kind_name (const Compiler_HIR_Stmt_Kind kind) noexcept
 Returns a stable debug name for an HIR statement kind.
 
const char * compiler_hir_constant_kind_name (const Compiler_HIR_Constant_Kind kind) noexcept
 Returns a stable debug name for an HIR constant kind.
 
std::string compiler_dump_hir_expr (const Compiler_HIR_Expr *expr, const Compiler_Type_Context &types)
 Dumps one HIR expression in a deterministic text format.
 
std::string compiler_dump_hir_stmt (const Compiler_HIR_Stmt *stmt, const Compiler_Type_Context &types)
 Dumps one HIR statement in a deterministic text format.
 
std::string compiler_dump_hir_function (const Compiler_HIR_Function *function, const Compiler_Type_Context &types)
 Dumps one HIR function in a deterministic text format.
 
std::string compiler_dump_hir_module (const Compiler_HIR_Module *module, const Compiler_Type_Context &types)
 Dumps one HIR module in a deterministic text format.
 
constexpr size_t compiler_ir_invalid_id () noexcept
 Returns the sentinel invalid IR id.
 
const char * compiler_ir_slot_kind_name (const Compiler_IR_Slot_Kind kind) noexcept
 Stable debug name for one slot kind.
 
const char * compiler_ir_instruction_kind_name (const Compiler_IR_Instruction_Kind kind) noexcept
 Stable debug name for one instruction kind.
 
const char * compiler_ir_terminator_kind_name (const Compiler_IR_Terminator_Kind kind) noexcept
 Stable debug name for one terminator kind.
 
Compiler_IR_Validation_Report validate_ir_function (const Compiler_IR_Function &function, const Compiler_IR_Module *module=nullptr)
 Validates one lowered IR function structurally.
 
Compiler_IR_Validation_Report validate_ir_module (const Compiler_IR_Module &module)
 Validates all functions in one lowered IR module.
 
std::string compiler_dump_ir_function (const Compiler_IR_Function *function, const Compiler_IR_Module *module=nullptr, const Compiler_Type_Context *types=nullptr)
 Dumps one lowered IR function deterministically.
 
std::string compiler_dump_ir_module (const Compiler_IR_Module *module, const Compiler_Type_Context *types=nullptr)
 Dumps all lowered IR in one module deterministically.
 
const char * compiler_module_binding_issue_name (const Compiler_Module_Binding_Issue_Kind kind) noexcept
 Returns the stable debug name for one module-binding issue kind.
 
Compiler_Module_Binding_Result compiler_bind_module_surfaces (const Compiler_Module_Link_Result &linkage)
 Binds linked module surfaces into one deterministic name view.
 
std::string compiler_render_module_bindings (const Compiler_Module_Binding_Result &result)
 Renders one deterministic text artifact for bound module names.
 
const char * compiler_module_linkage_issue_name (const Compiler_Module_Linkage_Issue_Kind kind) noexcept
 Returns the stable debug name for one linkage issue kind.
 
Compiler_Module_Link_Result compiler_link_module_surfaces (const DynArray< Compiler_Module_Descriptor > &descriptors, const DynArray< Compiler_Module_Metadata > &metadata, const DynArray< size_t > &order)
 Links direct-import module surfaces into visible top-level views.
 
std::string compiler_render_module_linkage (const Compiler_Module_Link_Result &result)
 Renders one deterministic text artifact for linked module surfaces.
 
const char * compiler_module_export_kind_name (const Compiler_Module_Export_Kind kind) noexcept
 Returns the stable debug name for one module-export kind.
 
std::string compiler_render_module_metadata (const DynArray< Compiler_Module_Metadata > &modules)
 Renders one deterministic text artifact for module metadata.
 
size_t compiler_emit_module_name_resolution_diagnostic (Diagnostic_Engine &diagnostics, const Source_Span &span, const Compiler_Module_Name_Resolution &resolution, const std::string &code, const std::string &subject)
 Emits one structured diagnostic for a module-name resolution failure.
 
const char * compiler_module_name_filter_name (const Compiler_Module_Name_Filter filter) noexcept
 Returns the stable debug name for one module-name filter.
 
const char * compiler_module_name_resolution_status_name (const Compiler_Module_Name_Resolution_Status status) noexcept
 Returns the stable debug name for one module-name resolution status.
 
Compiler_Module_Name_Resolution compiler_resolve_module_name (const Compiler_Module_Binding_Result &bindings, const std::string_view module_name, const std::string_view symbol_name, const Compiler_Module_Name_Filter filter=Compiler_Module_Name_Filter::Any)
 Resolves one top-level name through reusable per-module bindings.
 
Compiler_Module_Name_Resolution compiler_resolve_module_name (const Compiler_Module_Name_Table &table, const std::string_view module_name, const std::string_view symbol_name, const Compiler_Module_Name_Filter filter=Compiler_Module_Name_Filter::Any)
 Resolves one top-level name through a cached per-module name table.
 
Compiler_Module_Name_Table compiler_build_module_name_table (const Compiler_Module_Binding_Result &bindings)
 Builds one reusable per-module name table from bindings.
 
std::string compiler_render_module_name_table (const Compiler_Module_Name_Table &table)
 Renders one deterministic text artifact for cached module names.
 
const char * compiler_module_resolution_issue_name (const Compiler_Module_Resolution_Issue_Kind kind) noexcept
 Returns the stable debug name of one module-resolution issue kind.
 
std::string compiler_render_module_order (const DynArray< size_t > &order, const DynArray< Compiler_Module_Descriptor > &modules)
 Renders one deterministic text artifact for a module order.
 
Compiler_Module_Resolution_Result compiler_resolve_module_order (const DynArray< Compiler_Module_Descriptor > &modules)
 Resolves one dependency-first order for exact-name module imports.
 
Compiler_Module_Semantic_Environment compiler_build_module_semantic_environment (const Compiler_Module_Name_Table &table)
 Builds one namespace-separated semantic environment from a name table.
 
const Compiler_Module_Semantic_Module * compiler_find_module_semantic_environment (const Compiler_Module_Semantic_Environment &env, const std::string_view module_name) noexcept
 Finds one semantic environment by module name.
 
const Compiler_Module_Bound_Name * compiler_lookup_module_value (const Compiler_Module_Semantic_Environment &env, const std::string_view module_name, const std::string_view symbol_name) noexcept
 Looks up one visible value-namespace binding in a module environment.
 
const Compiler_Module_Bound_Name * compiler_lookup_module_type (const Compiler_Module_Semantic_Environment &env, const std::string_view module_name, const std::string_view symbol_name) noexcept
 Looks up one visible type-namespace binding in a module environment.
 
std::string compiler_render_module_semantic_environment (const Compiler_Module_Semantic_Environment &env)
 Renders one deterministic text artifact for semantic environments.
 
const char * compiler_operator_name (const Compiler_Operator_Kind kind) noexcept
 Returns a stable debug name for one operator kind.
 
Compiler_Operator_Kind compiler_operator_from_token_kind (const Compiler_Token_Kind kind) noexcept
 Maps one reference-frontend token kind into a reusable operator kind.
 
Compiler_Token_Kind compiler_operator_to_token_kind (const Compiler_Operator_Kind kind) noexcept
 Maps one reusable operator kind back into the MVP token kind.
 
bool compiler_operator_is_compound_assignment (const Compiler_Operator_Kind kind) noexcept
 Returns whether kind is one compound-assignment operator.
 
Compiler_Operator_Kind compiler_operator_compound_base (const Compiler_Operator_Kind kind) noexcept
 Returns the arithmetic operator underlying one compound assignment.
 
Compiler_Integer_Result compiler_integer_binary (const Compiler_Operator_Kind op, const long long lhs, const long long rhs) noexcept
 Applies one integer operator of the language to two values.
 
Compiler_Integer_Result compiler_integer_negate (const long long operand) noexcept
 Negates one integer of the language.
 
bool compiler_is_expression_start (const Compiler_Token_Kind kind) noexcept
 Returns whether a token kind can start an expression in the MVP grammar.
 
bool compiler_is_statement_start (const Compiler_Token_Kind kind) noexcept
 Returns whether a token kind can start a statement in the MVP grammar.
 
bool compiler_is_top_level_declaration_start (const Compiler_Token_Kind kind) noexcept
 Returns whether a token kind starts one top-level declaration.
 
std::string compiler_unquote_string_token (const Compiler_Token &token)
 Removes surrounding double quotes from one string-literal token.
 
const char * compiler_symbol_kind_name (const Compiler_Symbol_Kind kind) noexcept
 Returns a stable debug name for a symbol kind.
 
const char * compiler_token_kind_name (Compiler_Token_Kind kind)
 Returns a human-readable name for a token kind.
 
Compiler_Token_Kind classify_compiler_keyword (std::string_view lexeme) noexcept
 Classifies a lexeme as a keyword or Identifier.
 
bool compiler_token_is_keyword (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind a reserved keyword?
 
bool compiler_token_is_literal (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind a literal (number, string, bool, etc.)?
 
bool compiler_token_is_comment (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind a comment?
 
bool compiler_token_is_operator (Compiler_Token_Kind kind) noexcept
 Predicate: Is the kind an operator (arithmetic, logical, etc.)?
 
int compiler_binary_precedence (Compiler_Token_Kind kind) noexcept
 Returns binary precedence for an operator.
 
Compiler_Associativity compiler_binary_associativity (Compiler_Token_Kind kind) noexcept
 Returns binary associativity for an operator.
 
const char * compiler_type_kind_name (const Compiler_Type_Kind kind) noexcept
 Returns a stable debug name for a type kind.
 
const char * compiler_builtin_type_name (const Compiler_Builtin_Type builtin) noexcept
 Returns a stable debug name for a built-in type.
 
template<class GT , class Func >
auto with_clean_cookies (GT &g, Func &&func) -> decltype(func())
 Convenience function to run an algorithm with automatic cookie cleanup.
 
template<class GT , class Func >
auto with_saved_cookies (GT &g, Func &&func) -> decltype(func())
 Convenience function to run an algorithm preserving existing cookies.
 
template<class GT , class Cleanup >
 Scope_Guard (const GT &, Cleanup) -> Scope_Guard< GT, Cleanup >
 Deduction guide for Scope_Guard.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< std::pair< typename GT::Node *, typename GT::Node * > > compute_dominators (GT &g, typename GT::Node *root, SA sa=SA())
 Compute immediate dominators of a digraph from a root node.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void build_dominator_tree (GT &g, typename GT::Node *root, GT &tree, SA sa=SA())
 Build the dominator tree of a digraph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynMapTree< typename GT::Node *, DynSetTree< typename GT::Node * > > compute_dominance_frontiers (GT &g, typename GT::Node *root, SA sa=SA())
 Compute dominance frontiers of a digraph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< std::pair< typename GT::Node *, typename GT::Node * > > compute_post_dominators (const GT &g, typename GT::Node *exit_node, SA sa=SA())
 Compute immediate post-dominators of a digraph from an exit node.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void build_post_dominator_tree (const GT &g, typename GT::Node *exit_node, GT &tree, SA sa=SA())
 Build the post-dominator tree of a digraph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynMapTree< typename GT::Node *, DynSetTree< typename GT::Node * > > compute_post_dominance_frontiers (const GT &g, typename GT::Node *exit_node, SA sa=SA())
 Compute post-dominance frontiers of a digraph.
 
template<typename Cost , class Transition_Cost_Fn >
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp (const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
 Optimize partition DP using divide-and-conquer optimization.
 
template<typename Cost , class Interval_Cost_Fn >
Knuth_Optimization_Result< Cost > knuth_optimize_interval (const size_t n, Interval_Cost_Fn interval_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
 Optimize interval DP with Knuth optimization.
 
Knuth_Optimization_Result< size_t > optimal_merge_knuth (const Array< size_t > &weights)
 Optimal adjacent merge cost via Knuth optimization.
 
template<typename Cost >
Monotone_Queue_DP_Result< Cost > monotone_queue_min_dp (const Array< Cost > &base_cost, const size_t window, const Cost inf=dp_optimization_detail::default_inf< Cost >())
 Optimize windowed min-transition DP with a monotone queue.
 
template<typename T >
Array< T > min_weighted_squared_distance_1d (const Array< T > &xs, const Array< T > &weights)
 Weighted squared-distance lower envelope on a line.
 
template<AlephGraph GT>
GT gen_random_euclidian_graph (size_t n, size_t m, int w, int h, unsigned int seed)
 
void print_rule ()
 Prints a horizontal rule for example output separation.
 
template<typename T >
DynList< T > get_futures (DynList< std::future< T > > &future_list)
 Collect results from a list of futures.
 
template<typename T >
DynList< T > get_futures (DynList< std::future< T > > &&future_list)
 Collect results from a list of futures (rvalue overload).
 
void get_futures (DynList< std::future< void > > &future_list)
 Wait for all void futures to complete.
 
void get_futures (DynList< std::future< void > > &&future_list)
 Wait for all void futures to complete (rvalue overload).
 
template<typename T >
bool all_ready (DynList< std::future< T > > &future_list)
 Check if all futures in a list are ready.
 
template<typename T >
size_t count_ready (DynList< std::future< T > > &future_list)
 Count how many futures are ready.
 
template<AlephGraph GT, class Node_Label = Dft_Df_Tree_Label<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Df_Low_Tree_Node * build_df_low_tree (const GT &g, typename GT::Node *src, DynList< Df_Low_Non_Tree_Arc > &non_tree_arcs, Node_Label node_label=Node_Label(), SA sa=SA())
 Build the depth-first spanning tree of an undirected graph, with the df and low numbers of its nodes.
 
template<class Write = Write_Df_Tree_Low, AlephGraph GT, class Node_Label = Dft_Df_Tree_Label<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void write_df_low_tree (const GT &g, typename GT::Node *src, std::ostream &out, Node_Label node_label=Node_Label(), SA sa=SA())
 Write, for ntreepic, the depth-first spanning tree of an undirected graph with the df and low numbers of its nodes.
 
template<AlephGraph GT, ArcFilter< GT > SA>
static bool is_there_a_double_arc (const GT *g, typename GT::Node *src, typename GT::Node *tgt, const SA &sa) noexcept(nothrow_arc_filter_v< GT, SA >)
 Whether the digraph g has, among the arcs that sa shows, an arc from src to tgt and another from tgt to src; false if g is not a digraph.
 
template<AlephGraph GT>
static int search_node (DynArray< typename GT::Node * > &nodes, typename GT::Node *p) noexcept
 
template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , ArcFilter< GT > SA>
void generate_graphpic (const GT &g, const double &xdist, const double &ydist, std::ostream &output, SA sa=SA())
 Generate a graphpic specification for graph visualization.
 
template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , class Dashed_Node , class Dashed_Arc , ArcFilter< GT > SA, NodeFilter< GT > SN>
void generate_graphviz (const GT &g, std::ostream &output, const std::string &rankdir="TB", float ranksep=0.2, float nodesep=0.2, SA sa=SA())
 Generate a Graphviz DOT specification for graph visualization.
 
template<AlephGraph GT, class Node_Attr , class Arc_Attr , NodeFilter< GT > SN, ArcFilter< GT > SA>
void generate_graphviz (const GT &g, std::ostream &out, Node_Attr node_attr=Node_Attr(), Arc_Attr arc_attr=Arc_Attr(), const std::string &rankdir="TB", SA sa=SA())
 Generate Graphviz DOT output with custom attribute functors.
 
template<AlephGraph GT, class Node_Attr , class Arc_Attr , NodeFilter< GT > SN, ArcFilter< GT > SA>
void digraph_graphviz (const GT &g, std::ostream &out, Node_Attr node_attr=Node_Attr(), Arc_Attr arc_attr=Arc_Attr(), const std::string &rankdir="LR", SA sa=SA())
 Generate Graphviz DOT output specifically for digraphs.
 
template<AlephGraph GT, class Node_Attr , class Arc_Attr , NodeFilter< GT > SN, ArcFilter< GT > SA>
size_t rank_graphviz (const GT &g, std::ostream &out, Node_Attr node_attr=Node_Attr(), Arc_Attr arc_attr=Arc_Attr(), const std::string &rankdir="LR", SA sa=SA())
 Generate Graphviz DOT output with topological ranking.
 
template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , ArcFilter< GT > SA>
void generate_cross_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out, SA sa=SA())
 Generate a cross-graph layout specification for graphpic.
 
template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc >
void generate_cross_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out)
 
template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc , ArcFilter< GT > SA>
void generate_net_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out, SA sa=SA())
 Generate a net-graph layout specification for graphpic.
 
template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc >
void generate_net_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out)
 
template<AlephGraph GT, class Write_Node , class Write_Arc , ArcFilter< GT > SA>
void generate_cross_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out, SA sa=SA())
 
template<AlephGraph GT, class Write_Node , class Write_Arc , ArcFilter< GT > SA>
void generate_net_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out, SA sa=SA())
 
template<AlephGraph GT, class Write_Node , class Write_Arc >
void generate_cross_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out)
 
template<AlephGraph GT, class Write_Node , class Write_Arc >
void generate_net_graph (GT &g, const size_t &nodes_by_level, const double &xdist, const double &ydist, std::ostream &out)
 
std::string escape_dot_label (const std::string &text)
 
template<typename Node , class Write >
static void __generate_tree (Node *node, int deway[], const size_t &current_level, const size_t &size, std::ostream &output)
 
template<typename Node , class Write = Dft_Write<Node>>
void generate_tree (Node *root, std::ostream &out, const int &tree_number=0)
 Generate a tree specification for the ntreepic drawing tool.
 
template<typename Node , class Write = Dft_Write<Node>>
void generate_forest (Node *root, std::ostream &out)
 Generate a forest specification for the ntreepic drawing tool.
 
template<typename Node , class Write >
void generate_btree (Node *root, std::ostream &out)
 Generate a binary tree specification for the btreepic drawing tool.
 
template<typename Node , class Write = Dft_Write<Node>>
void generate_tree_graphviz (Node *root, std::ostream &out)
 Generate a Graphviz DOT specification for a tree.
 
SegmentSegmentIntersection::Result segment_segment_intersection (const Segment &s1, const Segment &s2)
 Convenience free-function wrapper for SegmentSegmentIntersection.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t greedy_coloring (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA())
 Greedy graph coloring in iteration order.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t welsh_powell_coloring (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA())
 Welsh-Powell graph coloring.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t dsatur_coloring (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA())
 DSatur graph coloring (saturation-degree heuristic).
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
bool is_valid_coloring (const GT &g, const DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA())
 Validates a graph coloring.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t chromatic_number (const GT &g, DynMapTree< typename GT::Node *, size_t > &colors, SA sa=SA())
 Computes the exact chromatic number of a small graph.
 
template<AlephGraph GT, typename Key , typename Convert , ArcFilter< GT > SA>
static void __graph_to_tree_node (GT &g, typename GT::Node *groot, Tree_Node< Key > *troot, const SA &sa)
 
template<AlephGraph GT, typename Key , class Convert , ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Tree_Node< Key > * graph_to_tree_node (GT &g, typename GT::Node *groot, SA sa=SA())
 Convert a tree graph to a Tree_Node structure.
 
static uint32_t rotl32 (uint32_t x, int8_t r)
 
static uint64_t rotl64 (uint64_t x, int8_t r)
 
static uint32_t fmix32 (uint32_t h)
 
static uint64_t fmix64 (uint64_t k)
 
static size_t fold_hash64_to_size_t (std::uint64_t hash) noexcept
 
static std::uint32_t read_le32 (const std::uint8_t *p) noexcept
 
static std::uint64_t read_le64 (const std::uint8_t *p) noexcept
 
static void write_le32 (std::uint8_t *p, std::uint32_t value) noexcept
 
static void write_le64 (std::uint8_t *p, std::uint64_t value) noexcept
 
static std::uint64_t mul_xor_fold64 (std::uint64_t lhs, std::uint64_t rhs) noexcept
 
static std::uint64_t xxh64_round (std::uint64_t acc, std::uint64_t input) noexcept
 
static std::uint64_t xxh64_merge_round (std::uint64_t acc, std::uint64_t value) noexcept
 
static std::uint64_t wyhash_mix (std::uint64_t lhs, std::uint64_t rhs) noexcept
 
static void jsw_fill_table (std::uint32_t seed) noexcept
 
bool is_jsw_initialized () noexcept
 Checks if the jsw_hash() lookup table has been initialized.
 
void init_jsw () noexcept
 Initializes the randomized lookup table used by jsw_hash().
 
void init_jsw (std::uint32_t seed) noexcept
 Initializes the randomized lookup table used by jsw_hash().
 
size_t jsw_hash (const void *key, size_t len) noexcept
 JSW hash (Julienne Walker)
 
size_t jsw_hash (const char *key) noexcept
 Compute a 32-bit JSW hash for a null-terminated string.
 
size_t jen_hash (const void *key, size_t len, unsigned initval) noexcept
 Jenkins hash (lookup3)
 
void MurmurHash3_x86_32 (const void *key, int len, uint32_t seed, void *out)
 
void MurmurHash3_x86_128 (const void *key, const int len, uint32_t seed, void *out)
 
void MurmurHash3_x64_128 (const void *key, const int len, const uint32_t seed, void *out)
 
size_t xxhash64_hash (const void *key, size_t len, std::uint64_t seed=Default_Hash_Seed) noexcept
 xxHash64 from the xxHash family.
 
size_t wyhash_hash (const void *key, size_t len, std::uint64_t seed=Default_Hash_Seed) noexcept
 wyhash non-cryptographic hash.
 
size_t siphash24_hash (const void *key, size_t len, std::uint64_t key0=0x0706050403020100ULL, std::uint64_t key1=0x0f0e0d0c0b0a0908ULL) noexcept
 SipHash-2-4 keyed hash.
 
size_t add_hash (const void *key, const size_t len) noexcept
 Additive hash.
 
size_t xor_hash (const void *key, const size_t len) noexcept
 XOR hash.
 
size_t rot_hash (const void *key, const size_t len) noexcept
 Rotating hash.
 
size_t djb_hash (const void *key, const size_t len) noexcept
 Bernstein's hash (DJB hash)
 
size_t sax_hash (const void *key, const size_t len) noexcept
 Shift-Add-XOR hash (SAX hash)
 
size_t fnv_hash (const void *key, const size_t len) noexcept
 FNV-1a hash.
 
size_t oat_hash (const void *key, const size_t len) noexcept
 One-at-a-Time hash (OAT hash)
 
size_t elf_hash (const void *key, const size_t len) noexcept
 ELF hash.
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t murmur3hash (const Key &key, std::uint32_t seed)
 
size_t murmur3hash (const char *key, const std::uint32_t seed)
 
size_t murmur3hash (const std::string &key, const std::uint32_t seed)
 
std::uint16_t get16bits (const void *p) noexcept
 
size_t SuperFastHash (const void *key, const size_t len, std::uint32_t seed=0) noexcept
 Paul Hsieh super fast hash function.
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t add_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t xor_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t rot_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t djb_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t sax_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t fnv_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t oat_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t jsw_hash (const Key &key) noexcept
 JSW hash for arbitrary key types.
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t elf_hash (const Key &key) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t jen_hash (const Key &key, const unsigned initval) noexcept
 
template<typename Key >
requires (std::is_trivially_copyable_v<Key> and (not std::is_pointer_v<Key>) and (not std::is_array_v<Key>))
size_t SuperFastHash (const Key &key, std::uint32_t seed=0) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t xxhash64_hash (const Key &key, std::uint64_t seed=Default_Hash_Seed) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t wyhash_hash (const Key &key, std::uint64_t seed=Default_Hash_Seed) noexcept
 
template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t siphash24_hash (const Key &key, std::uint64_t key0=0x0706050403020100ULL, std::uint64_t key1=0x0f0e0d0c0b0a0908ULL) noexcept
 
size_t add_hash (const char *key) noexcept
 
size_t xor_hash (const char *key) noexcept
 
size_t rot_hash (const char *key) noexcept
 
size_t djb_hash (const char *key) noexcept
 
size_t sax_hash (const char *key) noexcept
 
size_t fnv_hash (const char *key) noexcept
 
size_t oat_hash (const char *key) noexcept
 
size_t elf_hash (const char *key) noexcept
 
size_t SuperFastHash (const char *key, std::uint32_t seed=0) noexcept
 
size_t xxhash64_hash (const char *key, std::uint64_t seed=Default_Hash_Seed) noexcept
 
size_t wyhash_hash (const char *key, std::uint64_t seed=Default_Hash_Seed) noexcept
 
size_t siphash24_hash (const char *key, std::uint64_t key0=0x0706050403020100ULL, std::uint64_t key1=0x0f0e0d0c0b0a0908ULL) noexcept
 
size_t add_hash (const std::string &key) noexcept
 
size_t xor_hash (const std::string &key) noexcept
 
size_t rot_hash (const std::string &key) noexcept
 
size_t djb_hash (const std::string &key) noexcept
 
size_t sax_hash (const std::string &key) noexcept
 
size_t fnv_hash (const std::string &key) noexcept
 
size_t oat_hash (const std::string &key) noexcept
 
size_t jsw_hash (const std::string &key) noexcept
 JSW hash for std::string.
 
size_t elf_hash (const std::string &key) noexcept
 
size_t jen_hash (const std::string &key, unsigned initval) noexcept
 
size_t SuperFastHash (const std::string &key, std::uint32_t seed=0) noexcept
 
size_t xxhash64_hash (const std::string &key, std::uint64_t seed=Default_Hash_Seed) noexcept
 
size_t wyhash_hash (const std::string &key, std::uint64_t seed=Default_Hash_Seed) noexcept
 
size_t siphash24_hash (const std::string &key, std::uint64_t key0=0x0706050403020100ULL, std::uint64_t key1=0x0f0e0d0c0b0a0908ULL) noexcept
 
void hash_combine (size_t &seed, size_t h) noexcept
 Non-commutative hash combiner (Boost-style golden-ratio mix).
 
template<typename Key >
requires (not std::is_pointer_v<Key> and not std::is_array_v<Key> and not std::is_same_v<std::remove_cvref_t<Key>, std::string>)
size_t dft_hash_fct (const Key &key) noexcept
 Primary default hash: best speed/quality trade-off.
 
template<typename Key >
requires std::is_pointer_v<Key>
size_t dft_hash_fct (const Key &key) noexcept
 
size_t dft_hash_fct (const char *key) noexcept
 
size_t dft_hash_fct (const std::string &key) noexcept
 
template<typename Key >
requires (not std::is_pointer_v<Key> and not std::is_array_v<Key> and not std::is_same_v<std::remove_cvref_t<Key>, std::string>)
size_t dft_hash_fct (const Key &key, std::uint32_t seed) noexcept
 Primary default hash with explicit seed.
 
template<typename Key >
requires std::is_pointer_v<Key>
size_t dft_hash_fct (const Key &key, std::uint32_t seed) noexcept
 
size_t dft_hash_fct (const char *key, std::uint32_t seed) noexcept
 
size_t dft_hash_fct (const std::string &key, std::uint32_t seed) noexcept
 
template<typename Key >
size_t dft_hash_ptr_fct (const Key &key) noexcept
 
template<typename Key >
size_t dft_seed_hash_ptr_fct (const Key &key, const unsigned long seed) noexcept
 
template<typename Key >
requires (not std::is_pointer_v<Key> and not std::is_array_v<Key> and not std::is_same_v<std::remove_cvref_t<Key>, std::string>)
size_t snd_hash_fct (const Key &key) noexcept
 Secondary default hash: different distribution from dft_hash_fct.
 
template<typename Key >
requires std::is_pointer_v<Key>
size_t snd_hash_fct (const Key &key) noexcept
 
size_t snd_hash_fct (const char *key) noexcept
 
size_t snd_hash_fct (const std::string &key) noexcept
 
template<typename Key >
size_t snd_hash_ptr_fct (const Key &key) noexcept
 
template<typename Key , typename Data , typename Fct >
size_t map_hash_fct (Fct fct, const std::pair< Key, Data > &p) noexcept
 
template<typename K1 , typename K2 >
requires requires(const K1 & k1, const K2 & k2) { dft_hash_fct(k1); dft_hash_fct(k2); }
size_t pair_dft_hash_fct (const std::pair< K1, K2 > &p) noexcept
 
template<typename K1 , typename K2 >
requires requires(const K1 & k1, const K2 & k2) { dft_hash_fct(k1); snd_hash_fct(k2); }
size_t pair_snd_hash_fct (const std::pair< K1, K2 > &p) noexcept
 
template<typename K1 , typename K2 >
size_t pair_dft_hash_ptr_fct (const std::pair< K1, K2 > &p) noexcept
 
template<typename K1 , typename K2 >
size_t pair_snd_hash_ptr_fct (const std::pair< K1, K2 > &p) noexcept
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Howard_Mean_Cycle_Result< GT, typename Distance::Distance_Type > howard_minimum_mean_cycle (const GT &g, Distance distance=Distance(), SA sa=SA(), const size_t max_fallback_bytes=std::numeric_limits< size_t >::max())
 Minimum mean cycle by Howard's policy iteration.
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Mean_Cycle_Value_Result howard_minimum_mean_cycle_value (const GT &g, Distance distance=Distance(), SA sa=SA(), const size_t max_fallback_bytes=std::numeric_limits< size_t >::max())
 Minimum mean cycle value by Howard's policy iteration, without the witness.
 
template<class Container >
DynList< typename Container::Item_Type > to_dynlist (const Container &c)
 
template<typename T >
DynList< T > get_unitarian_DynList (const T &item)
 
template<typename T >
DynList< T > unitarian_DynList (const T &item)
 
static const size_t & get_freq (Huffman_Node *huffman_node) noexcept
 
static void increase_freq (Huffman_Node *huffman_node) noexcept
 
static void set_freq (Huffman_Node *huffman_node, const size_t &freq) noexcept
 
static bool is_leaf (BinNode< std::string > *p) noexcept
 
template<typename Cost_Type >
Hungarian_Result< Cost_Type > hungarian_assignment (const DynMatrix< Cost_Type > &cost)
 Compute minimum-cost assignment (free function).
 
template<typename Cost_Type >
Hungarian_Result< Cost_Type > hungarian_max_assignment (const DynMatrix< Cost_Type > &cost)
 Compute maximum-profit assignment (free function).
 
const char * interpreter_value_kind_name (const Interpreter_Value_Kind kind) noexcept
 Stable debug name for one runtime value kind.
 
const char * interpreter_control_flow_name (const Interpreter_Control_Flow_Kind kind) noexcept
 Stable debug name for one control-flow outcome.
 
bool interpreter_values_equal (const Interpreter_Value &lhs, const Interpreter_Value &rhs)
 Returns whether two runtime values compare equal.
 
std::string interpreter_value_to_string (const Interpreter_Value &value)
 Formats one runtime value deterministically for dumps and tests.
 
std::string interpreter_dump_environment (const Interpreter_Environment &env)
 Dumps one environment deterministically.
 
std::string interpreter_dump_globals (const Interpreter_Runtime &runtime)
 Dumps the globals currently installed in one runtime.
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
requires std::is_arithmetic_v<typename Distance::Distance_Type>
DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > yen_k_shortest_paths (const GT &g, typename GT::Node *source, typename GT::Node *target, const size_t k, Distance distance=Distance(), SA sa=SA())
 Compute k shortest loopless paths using Yen's algorithm.
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
requires std::is_arithmetic_v<typename Distance::Distance_Type>
DynList< K_Shortest_Path_Item< GT, typename Distance::Distance_Type > > eppstein_k_shortest_paths (const GT &g, typename GT::Node *source, typename GT::Node *target, const size_t k, Distance distance=Distance(), SA sa=SA())
 Compute k shortest general (loopy) paths.
 
template<typename V , std::integral W>
Knapsack_Result< V > knapsack_01 (const Array< Knapsack_Item< W, V > > &items, W capacity)
 Solve the 0/1 Knapsack problem with item reconstruction.
 
template<typename V , std::integral W>
V knapsack_01_value (const Array< Knapsack_Item< W, V > > &items, W capacity)
 Solve the 0/1 Knapsack problem (value only, space-optimized).
 
template<typename V , std::integral W>
Knapsack_Result< V > knapsack_unbounded (const Array< Knapsack_Item< W, V > > &items, W capacity)
 Solve the Unbounded Knapsack problem with reconstruction.
 
template<typename V , std::integral W>
Knapsack_Result< V > knapsack_bounded (const Array< Knapsack_Item< W, V > > &items, const Array< size_t > &counts, W capacity)
 Solve the Bounded Knapsack problem with reconstruction.
 
template<AlephGraph GT>
static void __dfp_phase1 (const GT &g, typename GT::Node *p, DynArray< typename GT::Node * > &df)
 
template<AlephGraph GT>
static void __dfp_phase2_subgraph (const GT &g, typename GT::Node *p, GT &blk, const int &color)
 DFS on transposed graph that builds an SCC subgraph (Phase 2).
 
template<AlephGraph GT>
static void __dfp_phase2_list (const GT &g, typename GT::Node *p, DynList< typename GT::Node * > &list)
 DFS on transposed graph that builds an SCC node list (Phase 2).
 
template<AlephGraph GT>
void kosaraju_connected_components (const GT &g, DynList< GT > &blk_list, DynList< typename GT::Arc * > &arc_list)
 Compute strongly connected components using Kosaraju's algorithm.
 
template<AlephGraph GT>
DynList< DynList< typename GT::Node * > > kosaraju_connected_components (const GT &g)
 Compute strongly connected components as lists of nodes.
 
template<AlephGraph GT>
size_t kosaraju_scc_count (const GT &g)
 Count the number of strongly connected components.
 
template<AlephGraph GT>
bool is_strongly_connected (const GT &g)
 Check if a directed graph is strongly connected.
 
template<AlephGraph GT, class Compare , class Plus >
void floyd_all_shortest_paths (GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path)
 Compute all-pairs shortest paths using Floyd-Warshall algorithm.
 
template<AlephGraph GT>
void floyd_all_shortest_paths (GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path)
 Overload using default comparison (less) and addition (plus).
 
template<AlephGraph GT, class Compare , class Plus , template< class > class P_i, template< class > class P_ij, template< class > class D_ij>
void floyd_all_shortest_paths_latex (GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path, std::ofstream &output)
 Floyd-Warshall algorithm with LaTeX step-by-step output.
 
template<AlephGraph GT, template< class > class P_i, template< class > class P_ij, template< class > class D_ij>
void floyd_all_shortest_paths_latex (GT &g, Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &dist, Ady_Mat< GT, long > &path, std::ofstream &output)
 Overload using default comparison (less) and addition (plus).
 
template<typename T , class Compare = Aleph::less<T>>
LIS_Result< T > longest_increasing_subsequence (const Array< T > &seq, Compare cmp=Compare())
 Compute the Longest Increasing Subsequence (strictly increasing).
 
template<typename T , class Compare = Aleph::less<T>>
size_t lis_length (const Array< T > &seq, Compare cmp=Compare())
 Compute only the length of the LIS (no reconstruction).
 
template<typename T , class Compare = Aleph::less<T>>
LIS_Result< T > longest_nondecreasing_subsequence (const Array< T > &seq, Compare cmp=Compare())
 Compute the Longest Non-Decreasing Subsequence.
 
void split (const std::string &text, const std::string &separators, DynDlist< std::string > &words)
 Split a text into tokens using a separator set.
 
Digrafo::Node * search_node (Digrafo &g, const std::string &s)
 Find or create a node by ID.
 
void load_digraph (Digrafo &g, std::istream &nodes_input, std::istream &arcs_input)
 Load nodes and arcs from streams into the directed graph.
 
void generate_dot_file (Digrafo &g, std::ostream &output)
 Generate a DOT representation of the digraph.
 
template<typename Mat , class RowIndexFormatter , class ColIndexFormatter , class EntryFormatter >
void mat_to_latex (Mat &mat, long n, long m, std::ostream &out, const std::string &prefix="", const std::string &suffix="")
 Generate LaTeX tabular representation of a matrix.
 
template<typename Mat , class RowIndexFormatter , class ColIndexFormatter , class EntryFormatter >
void mat_to_latex (Mat &mat, long n, long m, std::ofstream &out, const std::string &prefix="", const std::string &suffix="")
 Overload for std::ofstream output.
 
template<typename Mat >
void mat_to_latex_simple (Mat &mat, long n, long m, std::ostream &out, const std::string &prefix="", const std::string &suffix="")
 Generate LaTeX table with default formatters.
 
template<class Mat , class Compare = std::less<>>
void find_min_path (Mat &p, long src_idx, long tgt_idx, Path< typename Mat::Graph_Type > &path)
 Build a minimum path from Floyd-Warshall path matrix using indices.
 
template<class Mat , class Compare = std::less<>>
void find_min_path (Mat &p, typename Mat::Node *src_node, typename Mat::Node *tgt_node, Path< typename Mat::Graph_Type > &path)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Build a minimum path using node pointers instead of indices.
 
Matrix_Chain_Result matrix_chain_order (const Array< size_t > &dims)
 Compute the optimal matrix-chain multiplication order.
 
size_t matrix_chain_min_cost (const Array< size_t > &dims)
 Compute only the minimum multiplication cost (value only).
 
template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Cost_Matching_Result< long long > compute_minimum_cost_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA(), const bool max_cardinality=false)
 Compute minimum-cost matching in a general undirected graph.
 
template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Cost_Matching_Result< long long > blossom_minimum_cost_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA(), const bool max_cardinality=false)
 Alias for compute_minimum_cost_general_matching().
 
template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Cost_Perfect_Matching_Result< long long > compute_minimum_cost_perfect_general_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA())
 Compute minimum-cost perfect matching in a general undirected graph.
 
template<AlephGraph GT, class Cost = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Cost_Perfect_Matching_Result< long long > blossom_minimum_cost_perfect_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, Cost cost=Cost(), SA sa=SA())
 Alias for compute_minimum_cost_perfect_general_matching().
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Mean_Cycle_Result< GT, typename Distance::Distance_Type > karp_minimum_mean_cycle (const GT &g, Distance distance=Distance(), SA sa=SA())
 Compute minimum mean cycle by Karp's algorithm.
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Mean_Cycle_Value_Result karp_minimum_mean_cycle_value (const GT &g, Distance distance=Distance(), SA sa=SA())
 Compute only the minimum mean value (without witness walk).
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Mean_Cycle_Value_Result minimum_mean_cycle_value (const GT &g, Distance distance=Distance(), SA sa=SA())
 Alias for karp_minimum_mean_cycle_value().
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Min_Mean_Cycle_Result< GT, typename Distance::Distance_Type > minimum_mean_cycle (const GT &g, Distance distance=Distance(), SA sa=SA())
 Alias for karp_minimum_mean_cycle().
 
uint64_t mod_mul (uint64_t a, uint64_t b, uint64_t m)
 Safe 64-bit modular multiplication.
 
uint64_t mod_exp (uint64_t base, uint64_t exp, const uint64_t m)
 Modular exponentiation.
 
template<typename T >
requires (std::is_integral_v<T> and std::is_signed_v<T>)
T ext_gcd (T a, T b, T &x, T &y) noexcept
 Extended Euclidean Algorithm.
 
uint64_t mod_inv (const uint64_t a, const uint64_t m)
 Modular Inverse.
 
uint64_t crt (const Array< uint64_t > &rem, const Array< uint64_t > &mod)
 Chinese Remainder Theorem (CRT).
 
template<DenseMatrix MatrixT>
constexpr std::pair< size_t, size_t > matrix_dims (const MatrixT &m) noexcept
 Get dimensions of a matrix (dense or sparse).
 
template<typename StateKey >
size_t aleph_hash_value (const AdversarialTranspositionKey< StateKey > &key) noexcept
 
template<AdversarialGameDomain Domain>
auto negamax_search (Domain domain, typename Domain::State initial_state, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for one-shot Negamax search.
 
template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto negamax_search (Domain domain, typename Domain::State initial_state, Tracer &tracer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for one-shot Negamax search with tracing.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto negamax_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Negamax search with transposition table.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto negamax_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, Tracer &tracer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Negamax search with TT/keyer and tracing.
 
template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto negamax_search (Domain domain, typename Domain::State initial_state, Table &table, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Negamax search with domain-provided state key.
 
template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto negamax_search (Domain domain, typename Domain::State initial_state, Table &table, Tracer &tracer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={})
 Convenience wrapper for Negamax search with domain-provided key and tracing.
 
template<AdversarialGameDomain Domain>
auto iterative_deepening_negamax_search (Domain domain, typename Domain::State initial_state, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Negamax without transposition table.
 
template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto iterative_deepening_negamax_search (Domain domain, typename Domain::State initial_state, Tracer &tracer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Negamax with tracing.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto iterative_deepening_negamax_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Negamax with TT/keyer reuse across iterations.
 
template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto iterative_deepening_negamax_search (Domain domain, typename Domain::State initial_state, Table &table, Keyer keyer, Tracer &tracer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Negamax with TT/keyer reuse and tracing.
 
template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto iterative_deepening_negamax_search (Domain domain, typename Domain::State initial_state, Table &table, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Negamax using domain.state_key().
 
template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto iterative_deepening_negamax_search (Domain domain, typename Domain::State initial_state, Table &table, Tracer &tracer, ExplorationPolicy policy=Negamax< Domain >::default_policy(), SearchLimits limits={}, AdversarialIterativeDeepeningOptions< typename Domain::Score > options={})
 Iterative deepening over Negamax using domain.state_key() and tracing.
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< Negative_Cycle_Item< GT, typename Distance::Distance_Type > > find_disjoint_negative_cycles (const GT &g, const size_t max_cycles, const Negative_Cycle_Exclusion exclusion=Negative_Cycle_Exclusion::Min_Weight_Arc, Distance distance=Distance(), SA sa=SA())
 Find up to max_cycles negative cycles, excluding arcs of each cycle found before searching for the next one.
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Bounded_Cycle_Result< GT, typename Distance::Distance_Type > most_negative_cycle_bounded (const GT &g, const size_t max_length, Distance distance=Distance(), SA sa=SA())
 Most negative simple cycle of at most max_length arcs, ranked by total cost (not by mean cost as Karp's algorithm does).
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Short_Cycle_Result< GT, typename Distance::Distance_Type > most_negative_cycle_up_to_3 (const GT &g, const size_t max_length=3, Distance distance=Distance(), SA sa=SA())
 Minimum-total-cost simple cycle with at most one, two or three arcs.
 
template<class Net , class GetDemand , class GetLower , template< class > class Maxflow = Dinic_Maximum_Flow>
CirculationResult< typename Net::Flow_Type > solve_circulation (Net &net, GetDemand get_demand, GetLower get_lower)
 Solve a circulation problem with demands.
 
template<typename Value_Type >
ProjectSelectionResult< Value_Type > solve_project_selection (const std::vector< Project< Value_Type > > &projects)
 Solve project selection problem using max-flow.
 
BaseballEliminationResult check_baseball_elimination (const std::vector< Team > &teams, size_t team_idx)
 Check if a team is mathematically eliminated from winning.
 
template<typename Value_Type >
SegmentationResult segment_image (size_t rows, size_t cols, const std::vector< std::vector< std::array< Value_Type, 2 > > > &data_cost, Value_Type smoothness)
 Segment image using graph cuts.
 
SurveyDesignResult design_survey (const std::vector< SurveyQuestion > &questions, const std::vector< SurveyRespondent > &respondents)
 Design survey assignment using network flow.
 
template<class Net >
Net generate_random_network (const NetworkGenParams &params)
 Generate a random flow network.
 
template<class Net >
Net generate_random_network (size_t num_nodes, size_t num_arcs, double min_cap=1.0, double max_cap=100.0, unsigned seed=0)
 Generate a random flow network (convenience overload).
 
template<class Net >
Net generate_grid_network (size_t rows, size_t cols, typename Net::Flow_Type capacity, bool bidirectional=true)
 Generate a grid network.
 
template<class Net >
Net generate_bipartite_network (size_t left_size, size_t right_size, double edge_prob=0.5, unsigned seed=0)
 Generate a bipartite network for matching.
 
template<class Net >
Net generate_layered_network (const std::vector< size_t > &layer_sizes, typename Net::Flow_Type capacity, double edge_prob=0.5, unsigned seed=0)
 Generate a layered network.
 
template<class Net >
void export_network_to_dot (const Net &net, const std::string &filename, const DotExportOptions &options=DotExportOptions())
 Export network to DOT format for GraphViz visualization.
 
template<class Net >
std::string network_to_dot_string (const Net &net, const DotExportOptions &options=DotExportOptions())
 Generate DOT string for network (instead of file).
 
template<class Net >
void export_network_to_json (const Net &net, const std::string &filename)
 Export network to JSON format.
 
template<class Net >
std::string network_to_json_string (const Net &net)
 Export network to JSON string.
 
template<class Net >
void export_network_to_dimacs (const Net &net, const std::string &filename)
 Export network to DIMACS max-flow format.
 
template<class Net >
Net import_network_from_dimacs (const std::string &filename)
 Import network from DIMACS max-flow format.
 
template<class Net , class Algo >
MaxFlowBenchmarkResult< typename Net::Flow_Type > benchmark_maxflow (Net &net, Algo algo, const std::string &name)
 Run and time a max-flow algorithm.
 
template<typename Flow_Type >
void print_benchmark_results (const std::vector< MaxFlowBenchmarkResult< Flow_Type > > &results)
 Print benchmark results.
 
static void compute_optimal_costs (DynArray< double > &cost, double p[], const size_t n, DynArray< int > &tree)
 Compute optimal costs and tree structure using dynamic programming.
 
template<class Node , typename Key >
static Node * compute_tree (Key keys[], DynArray< int > &tree, const size_t n, const size_t i, const size_t j)
 Recursively construct the optimal BST from the tree matrix.
 
template<class Node , typename Key >
Node * build_optimal_tree (Key keys[], double p[], const size_t n)
 Build an optimal binary search tree based on access probabilities.
 
Array< std::string > csv_read_row (std::istream &in, char delimiter=',')
 Read a single CSV row from an input stream.
 
Array< std::string > csv_read_row (const std::string &line, char delimiter=',')
 Read a single CSV row from a string.
 
Array< Array< std::string > > csv_read_all (std::istream &in, char delimiter=',')
 Read all rows from a CSV input stream.
 
Array< Array< std::string > > csv_read_file (const std::string &filename, char delimiter=',')
 Read all rows from a CSV file.
 
std::string csv_escape (const std::string &field, char delimiter=',')
 Escape a string for CSV output.
 
void csv_write_row (std::ostream &out, const Array< std::string > &row, char delimiter=',', const std::string &line_ending="\n")
 Write a CSV row to an output stream.
 
void csv_write_all (std::ostream &out, const Array< Array< std::string > > &rows, char delimiter=',', const std::string &line_ending="\n")
 Write multiple CSV rows to an output stream.
 
void csv_write_file (const std::string &filename, const Array< Array< std::string > > &rows, char delimiter=',', const std::string &line_ending="\n")
 Write CSV data to a file.
 
size_t csv_num_columns (const Array< std::string > &row)
 Get the number of columns in a CSV row.
 
bool csv_is_rectangular (const Array< Array< std::string > > &rows)
 Check if all rows have the same number of columns.
 
Array< std::string > csv_get_column (const Array< Array< std::string > > &rows, size_t col_index)
 Get a column from CSV data.
 
template<typename T >
T csv_to_number (const std::string &field)
 Convert a CSV field to a numeric type.
 
template<>
int csv_to_number< int > (const std::string &field)
 
template<>
long csv_to_number< long > (const std::string &field)
 
template<>
double csv_to_number< double > (const std::string &field)
 
template<>
float csv_to_number< float > (const std::string &field)
 
template<typename Pred >
Array< Array< std::string > > csv_filter (const Array< Array< std::string > > &rows, Pred predicate)
 Filter CSV rows by a predicate.
 
Array< Array< std::string > > csv_filter_by_value (const Array< Array< std::string > > &rows, size_t col_index, const std::string &value)
 Filter CSV rows by column value.
 
Array< Array< std::string > > csv_select_columns (const Array< Array< std::string > > &rows, const Array< size_t > &col_indices)
 Select specific columns from CSV data.
 
Array< Array< std::string > > csv_skip_rows (const Array< Array< std::string > > &rows, size_t n)
 Skip the first N rows of CSV data.
 
Array< Array< std::string > > csv_take_rows (const Array< Array< std::string > > &rows, size_t n)
 Take only the first N rows of CSV data.
 
size_t csv_count_rows (const Array< Array< std::string > > &rows)
 Count total number of rows.
 
size_t csv_count_empty (const Array< Array< std::string > > &rows)
 Count empty fields in CSV data.
 
template<typename Pred >
size_t csv_count_if (const Array< Array< std::string > > &rows, Pred predicate)
 Count rows matching a predicate.
 
template<typename Pred >
size_t csv_find_row (const Array< Array< std::string > > &rows, Pred predicate)
 Find first row matching a predicate.
 
size_t csv_find_by_value (const Array< Array< std::string > > &rows, size_t col_index, const std::string &value)
 Find row where column equals value.
 
Array< std::string > csv_distinct (const Array< Array< std::string > > &rows, size_t col_index)
 Get distinct values in a column.
 
Array< Array< std::string > > csv_transpose (const Array< Array< std::string > > &rows)
 Transpose CSV data (swap rows and columns).
 
Array< Array< std::string > > csv_sort_by_column (const Array< Array< std::string > > &rows, size_t col_index, bool ascending=true)
 Sort CSV data by a column.
 
template<typename T >
Array< Array< std::string > > csv_sort_by_column_numeric (const Array< Array< std::string > > &rows, size_t col_index, bool ascending=true)
 Sort CSV data by a column with numeric comparison.
 
Array< Array< std::string > > csv_unique (const Array< Array< std::string > > &rows)
 Remove duplicate rows.
 
template<typename Func >
Array< Array< std::string > > csv_transform (const Array< Array< std::string > > &rows, Func func)
 Apply a transformation to each field.
 
bool csv_skip_bom (std::istream &in)
 Skip UTF-8 BOM if present.
 
Array< Array< std::string > > csv_trim_fields (const Array< Array< std::string > > &rows)
 Trim whitespace from all fields.
 
Array< Array< std::string > > csv_fill_empty (const Array< Array< std::string > > &rows, const std::string &default_value)
 Replace empty fields with a default value.
 
Array< Array< std::string > > csv_join_horizontal (const Array< Array< std::string > > &left, const Array< Array< std::string > > &right)
 Join two CSV datasets horizontally (add columns).
 
Array< Array< std::string > > csv_join_vertical (const Array< Array< std::string > > &top, const Array< Array< std::string > > &bottom)
 Join two CSV datasets vertically (add rows).
 
Array< Array< std::string > > csv_inner_join (const Array< Array< std::string > > &left, size_t left_key_col, const Array< Array< std::string > > &right, size_t right_key_col)
 Inner join two CSV datasets by a key column.
 
Array< Array< Array< std::string > > > csv_group_by (const Array< Array< std::string > > &rows, size_t col_index)
 Group rows by a column value.
 
template<typename Func >
Array< Array< std::string > > csv_add_column (const Array< Array< std::string > > &rows, Func func)
 Add a new column with computed values.
 
Array< Array< std::string > > csv_rename_column (const Array< Array< std::string > > &rows, const std::string &old_name, const std::string &new_name)
 Rename a column (in the header row).
 
void put_char_in_buffer (char *&start_addr, const char *end_addr, int c)
 Append a character to a buffer with bounds checking.
 
void init_token_scanning ()
 Initialize token scanning by recording current position.
 
void close_token_scanning (const char *buffer, char *&start_addr, const char *end_addr)
 Finalize token scanning by null-terminating and saving the token.
 
int read_char_from_stream (std::ifstream &input_stream)
 Read a single character from an input stream with position tracking.
 
void skip_white_spaces (std::ifstream &input_stream)
 Skip whitespace characters in the input stream.
 
long load_number (std::ifstream &input_stream)
 Load an integer number from the input stream.
 
std::string load_string (std::ifstream &input_stream)
 Load a string from the input stream.
 
void print_parse_error_and_exit (const std::string &str)
 Print a parse error message and terminate the program.
 
void print_parse_warning (const std::string &str)
 Print a parse warning message.
 
std::string command_line_to_string (int argc, char *argv[])
 Convert command line arguments to a single string.
 
void reset_parse_state ()
 Reset the parsing state to initial values.
 
int peek_char (std::ifstream &input_stream)
 Peek at the next character without consuming it.
 
StreamPosition mark_position (std::ifstream &input_stream)
 Mark the current position for potential backtracking.
 
void restore_position (std::ifstream &input_stream, const StreamPosition &pos)
 Restore a previously marked position.
 
void skip_line_comment (std::ifstream &input_stream)
 Skip a line comment (// style or # style)
 
void skip_block_comment (std::ifstream &input_stream, const std::string &open="/" "*", const std::string &close="*" "/")
 Skip a block comment (C-style)
 
void skip_whitespace_and_comments (std::ifstream &input_stream)
 Skip whitespace and comments (C/C++ style)
 
double load_double (std::ifstream &input_stream)
 Load a floating-point number from the input stream.
 
long load_hex_number (std::ifstream &input_stream)
 Load a hexadecimal number from the input stream.
 
long load_octal_number (std::ifstream &input_stream)
 Load an octal number from the input stream.
 
long load_binary_number (std::ifstream &input_stream)
 Load a binary number from the input stream.
 
std::string load_identifier (std::ifstream &input_stream)
 Load an identifier from the input stream.
 
bool is_keyword (const std::string &s, const std::vector< std::string > &keywords)
 Check if a string is in a list of keywords.
 
void expect_char (std::ifstream &input_stream, char expected)
 Expect and consume a specific character.
 
void expect (std::ifstream &input_stream, const std::string &expected)
 Expect and consume a specific string/keyword.
 
bool try_char (std::ifstream &input_stream, char ch)
 Try to match a character without throwing.
 
char process_escape (const int c)
 Process an escape sequence.
 
std::string load_escaped_string (std::ifstream &input_stream)
 Load a string with escape sequence processing.
 
char load_char_literal (std::ifstream &input_stream)
 Load a character literal.
 
std::string token_type_to_string (TokenType type)
 Convert TokenType to string for debugging.
 
std::string load_file_contents (const std::string &filename)
 Load entire file contents into a string.
 
DynList< std::string > load_file_lines (const std::string &filename)
 Load file as a list of lines.
 
DynList< std::string > split_string (const std::string &str, char delimiter)
 Split a string by a delimiter.
 
const char * to_string (const Planarity_Certificate_Type type) noexcept
 Return readable name for certificate type.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Planarity_Test_Result< GT > planarity_test (const GT &g, SA sa=SA(), const Planarity_Test_Options &options=Planarity_Test_Options())
 Execute a comprehensive planarity test on an Aleph graph.
 
template<AlephGraph GT>
Planarity_Test_Result< GT > planarity_test (const GT &g, const Planarity_Test_Options &options)
 Overload with default arc selector.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
bool is_planar_graph (const GT &g, SA sa=SA(), const Planarity_Test_Options &options=Planarity_Test_Options())
 High-level boolean check for graph planarity.
 
template<AlephGraph GT>
bool is_planar_graph (const GT &g, const Planarity_Test_Options &options)
 Overload with default arc selector.
 
template<AlephGraph GT>
Planar_Dual_Metadata< GT > planar_dual_metadata (const Planarity_Test_Result< GT > &result)
 Build face and dual-edge metadata from a planar embedding result.
 
template<AlephGraph GT, class DGT = Default_Planar_Dual_Graph<GT>>
DGT build_planar_dual_graph (const Planar_Dual_Metadata< GT > &md)
 Build an Aleph dual graph from face/dual metadata.
 
template<AlephGraph GT, class DGT = Default_Planar_Dual_Graph<GT>>
DGT build_planar_dual_graph (const Planarity_Test_Result< GT > &result)
 Build an Aleph dual graph directly from a planarity result.
 
template<AlephGraph GT>
Planar_Geometric_Drawing< GT > planar_geometric_drawing (const Planarity_Test_Result< GT > &result, const Planar_Geometric_Drawing_Options &options=Planar_Geometric_Drawing_Options())
 Build embedding-aware 2D node coordinates from a planar result.
 
template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>>
std::string nonplanar_certificate_to_json (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options())
 Export non-planar certificate as JSON.
 
template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>>
std::string nonplanar_certificate_to_dot (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options())
 Export non-planar certificate as GraphViz DOT.
 
template<AlephGraph GT>
NonPlanar_Certificate_Validation< GT > validate_nonplanar_certificate (const Planarity_Test_Result< GT > &result)
 Validate structural consistency of a non-planar certificate.
 
template<AlephGraph GT>
bool nonplanar_certificate_is_valid (const Planarity_Test_Result< GT > &result)
 Convenience predicate over validate_nonplanar_certificate().
 
template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>>
std::string nonplanar_certificate_to_graphml (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options())
 Export non-planar certificate as GraphML.
 
template<AlephGraph GT, class Node_Label = Dft_Certificate_Node_Label<GT>>
std::string nonplanar_certificate_to_gexf (const Planarity_Test_Result< GT > &result, Node_Label node_label=Node_Label(), const NonPlanar_Certificate_Export_Options &options=NonPlanar_Certificate_Export_Options())
 Export non-planar certificate as GEXF.
 
double geom_number_to_double (const Geom_Number &n)
 Converts a Geom_Number to its double precision representation.
 
const Geom_Number & geom_pi ()
 High-precision pi value for computations that require Geom_Number.
 
Geom_Number area_of_parallelogram (const Point &a, const Point &b, const Point &c)
 Compute the signed area of the parallelogram defined by vectors a->b and a->c.
 
Geom_Number euclidean_distance (const Geom_Number &x, const Geom_Number &y)
 Euclidean distance (hypotenuse) of the vector (x, y).
 
Geom_Number pitag (const Geom_Number &x, const Geom_Number &y)
 
Geom_Number arctan (const Geom_Number &m)
 Arc tangent of m (wrapper over mpfr).
 
Geom_Number arctan2 (const Geom_Number &m, const Geom_Number &n)
 Two-argument arc tangent (wrapper over mpfr).
 
Geom_Number sinus (const Geom_Number &x)
 Sine of x (wrapper over mpfr).
 
Geom_Number cosinus (const Geom_Number &x)
 Cosine of x (wrapper over mpfr).
 
Geom_Number square_root (const Geom_Number &x)
 Square root of x (wrapper over mpfr).
 
Point operator* (const Geom_Number &s, const Point &p)
 Scalar multiplication with commutative order.
 
size_t approximate_string_size (const std::string &str)
 Estimate the count of printable characters in a LaTeX string.
 
Orientation orientation (const Point &a, const Point &b, const Point &c)
 Return the orientation of the triple (a, b, c).
 
Geom_Number in_circle_determinant (const Point &a, const Point &b, const Point &c, const Point &p)
 Return the exact in-circle determinant for (a,b,c,p).
 
InCircleResult in_circle (const Point &a, const Point &b, const Point &c, const Point &p)
 Classify point p against circumcircle of triangle (a,b,c), exactly.
 
bool on_segment (const Segment &s, const Point &p)
 Return true if p lies on segment s (exact).
 
bool segments_intersect (const Segment &s1, const Segment &s2)
 Return true if segments s1 and s2 intersect (including endpoints).
 
bool segments_intersect (const Point &a, const Point &b, const Point &c, const Point &d)
 Return true if segments (a,b) and (c,d) intersect (including endpoints).
 
Point segment_intersection_point (const Segment &s1, const Segment &s2)
 Compute the exact intersection point of segments s1 and s2.
 
Geom_Number area_of_triangle (const Point &a, const Point &b, const Point &c)
 Return the (unsigned) area of triangle (a, b, c) as an exact rational.
 
Geom_Number scalar_triple_product (const Point3D &a, const Point3D &b, const Point3D &c)
 Scalar triple product: a · (b × c).
 
std::ostream & operator<< (std::ostream &o, const Point &p)
 
std::ostream & operator<< (std::ostream &o, const Segment &s)
 
std::ostream & operator<< (std::ostream &o, const Triangle &t)
 
std::ostream & operator<< (std::ostream &o, const Rectangle &r)
 
std::ostream & operator<< (std::ostream &o, const Ellipse &e)
 
std::ostream & operator<< (std::ostream &o, const RotatedEllipse &e)
 
std::ostream & operator<< (std::ostream &o, const Point3D &p)
 
std::ostream & operator<< (std::ostream &o, const Segment3D &s)
 
std::ostream & operator<< (std::ostream &o, const Triangle3D &t)
 
std::ostream & operator<< (std::ostream &o, const Tetrahedron &t)
 
Geom_Number area_of_triangle_legacy (const Point &a, const Point &b, const Point &c)
 
bool points_are_colinear (const Point &a, const Point &b, const Point &c)
 
bool c_is_to_left_ (const Point &a, const Point &b, const Point &c)
 
bool is_clockwise (const Point &a, const Point &b, const Point &c)
 
bool left_on (const Point &a, const Point &b, const Point &c)
 
bool proper_intersection (const Point &a, const Point &b, const Point &c, const Point &d)
 
bool between (const Point &a, const Point &b, const Point &c)
 
bool intersect_improp (const Point &a, const Point &b, const Point &c, const Point &d)
 
bool intersectp (const Point &a, const Point &b, const Point &c, const Point &d)
 
Array< uint64_t > pollard_rho (uint64_t n)
 Compute the prime factorization of a number using Pollard's rho.
 
std::ostream & operator<< (std::ostream &o, const Polygon &p)
 Output stream operator for Polygon.
 
std::ostream & operator<< (std::ostream &o, const Regular_Polygon &p)
 Output stream operator for Regular_Polygon.
 
bool miller_rabin (uint64_t n) noexcept
 Miller-Rabin primality test for 64-bit integers.
 
template<class Node >
bool test_black_condition_rk (Node *p, int &max, int bh=0)
 Test the black height condition for a red-black tree.
 
template<class Node >
int red_black_height_rk (Node *p) noexcept
 Black height of a ranked red-black subtree, checking all its nodes.
 
template<class Node >
bool is_red_black_rk (Node *node)
 Verify if tree rooted at node is a valid red-black tree.
 
template<class Node >
bool is_red_black_tree_rk (Node *node)
 Verify if tree is a valid red-black tree with correct counters.
 
template<class Node , class Compare >
bool is_red_black_bst_rk (Node *node, Compare &cmp)
 Verify that tree rooted at node is a valid red-black BST with counters.
 
template<std::input_iterator Itor, std::sentinel_for< Itor > Sent>
auto reservoir_sample (Itor beg, Sent end, size_t k, unsigned long seed=static_cast< unsigned long >(std::chrono::high_resolution_clock::now().time_since_epoch().count()))
 Convenience function to sample k elements from a range.
 
template<typename Move , typename Priority , typename BetterPriority >
void sort_ranked_moves (Array< RankedMove< Move, Priority > > &moves, BetterPriority better_priority, const bool prefer_killer, const bool prefer_history)
 Sort one materialized move batch using priority and optional hooks.
 
constexpr size_t compiler_ssa_invalid_id () noexcept
 Returns the sentinel invalid SSA id.
 
const char * compiler_ssa_instruction_kind_name (const Compiler_SSA_Instruction_Kind kind) noexcept
 Returns a stable debug name for an SSA instruction kind.
 
Compiler_SSA_Validation_Report validate_ssa_function (const Compiler_SSA_Function &function, const Compiler_SSA_Module *module=nullptr)
 Validates one SSA function structurally and semantically.
 
Compiler_SSA_Validation_Report validate_ssa_module (const Compiler_SSA_Module &module)
 Validates all functions in one SSA module.
 
std::string compiler_dump_ssa_function (const Compiler_SSA_Function *function, const Compiler_SSA_Module *module=nullptr, const Compiler_Type_Context *types=nullptr)
 Dumps one SSA function deterministically.
 
std::string compiler_dump_ssa_module (const Compiler_SSA_Module *module, const Compiler_Type_Context *types=nullptr)
 Dumps all SSA functions in one module deterministically.
 
template<typename Container >
auto sum (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute the sum of elements.
 
template<typename Container >
auto mean (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute the arithmetic mean.
 
template<typename Container >
auto variance (const Container &data, bool population=false) -> std::decay_t< decltype(*std::begin(data))>
 Compute variance using Welford's numerically stable algorithm.
 
template<typename Container >
auto stddev (const Container &data, bool population=false) -> std::decay_t< decltype(*std::begin(data))>
 Compute standard deviation.
 
template<typename Container >
auto min_value (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute minimum value.
 
template<typename Container >
auto max_value (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute maximum value.
 
template<typename Container >
auto min_max (const Container &data) -> std::pair< std::decay_t< decltype(*std::begin(data))>, std::decay_t< decltype(*std::begin(data))> >
 Compute minimum and maximum values in one pass.
 
template<typename Container >
auto percentile (const Container &data, double p) -> std::decay_t< decltype(*std::begin(data))>
 Compute a percentile value.
 
template<typename Container >
auto median (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute the median (50th percentile).
 
template<typename Container >
auto quartiles (const Container &data) -> std::tuple< std::decay_t< decltype(*std::begin(data))>, std::decay_t< decltype(*std::begin(data))>, std::decay_t< decltype(*std::begin(data))> >
 Compute quartiles (Q1, Q2, Q3).
 
template<typename Container >
auto iqr (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute the interquartile range (IQR = Q3 - Q1).
 
template<typename Container >
auto mode (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute the mode (most frequent value).
 
template<typename Container >
bool is_multimodal (const Container &data)
 Check if data is multimodal.
 
template<typename Container >
auto skewness (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute skewness (measure of asymmetry).
 
template<typename Container >
auto kurtosis (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute excess kurtosis (measure of tailedness).
 
template<typename Container >
auto coefficient_of_variation (const Container &data) -> std::decay_t< decltype(*std::begin(data))>
 Compute coefficient of variation (CV = stddev / mean).
 
template<typename Container1 , typename Container2 >
auto covariance (const Container1 &x, const Container2 &y, bool population=false) -> std::decay_t< decltype(*std::begin(x))>
 Compute covariance between two datasets.
 
template<typename Container1 , typename Container2 >
auto correlation (const Container1 &x, const Container2 &y) -> std::decay_t< decltype(*std::begin(x))>
 Compute Pearson correlation coefficient.
 
template<typename Container >
auto histogram (const Container &data, size_t num_bins) -> std::vector< std::pair< std::decay_t< decltype(*std::begin(data))>, size_t > >
 Compute a histogram of the data.
 
template<typename Container >
auto compute_all_stats (const Container &data) -> Stats< std::decay_t< decltype(*std::begin(data))> >
 Compute all statistics for a dataset.
 
template<class T >
void compute_stats (T *data, int l, int r, T &avg, T &var, T &med, T &_min, T &_max)
 Compute basic descriptive statistics for an array range.
 
template<typename Container >
void compute_stats (const Container &data, std::decay_t< decltype(*std::begin(data))> &avg, std::decay_t< decltype(*std::begin(data))> &var, std::decay_t< decltype(*std::begin(data))> &med, std::decay_t< decltype(*std::begin(data))> &_min, std::decay_t< decltype(*std::begin(data))> &_max)
 Compute basic descriptive statistics for a container.
 
double search_elapsed_ms (const SearchClock::duration &duration) noexcept
 
template<SearchMove Move>
void reserve_search_path (SearchPath< Move > &path, const SearchLimits &limits)
 
template<IDAStarDomain Domain>
auto ida_star_search (Domain domain, typename Domain::State initial_state, ExplorationPolicy policy={}, SearchLimits limits={})
 Convenience wrapper for a one-shot IDA* search.
 
template<IDAStarDomain Domain, typename OnSolution >
requires SearchSolutionVisitor<OnSolution, SearchSolution<typename Domain::State, typename Domain::Move>>
auto ida_star_search (Domain domain, typename Domain::State initial_state, OnSolution &on_solution, ExplorationPolicy policy={}, SearchLimits limits={})
 Convenience wrapper for IDA* with a solution callback.
 
size_t levenshtein_distance (const std::string_view a, const std::string_view b)
 Levenshtein distance (insert/delete/substitute each cost 1).
 
size_t edit_distance (const std::string_view a, const std::string_view b)
 Alias for Levenshtein distance.
 
size_t damerau_levenshtein_distance (const std::string_view a, const std::string_view b)
 Damerau-Levenshtein distance with adjacent transpositions.
 
LCS_Result longest_common_subsequence (const std::string_view a, const std::string_view b)
 Compute Longest Common Subsequence.
 
Longest_Common_Substring_Result longest_common_substring (const std::string_view a, const std::string_view b)
 Compute the longest common substring (contiguous) between two strings.
 
Manacher_Result manacher (const std::string_view text)
 Compute palindromic radii and the longest palindrome with Manacher.
 
std::string longest_palindromic_substring (const std::string_view text)
 Convenience wrapper returning only the longest palindromic substring.
 
Array< size_t > kmp_prefix_function (const std::string_view pattern)
 Prefix-function used by KMP.
 
Array< size_t > kmp_search (const std::string_view text, const std::string_view pattern)
 Find all occurrences of a pattern using KMP.
 
Array< size_t > z_algorithm (const std::string_view s)
 Compute Z-array for a string.
 
Array< size_t > z_search (const std::string_view text, const std::string_view pattern)
 Find all occurrences of a pattern using the Z-algorithm.
 
Array< size_t > boyer_moore_horspool_search (const std::string_view text, const std::string_view pattern)
 Find all occurrences using Boyer-Moore-Horspool.
 
Array< size_t > rabin_karp_search (const std::string_view text, const std::string_view pattern, const uint64_t base=911382323ull)
 Find all occurrences using Rabin-Karp with rolling hash.
 
template<std::integral T>
Subset_Sum_Result< T > subset_sum (const Array< T > &values, T target)
 Solve the subset sum problem via classical DP with reconstruction.
 
template<std::integral T>
bool subset_sum_exists (const Array< T > &values, T target)
 Check if a subset summing to target exists (space-optimized).
 
template<std::integral T>
size_t subset_sum_count (const Array< T > &values, T target)
 Count the number of subsets that sum to target.
 
template<std::integral T>
Subset_Sum_Result< T > subset_sum_mitm (const Array< T > &values, T target)
 Solve the subset sum problem via meet-in-the-middle (MITM).
 
Array< size_t > suffix_array (const std::string_view text)
 Build suffix array with doubling algorithm.
 
Array< size_t > lcp_array_kasai (const std::string_view text, const Array< size_t > &sa)
 Compute LCP array from text and suffix array using Kasai.
 
std::string longest_common_substring_sam (const std::string_view a, const std::string_view b)
 Convenience function: LCS via suffix automaton.
 
ThreadPool & default_pool ()
 Return the default shared thread pool instance.
 
template<typename Iterator , typename F >
void parallel_for (ThreadPool &pool, Iterator begin, Iterator end, F &&f, size_t chunk_size=0)
 Execute a function in parallel over a range.
 
template<typename Iterator , typename F >
void parallel_for (Iterator begin, Iterator end, F &&f, const ParallelOptions &options={})
 Execute a function in parallel over a range with explicit options.
 
template<typename InputIt , typename OutputIt , typename F >
OutputIt parallel_transform (ThreadPool &pool, InputIt first, InputIt last, OutputIt d_first, F &&f, size_t chunk_size=0)
 Transform elements in parallel and store results.
 
template<typename InputIt , typename OutputIt , typename F >
OutputIt parallel_transform (InputIt first, InputIt last, OutputIt d_first, F &&f, const ParallelOptions &options={})
 Parallel transform with explicit options.
 
template<typename Iterator , typename T , typename BinaryOp >
T parallel_reduce (ThreadPool &pool, Iterator first, Iterator last, T init, BinaryOp op, size_t chunk_size=0)
 Reduce elements in parallel.
 
template<typename Iterator , typename T , typename BinaryOp >
T parallel_reduce (Iterator first, Iterator last, T init, BinaryOp op, const ParallelOptions &options={})
 Parallel reduce with explicit options.
 
template<typename F >
void parallel_for_index (ThreadPool &pool, size_t start, size_t end, F &&f, size_t chunk_size=0)
 Apply a function to each element in parallel (index-based).
 
template<typename F >
void parallel_for_index (size_t start, size_t end, F &&f, const ParallelOptions &options={})
 Parallel index loop with explicit options.
 
template<typename... Fs>
void parallel_invoke (ThreadPool &pool, Fs &&... fs)
 Invoke a small set of related callables in parallel.
 
template<typename... Fs>
void parallel_invoke (const ParallelOptions &options, Fs &&... fs)
 parallel_invoke with explicit options.
 
template<typename InputIt , typename OutputIt , typename BinaryOp >
OutputIt pscan (ThreadPool &pool, InputIt first, InputIt last, OutputIt d_first, BinaryOp op, size_t chunk_size=0)
 Inclusive prefix scan over a range.
 
template<typename InputIt , typename OutputIt , typename BinaryOp >
OutputIt pscan (InputIt first, InputIt last, OutputIt d_first, BinaryOp op, const ParallelOptions &options={})
 Inclusive prefix scan with explicit options.
 
template<typename InputIt , typename OutputIt , typename T , typename BinaryOp >
OutputIt pexclusive_scan (ThreadPool &pool, InputIt first, InputIt last, OutputIt d_first, T init, BinaryOp op, size_t chunk_size=0)
 Exclusive prefix scan over a range.
 
template<typename InputIt , typename OutputIt , typename T , typename BinaryOp >
OutputIt pexclusive_scan (InputIt first, InputIt last, OutputIt d_first, T init, BinaryOp op, const ParallelOptions &options={})
 Exclusive prefix scan with explicit options.
 
template<typename InputIt1 , typename InputIt2 , typename OutputIt , typename Compare = std::less<>>
OutputIt pmerge (ThreadPool &pool, InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first, Compare comp=Compare{}, size_t chunk_size=0)
 Merge two sorted ranges in parallel.
 
template<typename InputIt1 , typename InputIt2 , typename OutputIt , typename Compare = std::less<>>
OutputIt pmerge (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt d_first, Compare comp=Compare{}, const ParallelOptions &options={})
 Parallel merge with explicit options.
 
void append_unique_tikz_library (Array< std::string > &libraries, const std::string &library)
 Append library into libraries unless already present.
 
Tikz_Style make_tikz_draw_style (const std::string &draw_color)
 Create a basic draw style with a custom color.
 
Tikz_Style make_tikz_fill_style (const std::string &draw_color, const std::string &fill_color)
 Create a basic fill style with custom draw/fill colors.
 
template<TikzDrawable Geom>
void put_in_plane (Tikz_Plane &plane, const Geom &geom_obj)
 Insert any supported geometry type in a Tikz_Plane.
 
template<TikzDrawable Geom>
void put_in_plane (Tikz_Plane &plane, const Geom &geom_obj, const Tikz_Style &style, const int layer=Tikz_Plane::Layer_Default)
 Insert any supported geometry type with style/layer.
 
void put_quadratic_bezier_in_plane (Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const size_t subdivisions=64, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
 Approximate and insert a quadratic Bézier as an open polyline.
 
void put_cubic_bezier_in_plane (Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const Point &p3, const size_t subdivisions=64, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
 Approximate and insert a cubic Bézier as an open polyline.
 
void put_quadratic_bezier_native_in_plane (Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
 Insert a quadratic Bézier using native TikZ controls syntax.
 
void put_cubic_bezier_native_in_plane (Tikz_Plane &plane, const Point &p0, const Point &p1, const Point &p2, const Point &p3, const Tikz_Style &style={}, const int layer=Tikz_Plane::Layer_Default)
 Insert a cubic Bézier using native TikZ controls syntax.
 
void put_point_label_in_plane (Tikz_Plane &plane, const Point &point, const std::string &label, const std::string &placement="above", const Tikz_Style &style=make_tikz_draw_style("black"), const int layer=Tikz_Plane::Layer_Overlay)
 Insert a point label with configurable placement (above, etc.).
 
Tikz_Style tikz_points_style (const std::string &color="black", const double opacity=-1.0)
 Creates a style optimized for point clouds.
 
Tikz_Style tikz_wire_style (const std::string &color="black", const bool dashed=false, const bool with_arrow=false)
 Creates a style optimized for wireframe segments and polygons.
 
Tikz_Style tikz_path_style (const std::string &color="red", const bool with_arrow=false)
 Creates a style optimized for polyline paths.
 
Tikz_Style tikz_bold_wire_style (const std::string &color, const double width_mm=1.2)
 Creates a solid wireframe style with an explicit line width.
 
Tikz_Style tikz_area_style (const std::string &draw_color="black", const std::string &fill_color="gray!25", const double opacity=0.6)
 Creates a style for drawing filled polygons.
 
void put_points (Tikz_Plane &plane, const Array< Point > &pts, const Tikz_Style &style=tikz_points_style(), const int layer=Tikz_Plane::Layer_Default)
 Inserts all points from an Array<Point> into the plane.
 
void put_points (Tikz_Plane &plane, const DynList< Point > &pts, const Tikz_Style &style=tikz_points_style(), const int layer=Tikz_Plane::Layer_Default)
 Inserts all points from a DynList<Point> into the plane.
 
void put_point_labels (Tikz_Plane &plane, const Array< Point > &pts, const std::string &prefix="p", const std::string &placement="above right", const Tikz_Style &style=make_tikz_draw_style("black"), const int layer=Tikz_Plane::Layer_Overlay)
 Adds a text label to each point in an Array<Point>.
 
void put_point_labels (Tikz_Plane &plane, const DynList< Point > &pts, const std::string &prefix="p", const std::string &placement="above right", const Tikz_Style &style=make_tikz_draw_style("black"), const int layer=Tikz_Plane::Layer_Overlay)
 Adds a text label to each point in a DynList<Point>.
 
void put_polygons (Tikz_Plane &plane, const Array< Polygon > &polys, const Tikz_Style &style=tikz_wire_style(), const int layer=Tikz_Plane::Layer_Default)
 Inserts all polygons from an Array<Polygon> into the plane.
 
void put_polygon_vertices (Tikz_Plane &plane, const Polygon &poly, const Tikz_Style &style=tikz_points_style(), const int layer=Tikz_Plane::Layer_Overlay)
 Inserts the vertices of a polygon as styled points.
 
void put_polygon_vertices (Tikz_Plane &plane, const Regular_Polygon &poly, const Tikz_Style &style=tikz_points_style(), const int layer=Tikz_Plane::Layer_Overlay)
 Inserts the vertices of a regular polygon as styled points.
 
Polygon polygon_from_vertices (const Array< Point > &vertices, const bool close=true)
 Constructs a Polygon from an ordered array of vertices.
 
Polygon polygon_from_vertex_indices (const Array< Point > &vertices, const DynList< size_t > &indices, const bool close=true)
 Constructs a Polygon from a list of indices into a vertex array.
 
template<typename HullAlgorithm >
Polygon visualize_convex_hull (Tikz_Plane &plane, const DynList< Point > &points, const HullAlgorithm &hull_algorithm, const Tikz_Style &point_style=tikz_points_style("black", 0.6), const Tikz_Style &hull_style=tikz_wire_style("red"), const Tikz_Style &hull_vertex_style=tikz_points_style("red"), const int point_layer=Tikz_Plane::Layer_Default, const int hull_layer=Tikz_Plane::Layer_Foreground, const bool draw_hull_vertices=true)
 Runs a convex hull algorithm and visualizes the result.
 
Polygon visualize_convex_intersection (Tikz_Plane &plane, const Polygon &subject, const Polygon &clip, const ConvexPolygonIntersectionBasic &intersection_algorithm={}, const Tikz_Style &subject_style=tikz_area_style("blue", "blue!15", 0.45), const Tikz_Style &clip_style=tikz_area_style("orange", "orange!20", 0.45), const Tikz_Style &result_style=tikz_area_style("red", "red!30", 0.60), const int input_layer=Tikz_Plane::Layer_Default, const int result_layer=Tikz_Plane::Layer_Foreground)
 Visualizes the intersection of two convex polygons.
 
Array< Polygon > visualize_boolean_operation (Tikz_Plane &plane, const Polygon &a, const Polygon &b, const BooleanPolygonOperations::Op op, const BooleanPolygonOperations &bop={}, const Tikz_Style &a_style=tikz_area_style("blue", "blue!15", 0.35), const Tikz_Style &b_style=tikz_area_style("green!60!black", "green!20", 0.35), const Tikz_Style &result_style=tikz_area_style("red", "red!35", 0.65), const int input_layer=Tikz_Plane::Layer_Default, const int result_layer=Tikz_Plane::Layer_Foreground)
 Visualizes a boolean operation (union, intersection, difference) on two polygons.
 
void put_delaunay_result (Tikz_Plane &plane, const DelaunayTriangulationBowyerWatson::Result &dt, const Tikz_Style &triangle_style=tikz_wire_style("blue"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"), const int triangle_layer=Tikz_Plane::Layer_Default, const int site_layer=Tikz_Plane::Layer_Foreground)
 Insert Delaunay triangulation as triangle outlines.
 
DelaunayTriangulationBowyerWatson::Result visualize_delaunay (Tikz_Plane &plane, const DynList< Point > &points, const DelaunayTriangulationBowyerWatson &algorithm={}, const Tikz_Style &triangle_style=tikz_wire_style("blue"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
 Compute and insert Delaunay triangulation as triangle outlines.
 
Point ray_endpoint (const Point &src, const Point &direction, const Geom_Number &length)
 
template<typename VoronoiResult >
void put_voronoi_result (Tikz_Plane &plane, const VoronoiResult &vor, const bool draw_cells=false, const Tikz_Style &cell_style=tikz_area_style("gray!50!black", "gray!15", 0.35), const Tikz_Style &edge_style=tikz_wire_style("black"), const Tikz_Style &unbounded_edge_style=tikz_wire_style("black", true, true), const Tikz_Style &site_style=tikz_points_style("red"), const Geom_Number &unbounded_ray_length=Geom_Number(50), const int cell_layer=Tikz_Plane::Layer_Background, const int edge_layer=Tikz_Plane::Layer_Default, const int site_layer=Tikz_Plane::Layer_Foreground)
 Insert Voronoi diagram structures (cells, edges, sites).
 
VoronoiDiagram::Result visualize_voronoi (Tikz_Plane &plane, const DynList< Point > &sites, const VoronoiDiagram &algorithm={}, const bool draw_cells=false, const Tikz_Style &cell_style=tikz_area_style("gray!50!black", "gray!15", 0.35), const Tikz_Style &edge_style=tikz_wire_style("black"), const Tikz_Style &unbounded_edge_style=tikz_wire_style("black", true, true), const Tikz_Style &site_style=tikz_points_style("red"), const Geom_Number &unbounded_ray_length=Geom_Number(50))
 Compute and insert Voronoi diagram for input sites.
 
void put_power_diagram_result (Tikz_Plane &plane, const PowerDiagram::Result &pd, const bool draw_cells=true, const Tikz_Style &cell_style=tikz_area_style("violet", "violet!18", 0.35), const Tikz_Style &edge_style=tikz_wire_style("violet"), const Tikz_Style &site_style=tikz_points_style("purple"), const int cell_layer=Tikz_Plane::Layer_Background, const int edge_layer=Tikz_Plane::Layer_Default, const int site_layer=Tikz_Plane::Layer_Foreground)
 Insert Power diagram structures (cells, edges, weighted sites).
 
PowerDiagram::Result visualize_power_diagram (Tikz_Plane &plane, const Array< PowerDiagram::WeightedSite > &sites, const PowerDiagram &algorithm={}, const bool draw_cells=true, const Tikz_Style &cell_style=tikz_area_style("violet", "violet!18", 0.35), const Tikz_Style &edge_style=tikz_wire_style("violet"), const Tikz_Style &site_style=tikz_points_style("purple"))
 Compute and insert Power diagram for weighted sites.
 
void put_segment_arrangement_result (Tikz_Plane &plane, const SegmentArrangement::Result &arrangement, const bool draw_faces=true, const bool draw_vertices=true, const bool draw_unbounded_face=false, const Tikz_Style &face_style=tikz_area_style("teal!60!black", "teal!12", 0.30), const Tikz_Style &edge_style=tikz_wire_style("teal!70!black"), const Tikz_Style &vertex_style=tikz_points_style("teal!70!black"), const int face_layer=Tikz_Plane::Layer_Background, const int edge_layer=Tikz_Plane::Layer_Default, const int vertex_layer=Tikz_Plane::Layer_Foreground, const bool color_faces_by_index=false)
 Insert segment arrangement structures (faces, edges, vertices).
 
SegmentArrangement::Result visualize_segment_arrangement (Tikz_Plane &plane, const Array< Segment > &segments, const SegmentArrangement &algorithm={}, const bool draw_faces=true, const bool draw_vertices=true, const bool draw_unbounded_face=false, const Tikz_Style &face_style=tikz_area_style("teal!60!black", "teal!12", 0.30), const Tikz_Style &edge_style=tikz_wire_style("teal!70!black"), const Tikz_Style &vertex_style=tikz_points_style("teal!70!black"), const bool color_faces_by_index=false)
 Compute and insert arrangement for input segments.
 
void put_kdtree_partitions_result (Tikz_Plane &plane, const KDTreePointSearch::DebugSnapshot &snapshot, const bool draw_partition_boxes=false, const bool draw_points=true, const Tikz_Style &partition_style=tikz_wire_style("gray!55", true), const Tikz_Style &split_style=tikz_wire_style("blue!70"), const Tikz_Style &point_style=tikz_points_style("red"), const int partition_layer=Tikz_Plane::Layer_Background, const int split_layer=Tikz_Plane::Layer_Default, const int point_layer=Tikz_Plane::Layer_Foreground)
 Draw KD-tree partitions from a debug snapshot.
 
KDTreePointSearch::DebugSnapshot visualize_kdtree_partitions (Tikz_Plane &plane, const KDTreePointSearch &kd_tree, const bool draw_partition_boxes=false, const bool draw_points=true, const Tikz_Style &partition_style=tikz_wire_style("gray!55", true), const Tikz_Style &split_style=tikz_wire_style("blue!70"), const Tikz_Style &point_style=tikz_points_style("red"))
 Visualize KD-tree recursive space partitions.
 
void put_range_tree_result (Tikz_Plane &plane, const RangeTree2D::DebugSnapshot &snapshot, const bool draw_points=true, const Rectangle *query_rect=nullptr, const DynList< Point > *query_hits=nullptr, const Tikz_Style &split_style=tikz_wire_style("purple"), const Tikz_Style &point_style=tikz_points_style("black"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_points_style("red"), const int split_layer=Tikz_Plane::Layer_Default, const int point_layer=Tikz_Plane::Layer_Foreground)
 Draw range-tree X-axis hierarchy and optional query highlights.
 
RangeTree2D::DebugSnapshot visualize_range_tree (Tikz_Plane &plane, const RangeTree2D &tree, const bool draw_points=true, const Tikz_Style &split_style=tikz_wire_style("purple"), const Tikz_Style &point_style=tikz_points_style("black"))
 Visualize range-tree structure without a query overlay.
 
RangeTreeQueryVizResult visualize_range_tree_query (Tikz_Plane &plane, const RangeTree2D &tree, const Rectangle &query_rect, const bool draw_points=true, const Tikz_Style &split_style=tikz_wire_style("purple"), const Tikz_Style &point_style=tikz_points_style("black"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_points_style("red"))
 Visualize range-tree plus a query rectangle and matching points.
 
void put_aabb_tree_result (Tikz_Plane &plane, const AABBTree::DebugSnapshot &snapshot, const Rectangle *query_rect=nullptr, const Array< size_t > *query_hit_ids=nullptr, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_wire_style("red"), const int node_layer=Tikz_Plane::Layer_Default, const int query_layer=Tikz_Plane::Layer_Foreground)
 Draw AABB tree hierarchy and optional query results.
 
AABBTree::DebugSnapshot visualize_aabb_tree (Tikz_Plane &plane, const AABBTree &tree, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"))
 Visualize AABB tree hierarchy.
 
AABBTreeQueryVizResult visualize_aabb_tree_query (Tikz_Plane &plane, const AABBTree &tree, const Rectangle &query_rect, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_wire_style("red"))
 Visualize AABB tree with a rectangle query overlay.
 
template<typename Snapshot >
void put_rtree_result (Tikz_Plane &plane, const Snapshot &snapshot, const Rectangle *query_rect=nullptr, const Array< Rectangle > *query_hit_boxes=nullptr, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"), const Tikz_Style &entry_bbox_style=tikz_wire_style("gray!55"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_wire_style("red"), const int node_layer=Tikz_Plane::Layer_Default, const int entry_layer=Tikz_Plane::Layer_Default, const int query_layer=Tikz_Plane::Layer_Foreground)
 Draw every node MBR (colored by depth) of an R-tree/R*-tree snapshot, plus its leaf entry boxes, an optional query rectangle, and its optional hit boxes.
 
template<typename Payload , size_t MaxEntries, size_t MinEntries, RTreeVariant Variant>
RTree< Payload, MaxEntries, MinEntries, Variant >::DebugSnapshot visualize_rtree (Tikz_Plane &plane, const RTree< Payload, MaxEntries, MinEntries, Variant > &tree, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"), const Tikz_Style &entry_bbox_style=tikz_wire_style("gray!55"))
 Visualize an R-tree/R*-tree hierarchy (node MBRs by depth, plus leaf entry boxes).
 
template<typename Payload , size_t MaxEntries, size_t MinEntries, RTreeVariant Variant>
RTreeQueryVizResult< Payload, MaxEntries, MinEntries, Variant > visualize_rtree_query (Tikz_Plane &plane, const RTree< Payload, MaxEntries, MinEntries, Variant > &tree, const Rectangle &query_rect, const Tikz_Style &node_bbox_style=tikz_wire_style("teal!70!black"), const Tikz_Style &leaf_bbox_style=tikz_wire_style("blue!70"), const Tikz_Style &entry_bbox_style=tikz_wire_style("gray!55"), const Tikz_Style &query_rect_style=tikz_wire_style("red", true), const Tikz_Style &query_hit_style=tikz_wire_style("red"))
 Visualize an R-tree/R*-tree with a rectangle query overlay, highlighting every entry whose bbox intersects query_rect.
 
void put_path (Tikz_Plane &plane, const DynList< Point > &path, const Tikz_Style &segment_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int segment_layer=Tikz_Plane::Layer_Foreground, const int waypoint_layer=Tikz_Plane::Layer_Overlay)
 Insert a point path as connected segments and optional waypoints.
 
void put_path (Tikz_Plane &plane, const Array< Point > &path, const Tikz_Style &segment_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int segment_layer=Tikz_Plane::Layer_Foreground, const int waypoint_layer=Tikz_Plane::Layer_Overlay)
 Insert an Array<Point> path as connected segments and waypoints.
 
void put_portals (Tikz_Plane &plane, const Array< FunnelPortal > &portals, const bool skip_degenerate=true, const Tikz_Style &portal_style=tikz_wire_style("purple", true), const int portal_layer=Tikz_Plane::Layer_Default)
 Insert funnel portals as segment connectors.
 
FunnelTraceResult compute_shortest_path_funnel_trace (const Polygon &polygon, const Point &source, const Point &target)
 Compute a full SSFA trace (portal-by-portal states).
 
void put_funnel_trace_step (Tikz_Plane &plane, const Polygon &polygon, const Point &source, const Point &target, const FunnelTraceResult &trace, size_t step_index, const Tikz_Style &polygon_style=tikz_area_style("black", "gray!15", 0.22), const Tikz_Style &source_style=tikz_points_style("green!50!black"), const Tikz_Style &target_style=tikz_points_style("blue"), const Tikz_Style &all_portals_style=tikz_wire_style("purple", true), const Tikz_Style &active_portal_style=tikz_path_style("purple"), const Tikz_Style &funnel_leg_style=tikz_path_style("orange!90!black"), const Tikz_Style &committed_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int polygon_layer=Tikz_Plane::Layer_Default, const int portal_layer=Tikz_Plane::Layer_Foreground, const int highlight_layer=Tikz_Plane::Layer_Overlay)
 Render one funnel-trace frame in a plane.
 
DynList< Point > visualize_shortest_path_in_polygon (Tikz_Plane &plane, const Polygon &polygon, const Point &source, const Point &target, const ShortestPathInPolygon &algorithm={}, const Tikz_Style &polygon_style=tikz_area_style("black", "gray!15", 0.25), const Tikz_Style &source_style=tikz_points_style("green!50!black"), const Tikz_Style &target_style=tikz_points_style("blue"), const Tikz_Style &path_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int polygon_layer=Tikz_Plane::Layer_Default, const int path_layer=Tikz_Plane::Layer_Foreground)
 Visualize the shortest path inside a simple polygon.
 
ShortestPathDebugResult visualize_shortest_path_with_portals (Tikz_Plane &plane, const Polygon &polygon, const Point &source, const Point &target, const ShortestPathInPolygon &algorithm={}, const Tikz_Style &polygon_style=tikz_area_style("black", "gray!15", 0.25), const Tikz_Style &source_style=tikz_points_style("green!50!black"), const Tikz_Style &target_style=tikz_points_style("blue"), const Tikz_Style &portal_style=tikz_wire_style("purple", true), const Tikz_Style &path_style=tikz_path_style("red"), const bool draw_waypoints=true, const Tikz_Style &waypoint_style=tikz_points_style("red"), const int polygon_layer=Tikz_Plane::Layer_Default, const int portal_layer=Tikz_Plane::Layer_Foreground, const int path_layer=Tikz_Plane::Layer_Overlay)
 Visualize the shortest path plus funnel portals.
 
void put_convex_decomposition_result (Tikz_Plane &plane, const Array< Polygon > &parts, const bool color_parts_by_index=true, const Tikz_Style &part_style=tikz_area_style("blue!60!black", "blue!15", 0.40), const int part_layer=Tikz_Plane::Layer_Default)
 Insert convex decomposition polygons.
 
Array< Polygon > visualize_convex_decomposition (Tikz_Plane &plane, const Polygon &polygon, const ConvexPolygonDecomposition &algorithm={}, const bool draw_input_polygon=true, const Tikz_Style &input_style=tikz_wire_style("black", true), const bool color_parts_by_index=true, const Tikz_Style &part_style=tikz_area_style("blue!60!black", "blue!15", 0.40), const int input_layer=Tikz_Plane::Layer_Default, const int part_layer=Tikz_Plane::Layer_Foreground)
 Compute and insert convex decomposition for a polygon.
 
void put_alpha_shape_result (Tikz_Plane &plane, const AlphaShape::Result &alpha_shape, const bool draw_kept_triangles=false, const Tikz_Style &triangle_style=tikz_wire_style("gray!55"), const Tikz_Style &boundary_style=tikz_path_style("orange!90!black"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"), const int triangle_layer=Tikz_Plane::Layer_Background, const int boundary_layer=Tikz_Plane::Layer_Foreground, const int site_layer=Tikz_Plane::Layer_Overlay)
 Insert alpha-shape structures (kept triangles, boundary, sites).
 
AlphaShape::Result visualize_alpha_shape (Tikz_Plane &plane, const DynList< Point > &points, const Geom_Number &alpha_squared, const AlphaShape &algorithm={}, const bool draw_kept_triangles=false, const Tikz_Style &triangle_style=tikz_wire_style("gray!55"), const Tikz_Style &boundary_style=tikz_path_style("orange!90!black"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
 Compute and insert alpha-shape for input points.
 
void put_regular_triangulation_result (Tikz_Plane &plane, const RegularTriangulationBowyerWatson::Result &rt, const Tikz_Style &triangle_style=tikz_wire_style("blue!60"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"), const int triangle_layer=Tikz_Plane::Layer_Default, const int site_layer=Tikz_Plane::Layer_Foreground)
 Draw regular (weighted Delaunay) triangulation output.
 
RegularTriangulationBowyerWatson::Result visualize_regular_triangulation (Tikz_Plane &plane, const Array< RegularTriangulationBowyerWatson::WeightedSite > &weighted_sites, const RegularTriangulationBowyerWatson &algorithm={}, const Tikz_Style &triangle_style=tikz_wire_style("blue!60"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
 Compute and insert regular (weighted Delaunay) triangulation.
 
void put_closest_pair_result (Tikz_Plane &plane, const DynList< Point > &points, const ClosestPairDivideAndConquer::Result &result, const Tikz_Style &points_style=tikz_points_style("black"), const Tikz_Style &pair_style=tikz_path_style("red"), const Tikz_Style &pair_points_style=tikz_points_style("red"), const int points_layer=Tikz_Plane::Layer_Default, const int pair_layer=Tikz_Plane::Layer_Foreground)
 Draw closest-pair result over the full point set.
 
ClosestPairDivideAndConquer::Result visualize_closest_pair (Tikz_Plane &plane, const DynList< Point > &points, const ClosestPairDivideAndConquer &algorithm={}, const Tikz_Style &points_style=tikz_points_style("black"), const Tikz_Style &pair_style=tikz_path_style("red"), const Tikz_Style &pair_points_style=tikz_points_style("red"))
 Compute and draw the closest pair from an input point set.
 
void put_rotating_calipers_result (Tikz_Plane &plane, const Polygon &polygon, const RotatingCalipersResult &result, const Tikz_Style &polygon_style=tikz_wire_style("gray!55"), const Tikz_Style &diameter_style=tikz_path_style("red"), const Tikz_Style &width_style=tikz_path_style("blue"), const Tikz_Style &witness_style=tikz_points_style("orange!90!black"), const int polygon_layer=Tikz_Plane::Layer_Default, const int witness_layer=Tikz_Plane::Layer_Foreground)
 Draw diameter and minimum-width witnesses for a convex polygon.
 
RotatingCalipersResult visualize_rotating_calipers (Tikz_Plane &plane, const Polygon &polygon, const Tikz_Style &polygon_style=tikz_wire_style("gray!55"), const Tikz_Style &diameter_style=tikz_path_style("red"), const Tikz_Style &width_style=tikz_path_style("blue"), const Tikz_Style &witness_style=tikz_points_style("orange!90!black"))
 Compute and draw rotating-calipers diameter and minimum width.
 
void put_half_plane_intersection_result (Tikz_Plane &plane, const Array< HalfPlaneIntersection::HalfPlane > &halfplanes, const Polygon &intersection, const Tikz_Style &boundary_style=tikz_wire_style("gray!60", true, true), const Tikz_Style &result_style=tikz_area_style("red", "red!25", 0.50), const int boundary_layer=Tikz_Plane::Layer_Default, const int result_layer=Tikz_Plane::Layer_Foreground)
 Draw half-plane boundaries and their bounded intersection polygon.
 
Polygon visualize_half_plane_intersection (Tikz_Plane &plane, const Array< HalfPlaneIntersection::HalfPlane > &halfplanes, const HalfPlaneIntersection &algorithm={}, const Tikz_Style &boundary_style=tikz_wire_style("gray!60", true, true), const Tikz_Style &result_style=tikz_area_style("red", "red!25", 0.50))
 Compute and draw bounded half-plane intersection.
 
void put_minkowski_sum_result (Tikz_Plane &plane, const Polygon &first, const Polygon &second, const Polygon &result, const Tikz_Style &first_style=tikz_area_style("blue", "blue!14", 0.30), const Tikz_Style &second_style=tikz_area_style("green!60!black", "green!16", 0.30), const Tikz_Style &result_style=tikz_area_style("red", "red!26", 0.60), const int input_layer=Tikz_Plane::Layer_Default, const int result_layer=Tikz_Plane::Layer_Foreground)
 Draw input polygons and their Minkowski sum result.
 
Polygon visualize_minkowski_sum (Tikz_Plane &plane, const Polygon &first, const Polygon &second, const MinkowskiSumConvex &algorithm={}, const Tikz_Style &first_style=tikz_area_style("blue", "blue!14", 0.30), const Tikz_Style &second_style=tikz_area_style("green!60!black", "green!16", 0.30), const Tikz_Style &result_style=tikz_area_style("red", "red!26", 0.60))
 Compute and draw Minkowski sum of two convex polygons.
 
void put_monotone_triangulation_result (Tikz_Plane &plane, const Polygon &polygon, const DynList< Triangle > &triangles, const Tikz_Style &polygon_style=tikz_wire_style("black"), const Tikz_Style &triangle_style=tikz_wire_style("blue!65"), const int polygon_layer=Tikz_Plane::Layer_Default, const int triangle_layer=Tikz_Plane::Layer_Foreground)
 Draw a monotone triangulation result plus polygon boundary.
 
DynList< Triangle > visualize_monotone_triangulation (Tikz_Plane &plane, const Polygon &polygon, const MonotonePolygonTriangulation &algorithm={}, const Tikz_Style &polygon_style=tikz_wire_style("black"), const Tikz_Style &triangle_style=tikz_wire_style("blue!65"))
 Compute and draw triangulation via monotone partition pipeline.
 
void put_visibility_polygon_result (Tikz_Plane &plane, const Polygon &polygon, const Point &query_point, const Polygon &visibility_polygon, const Tikz_Style &polygon_style=tikz_wire_style("black"), const Tikz_Style &visibility_style=tikz_area_style("orange!90!black", "orange!25", 0.50), const Tikz_Style &query_style=tikz_points_style("red"), const int polygon_layer=Tikz_Plane::Layer_Default, const int visibility_layer=Tikz_Plane::Layer_Foreground)
 Draw visibility polygon with source polygon and query point.
 
Polygon visualize_visibility_polygon (Tikz_Plane &plane, const Polygon &polygon, const Point &query_point, const VisibilityPolygon &algorithm={}, const Tikz_Style &polygon_style=tikz_wire_style("black"), const Tikz_Style &visibility_style=tikz_area_style("orange!90!black", "orange!25", 0.50), const Tikz_Style &query_style=tikz_points_style("red"))
 Compute and draw visibility polygon from a query point.
 
void put_line_sweep_result (Tikz_Plane &plane, const Array< Segment > &segments, const Array< SweepLineSegmentIntersection::Intersection > &intersections, const Tikz_Style &segment_style=tikz_wire_style("blue!60"), const Tikz_Style &intersection_style=tikz_points_style("red"), const int segment_layer=Tikz_Plane::Layer_Default, const int intersection_layer=Tikz_Plane::Layer_Foreground)
 Draw line segments and all sweep-line intersection points.
 
Array< SweepLineSegmentIntersection::Intersection > visualize_line_sweep (Tikz_Plane &plane, const Array< Segment > &segments, const SweepLineSegmentIntersection &algorithm={}, const Tikz_Style &segment_style=tikz_wire_style("blue!60"), const Tikz_Style &intersection_style=tikz_points_style("red"))
 Compute and draw Bentley-Ottmann line-sweep intersections.
 
void put_cdt_result (Tikz_Plane &plane, const ConstrainedDelaunayTriangulation::Result &cdt, const Tikz_Style &triangle_style=tikz_wire_style("blue!60"), const Tikz_Style &constraint_style=tikz_path_style("red"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"), const int triangle_layer=Tikz_Plane::Layer_Default, const int constraint_layer=Tikz_Plane::Layer_Foreground, const int site_layer=Tikz_Plane::Layer_Overlay)
 Insert constrained Delaunay triangulation result.
 
ConstrainedDelaunayTriangulation::Result visualize_cdt (Tikz_Plane &plane, const DynList< Point > &points, const DynList< Segment > &constraints, const ConstrainedDelaunayTriangulation &algorithm={}, const Tikz_Style &triangle_style=tikz_wire_style("blue!60"), const Tikz_Style &constraint_style=tikz_path_style("red"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
 Compute and insert constrained Delaunay triangulation.
 
void put_mec_result (Tikz_Plane &plane, const MinimumEnclosingCircle::Circle &circle, const DynList< Point > &points, const Tikz_Style &circle_style=tikz_wire_style("blue!70"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"), const int circle_layer=Tikz_Plane::Layer_Default, const int site_layer=Tikz_Plane::Layer_Overlay)
 Draw a precomputed minimum enclosing circle result.
 
MinimumEnclosingCircle::Circle visualize_mec (Tikz_Plane &plane, const DynList< Point > &points, const MinimumEnclosingCircle &algorithm={}, const Tikz_Style &circle_style=tikz_wire_style("blue!70"), const bool draw_sites=true, const Tikz_Style &site_style=tikz_points_style("black"))
 Compute minimum enclosing circle and insert into plane.
 
void put_simplification_result (Tikz_Plane &plane, const Polygon &original, const Polygon &simplified, const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &simplified_style=tikz_bold_wire_style("blue!80"), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
 Draw original and simplified polygons overlaid.
 
Polygon visualize_douglas_peucker (Tikz_Plane &plane, const Polygon &poly, const Geom_Number &epsilon, const DouglasPeuckerSimplification &algorithm={}, const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &simplified_style=tikz_bold_wire_style("blue!80"), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
 Simplify a polygon with Douglas-Peucker and draw the result.
 
Polygon visualize_visvalingam_whyatt (Tikz_Plane &plane, const Polygon &poly, const Geom_Number &area_threshold, const VisvalingamWhyattSimplification &algorithm={}, const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &simplified_style=tikz_bold_wire_style("green!70!black"), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
 Simplify a polygon with Visvalingam-Whyatt and draw the result.
 
void put_offset_result (Tikz_Plane &plane, const Polygon &original, const PolygonOffset::Result &result, const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &offset_style=tikz_bold_wire_style("blue!80"), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
 Draw a polygon offset result overlaid on the original polygon.
 
PolygonOffset::Result visualize_polygon_offset (Tikz_Plane &plane, const Polygon &poly, const Geom_Number &distance, const PolygonOffset &algorithm={}, PolygonOffset::JoinType join=PolygonOffset::JoinType::Miter, const Geom_Number &miter_limit=Geom_Number(2), const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &offset_style=tikz_bold_wire_style("blue!80"), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
 Offset a polygon and draw the result.
 
void put_smoothing_result (Tikz_Plane &plane, const Polygon &original, const Polygon &smoothed, const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &smoothed_style=tikz_bold_wire_style("violet!80"), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
 Draw original and smoothed polygons overlaid.
 
Polygon visualize_chaikin_smoothing (Tikz_Plane &plane, const Polygon &poly, const size_t iterations, const Geom_Number &ratio=Geom_Number(1, 4), const Tikz_Style &original_style=tikz_wire_style("gray!50"), const Tikz_Style &smoothed_style=tikz_bold_wire_style("violet!80"), const bool draw_vertices=true, const Tikz_Style &vertex_style=tikz_points_style("red"))
 Smooth a polygon with Chaikin subdivision and draw the result.
 
void put_trapezoidal_map_result (Tikz_Plane &plane, const TrapezoidalMapPointLocation::Result &res, const Tikz_Style &segment_style=tikz_path_style("red"), const Tikz_Style &extension_style=tikz_wire_style("gray!60", true), const bool draw_trapezoids=true, const double trapezoid_opacity=0.3, const int trap_layer=Tikz_Plane::Layer_Background, const int seg_layer=Tikz_Plane::Layer_Foreground, const int ext_layer=Tikz_Plane::Layer_Default)
 Draw the trapezoidal map result into a Tikz_Plane.
 
TrapezoidalMapPointLocation::Result visualize_trapezoidal_map (Tikz_Plane &plane, const Array< Segment > &segments, const Tikz_Style &segment_style=tikz_path_style("red"), const Tikz_Style &extension_style=tikz_wire_style("gray!60", true), const bool draw_trapezoids=true, const double trapezoid_opacity=0.3)
 Build a trapezoidal map and draw it.
 
TrapezoidalMapPointLocation::Result visualize_trapezoidal_map (Tikz_Plane &plane, const Polygon &polygon, const Tikz_Style &segment_style=tikz_path_style("red"), const Tikz_Style &extension_style=tikz_wire_style("gray!60", true), const bool draw_trapezoids=true, const double trapezoid_opacity=0.3)
 Build a trapezoidal map from a polygon and draw it.
 
template<typename T , typename... Args>
Array< T > build_array (Args &&... args)
 
template<class Container >
std::vector< typename Container::Item_Type > to_stdvector (const Container &c)
 
template<typename T , class Compare >
T & sift_up (T *ptr, const size_t l, const size_t r, Compare &cmp)
 Restore the heap property by moving the element at position r upwards.
 
template<typename T , class Compare >
void sift_down (T *ptr, const size_t l, const size_t r, Compare &cmp)
 Restore the heap property by moving the element at position l downwards.
 
template<typename T , class Compare >
void sift_down_up (T *ptr, const size_t l, const size_t i, const size_t r, Compare &cmp)
 Restore the heap property by sifting down and then sifting up.
 
template<typename T , class Compare = Aleph::less<T>>
requires StrictWeakOrder<Compare, T>
constexpr void heapsort (T *array, const size_t n, const Compare &cmp=Compare())
 Sort an array using the heapsort algorithm.
 
template<typename T , class Compare = Aleph::less<T>>
requires StrictWeakOrder<Compare, T>
constexpr void faster_heapsort (T *array, const size_t n, const Compare &cmp=Compare())
 Optimized version of heapsort.
 
template<typename T , class Compare = Aleph::less<T>>
requires StrictWeakOrder<Compare, T>
bool valid_heap (T *array, const size_t l, const size_t r, const Compare &cmp=Compare())
 Check whether a range satisfies the heap property.
 
template<class Node >
Node * select_gotoup_root (Node *root, const size_t &i)
 Select a node of a binary tree by its inorder position and make it the root.
 
template<class Node >
Node * balance_tree (Node *root)
 Rebalance a binary search tree.
 
template<class Node >
constexpr Node *& LLINK (Node *p) noexcept
 Return a pointer to left subtree.
 
template<class Node >
constexpr const Node * LLINK (const Node *p) noexcept
 
template<class Node >
constexpr Node *& RLINK (Node *p) noexcept
 Return the right tree of p.
 
template<class Node >
constexpr const Node * RLINK (const Node *p) noexcept
 
template<class Node >
constexpr Node::Key_Type & KEY (Node *p) noexcept
 Return a modifiable reference to the key stored in the node.
 
template<class Node >
constexpr const Node::Key_Type & KEY (const Node *p) noexcept
 
template<class Node >
Aleph::Generator< Node * > lazy_in_order (Node *root)
 Lazily traverse a binary tree in-order (left, node, right).
 
template<class Node >
Aleph::Generator< Node * > lazy_pre_order (Node *root)
 Lazily traverse a binary tree pre-order (node, left, right).
 
template<class Node >
Aleph::Generator< Node * > lazy_post_order (Node *root)
 Lazily traverse a binary tree post-order (left, right, node).
 
template<BinNodeLike Node>
void assert_valid_tree_root (const Node *root) noexcept
 Debug-only check that root is a valid tree for Node.
 
template<BinNodeLike Node>
void inorder_rec_helper (Node *node, const int &level, int &position, void(*visitFct)(Node *, int, int))
 
template<BinNodeLike Node>
int inOrderRec (Node *root, void(*visitFct)(Node *, int, int))
 Traverse recursively inorder a binary tree.
 
template<BinNodeLike Node>
void preorder_rec_helper (Node *p, const int &level, int &position, void(*visitFct)(Node *, int, int))
 
template<BinNodeLike Node>
int preOrderRec (Node *root, void(*visitFct)(Node *, int, int))
 Traverse recursively in preorder a binary tree.
 
template<BinNodeLike Node>
void postorder_rec_helper (Node *node, const int &level, int &position, void(*visitFct)(Node *, int, int))
 
template<BinNodeLike Node>
int postOrderRec (Node *root, void(*visitFct)(Node *, int, int))
 Traverse recursively in postorder a binary tree.
 
template<BinNodeLike Node, class Op >
void for_each_in_order (Node *root, Op &&op)
 Execute an operation in order sense for each node of tree.
 
template<BinNodeLike Node, class Op >
void for_each_preorder (Node *root, Op &&op)
 Execute an operation in preorder sense for each node of tree.
 
template<BinNodeLike Node, class Op >
void for_each_postorder (Node *root, Op &&op)
 Execute an operation in postorder sense for each node of tree.
 
template<BinNodeLike Node>
static void prefix (Node *root, DynList< Node * > &acc)
 
template<BinNodeLike Node>
static void infix (Node *root, DynList< Node * > &acc)
 
template<BinNodeLike Node>
static void suffix (Node *root, DynList< Node * > &acc)
 
template<BinNodeLike Node>
DynList< Node * > prefix (Node *root)
 Return a list with preorder traversal of a tree.
 
template<BinNodeLike Node>
DynList< Node * > infix (Node *root)
 Return a list with inorder traversal of a tree.
 
template<BinNodeLike Node>
DynList< Node * > suffix (Node *root)
 Return a list with postorder traversal of a tree.
 
template<BinNodeLike Node>
size_t compute_cardinality_rec (Node *root) noexcept
 Count the number of nodes of a binary tree.
 
template<BinNodeLike Node>
size_t size (Node *root) noexcept
 See compute_cardinality_rec(Node * root).
 
template<BinNodeLike Node>
size_t compute_height_with_stack (Node *root) noexcept
 Compute the height of a tree with an explicit stack of pending subtrees.
 
template<BinNodeLike Node>
size_t compute_height_bounded (Node *root, const size_t levels) noexcept
 Compute the height of a tree by a recursion of bounded depth.
 
template<BinNodeLike Node>
size_t computeHeightRec (Node *root) noexcept
 Compute the height of root
 
template<BinNodeLike Node, class Dispose >
void dispose_tree_by_link_inversion (Node *root, Dispose &dispose) noexcept
 Dispose of every node of a tree in postorder with \(O(1)\) additional memory.
 
template<BinNodeLike Node, class Dispose >
void dispose_tree_nodes (Node *root, Dispose &dispose, const size_t levels=Bin_Tree_Depth_Bound) noexcept
 Dispose of every node of a tree in postorder.
 
template<BinNodeLike Node>
void destroyRec (Node *&root) noexcept
 Free all the memory occupied by the tree root
 
template<BinNodeLike Node>
void callKeyDestructorsRec (Node *&root) noexcept
 Traverses the tree and calls key's destructors.
 
template<BinNodeLike Node>
Node * copyRec (Node *root)
 Copy a tree.
 
template<BinNodeLike Node>
bool areSimilar (Node *t1, Node *t2) noexcept
 Return true if both trees are similar.
 
template<BinNodeLike Node, class Equal >
bool areEquivalents (Node *t1, Node *t2, Equal &op) noexcept
 Return true if trees are equivalents.
 
template<BinNodeLike Node, class Equal = std::equal_to<typename Node::key_type>>
bool areEquivalents (Node *t1, Node *t2, Equal &&op=Equal()) noexcept
 See areEquivalents(Node * t1, Node * t2, Equal & op).
 
template<BinNodeLike Node>
void levelOrder (Node *root, void(*visitFct)(Node *, int, bool))
 Traverse a binary tree by levels.
 
template<BinNodeLike Node, class Operation >
bool level_traverse (Node *root, Operation &operation)
 Level traverse a tree and execute an operation.
 
template<BinNodeLike Node, class Operation >
bool level_traverse (Node *root, Operation &&operation)
 
template<template< class > class Node, typename Key >
Node< Key > * build_tree (const DynArray< Key > &preorder, long l_p, long r_p, const DynArray< Key > &inorder, long l_i, long r_i)
 Build a binary tree form its preorder and inorder traversals.
 
template<template< class > class Node, typename Key >
Node< Key > * build_postorder (const DynArray< Key > &post, long lp, long rp, const DynArray< Key > &in, long li, long ri)
 
template<BinNodeLike Node>
void compute_nodes_in_level_helper (Node *root, long level, const long current_level, DynDlist< Node * > &level_list)
 
template<BinNodeLike Node>
DynDlist< Node * > compute_nodes_in_level (Node *root, const int &level)
 Count the number of nodes in a specific tree level.
 
template<BinNodeLike Node>
void inOrderThreaded (Node *root, void(*visitFct)(Node *))
 Traverse inorder a binary tree without recursion and without stack.
 
template<BinNodeLike Node>
void preOrderThreaded (Node *node, void(*visitFct)(Node *))
 Traverse preorder a binary tree without recursion and without stack.
 
template<BinNodeLike Node>
size_t internal_path_length_helper (Node *p, const size_t &level) noexcept
 
template<BinNodeLike Node>
size_t internal_path_length (Node *p) noexcept
 Compute the internal path length.
 
template<BinNodeLike Node>
void tree_to_bits (Node *root, BitArray &array)
 Compute a bit code for the binary tree.
 
template<BinNodeLike Node>
BitArray tree_to_bits (Node *root)
 Compute a bit code for the binary tree.
 
template<BinNodeLike Node>
std::string code (Node *root)
 Compute a string with the Lukasiewicz`s word of a tree.
 
template<BinNodeLike Node>
Node * bits_to_tree_helper (const BitArray &array, int &i)
 
template<BinNodeLike Node>
Node * bits_to_tree (const BitArray &array, int idx=0)
 Build a binary tree given its bits code.
 
template<BinNodeLike Node>
void save_tree_keys_in_prefix (Node *root, std::ostream &output)
 Store in output stream the tree keys in preorder.
 
template<BinNodeLike Node>
void load_tree_keys_in_prefix (Node *root, std::istream &input)
 Load the keys stored in preorder from an input stream.
 
template<BinNodeLike Node>
void save_tree (Node *root, std::ostream &output)
 Store a binary tree in a stream.
 
template<BinNodeLike Node>
Node * load_tree (std::istream &input)
 Load and build a binary tree from a stream.
 
template<BinNodeLike Node, class Get_Key >
void put_tree_keys_in_array (Node *root, std::ostream &out)
 
template<BinNodeLike Node, class Load_Key >
void load_tree_keys_from_array (Node *root, const char *keys[], int &idx)
 
template<BinNodeLike Node, class Get_Key >
void save_tree_in_array_of_chars (Node *root, const std::string &array_name, std::ostream &output)
 Generate C++ array declarations for a binary tree.
 
template<BinNodeLike Node, class Load_Key >
Node * load_tree_from_array (const unsigned char bits[], const size_t &num_bits, const char *keys[])
 Build a binary tree from two arrays.
 
template<BinNodeLike Node, class Compare >
bool check_bst_range (Node *p, const typename Node::key_type *min_key, const typename Node::key_type *max_key, const Compare &cmp)
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
bool check_bst (Node *p, const Compare &cmp=Compare())
 Return true if p is a binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * preorder_to_bst (DynArray< typename Node::key_type > &preorder, int l, int r, const Compare &cmp=Compare())
 Build a binary search tree from its preorder traversal.
 
template<typename T , class Compare = Aleph::less<T>>
ThreeWayCmp three_way_compare (const T &a, const T &b, const Compare &cmp=Compare()) noexcept(nothrow_compare_v< Compare, T >)
 Three-way comparison using a binary comparator.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * searchInBinTree (Node *root, const typename Node::key_type &key, const Compare &cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Search a key in a binary search tree using optimistic search.
 
template<BinNodeLike Node>
Node * find_min (Node *root) noexcept
 Return the minimum key contained in a binary search tree.
 
template<BinNodeLike Node>
Node * find_max (Node *root) noexcept
 Return the maximum key contained in a binary search tree.
 
template<BinNodeLike Node>
Node * find_successor (Node *p, Node *&pp) noexcept
 Find the inorder successor of p
 
template<BinNodeLike Node>
Node * find_predecessor (Node *p, Node *&pp) noexcept
 Find the inorder predecessor of p
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * search_parent (Node *root, const typename Node::key_type &key, Node *&parent, const Compare &cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Search a key and find its node and parent.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * search_rank_parent (Node *root, const typename Node::key_type &key, const Compare &cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Rank search of a key in a binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_in_bst (Node *&r, Node *p, const Compare &cmp=Compare()) noexcept
 Insert a node p in a binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_dup_in_bst (Node *&root, Node *p, const Compare &cmp=Compare()) noexcept
 Insert a node p in a binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * search_or_insert_in_bst (Node *&r, Node *p, const Compare &cmp=Compare()) noexcept
 Search or insert a node in a binary search tree.
 
template<BinNodeLike Node, class Compare >
bool split_key_rec_helper (Node *root, const typename Node::key_type &key, Node *&ts, Node *&tg, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 The recursion of split_key_rec().
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
bool split_key_rec (Node *&root, const typename Node::key_type &key, Node *&ts, Node *&tg, const Compare &cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Split recursively according to a key.
 
template<BinNodeLike Node, class Compare >
void split_key_dup_rec_helper (Node *root, const typename Node::key_type &key, Node *&ts, Node *&tg, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 The recursion of split_key_dup_rec().
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
void split_key_dup_rec (Node *&root, const typename Node::key_type &key, Node *&ts, Node *&tg, const Compare &cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Split a tree according to a key value.
 
template<BinNodeLike Node>
Node * join_exclusive (Node *&ts, Node *&tg) noexcept
 Exclusive join of two binary trees.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * remove_from_bst (Node *&root, const typename Node::key_type &key, const Compare &cmp=Compare()) noexcept
 Remove a key from a binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_root (Node *&root, Node *p, const Compare &cmp=Compare()) noexcept
 Insert the node p as root of a binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_dup_root (Node *&root, Node *p, const Compare &cmp=Compare()) noexcept
 Insert node p as root of a binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * join_preorder (Node *t1, Node *t2, Node *&dup, const Compare &cmp=Compare()) noexcept
 Union of two binary search trees.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * join (Node *t1, Node *t2, Node *&dup, const Compare &cmp=Compare()) noexcept
 Fast union of two binary search trees.
 
template<BinNodeLike Node>
Node * rotate_to_right (Node *p) noexcept
 Rotate to the right the tree with root p
 
template<BinNodeLike Node>
Node * rotate_to_right (Node *p, Node *pp) noexcept
 Rotate to the right the tree with root p and update its parent.
 
template<BinNodeLike Node>
Node * rotate_to_left (Node *p) noexcept
 Rotate to the left the tree with root p
 
template<BinNodeLike Node>
Node * rotate_to_left (Node *p, Node *pp) noexcept
 Rotate to the left the tree with root p and update its parent.
 
template<BinNodeLike Node, class Key , class Compare = Aleph::less<typename Node::key_type>>
void split_key (Node *&root, const Key &key, Node *&l, Node *&r, const Compare &cmp=Compare()) noexcept
 Split a binary search tree according to a key.
 
template<BinNodeLike Node>
void swap_node_with_successor (Node *p, Node *&pp, Node *q, Node *&pq) noexcept
 Swap a node with its successor inorder.
 
template<BinNodeLike Node>
void swap_node_with_predecessor (Node *p, Node *&pp, Node *q, Node *&pq) noexcept
 Swap a node with its predecessor inorder.
 
template<BinNodeLike Node, class Key = typename Node::key_type, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_root_rec (Node *root, Node *p, const Compare &cmp=Compare()) noexcept
 Insert a node as root in a binary search tree.
 
template<BinNodeLike Node, class Key = typename Node::key_type, class Compare = Aleph::less<typename Node::key_type>>
Node * search_or_insert_root_rec (Node *root, Node *p, const Compare &cmp=Compare()) noexcept
 Search and eventually insert p as root in a binary search tree.
 
template<BinNodeLike Node, class Op >
bool prefix_traverse (Node *root, Op op)
 Traverse a tree in preorder via its iterator and performs a conditioned operation on each item.
 
template<BinNodeLike Node, class Op >
void prefix_for_each (Node *root, Op op)
 Traverse in preorder all the container and performs an operation on each element.
 
template<BinNodeLike Node, class Op >
bool infix_traverse (Node *root, Op op)
 Traverse a tree in inorder via its iterator and performs a conditioned operation on each item.
 
template<BinNodeLike Node, class Op >
bool traverse (Node *root, Op op)
 See infix_traverse().
 
template<BinNodeLike Node, class Op >
void infix_for_each (Node *root, Op op)
 Traverse all the container and performs an operation on each element.
 
template<RankedBinNodeLike Node>
auto & COUNT (Node *p) noexcept
 Return the number of nodes of the tree fron p is root.
 
template<RankedBinNodeLike Node>
static Node * __select_rec (Node *r, const size_t i) noexcept
 
template<RankedBinNodeLike Node>
Node * select_rec (Node *r, const size_t i)
 Recursively select the i-th node inorder sense.
 
template<RankedBinNodeLike Node>
Node * select_ne (Node *r, const size_t pos) noexcept
 Iterative selection of a node according to inorder position without exception.
 
template<RankedBinNodeLike Node>
Node * select (Node *r, const size_t pos)
 Iterative selection of a node according to inorder position.
 
template<RankedBinNodeLike Node>
Node * select (Node *root, const size_t pos, Node *&parent)
 Iterative selection of a node according to inorder psoition and determination of parent of selected node.
 
template<RankedBinNodeLike Node, class Compare >
long inorder_position (Node *r, const typename Node::key_type &key, Node *&p, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Compute the inorder position of a key.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long inorder_position (Node *r, const typename Node::key_type &key, Node *&p, Compare &&cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 See inorder_position().
 
template<BinNodeLike Node, class Compare >
long inorder_position (Node *r, const typename Node::key_type &key, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 See inorder_position().
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long inorder_position (Node *r, const typename Node::key_type &key, Compare &&cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 See inorder_position().
 
template<RankedBinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long find_position (Node *r, const typename Node::key_type &key, Node *&p, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Find the inorder position of a key in an extended binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long find_position (Node *r, const typename Node::key_type &key, Node *&p, Compare &&cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 See find_position().
 
template<RankedBinNodeLike Node, class Compare >
long inorder_position_of_node (Node *r, Node *p, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 The inorder position of the node p, in a tree that may have keys equivalent to that of p.
 
template<RankedBinNodeLike Node, class Compare >
Node * insert_by_key_xt (Node *&r, Node *p, Compare &cmp) noexcept
 Insert a node in an extended binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_by_key_xt (Node *&r, Node *p, Compare &&cmp=Compare()) noexcept
 See insert_by_key_xt(Node *& r, Node * p, Compare & cmp).
 
template<RankedBinNodeLike Node, class Compare >
Node * insert_dup_by_key_xt (Node *&r, Node *p, Compare &cmp) noexcept
 Insert a node in an extended binary search tree without testing for duplicity.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_dup_by_key_xt (Node *&r, Node *p, Compare &&cmp=Compare()) noexcept
 See insert_dup_by_key_xt(Node *& r, Node * p, Compare & cmp).
 
template<RankedBinNodeLike Node, class Compare >
Node * search_or_insert_by_key_xt (Node *&r, Node *p, Compare &cmp) noexcept
 Search or insert a node in an extended binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * search_or_insert_by_key_xt (Node *&r, Node *p, Compare &&cmp=Compare()) noexcept
 See search_or_insert_by_key_xt(Node *& r, Node * p, Compare & cmp).
 
template<RankedBinNodeLike Node, class Compare >
static bool __split_key_rec_xt (Node *root, const typename Node::key_type &key, Node *&l, Node *&r, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 The recursion of split_key_rec_xt().
 
template<BinNodeLike Node, class Compare >
bool split_key_rec_xt (Node *&root, const typename Node::key_type &key, Node *&l, Node *&r, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Split an extended binary search tree according to a key.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
bool split_key_rec_xt (Node *&root, const typename Node::key_type &key, Node *&l, Node *&r, Compare &&cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Split an extended binary search tree according to a key, with a temporary comparison criteria.
 
template<RankedBinNodeLike Node, class Compare >
static void __split_key_dup_rec_xt (Node *root, const typename Node::key_type &key, Node *&l, Node *&r, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 The recursion of split_key_dup_rec_xt().
 
template<BinNodeLike Node, class Compare >
void split_key_dup_rec_xt (Node *&root, const typename Node::key_type &key, Node *&l, Node *&r, Compare &cmp) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Split an extended binary search tree according to a key which can be in the tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
void split_key_dup_rec_xt (Node *&root, const typename Node::key_type &key, Node *&l, Node *&r, Compare &&cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
 Split an extended binary search tree according to a key which can be in the tree, with a temporary comparison criteria.
 
template<RankedBinNodeLike Node, class Compare >
Node * insert_root_xt (Node *&root, Node *p, Compare &cmp) noexcept
 Insert a node p as root of an extended binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_root_xt (Node *&root, Node *p, Compare &&cmp=Compare()) noexcept
 See insert_root_xt(Node *& root, Node * p, Compare & cmp).
 
template<RankedBinNodeLike Node, class Compare >
Node * insert_dup_root_xt (Node *&root, Node *p, Compare &cmp) noexcept
 Insert a node as root of an extended binary search tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * insert_dup_root_xt (Node *&root, Node *p, Compare &&cmp=Compare()) noexcept
 See insert_dup_root_xt(Node *& root, Node * p, Compare & cmp).
 
template<RankedBinNodeLike Node>
static void __split_pos_rec (Node *r, size_t i, Node *&ts, Node *&tg) noexcept
 
template<RankedBinNodeLike Node>
void split_pos_rec (Node *&r, const size_t i, Node *&ts, Node *&tg)
 Split a extended binary tree according to a position.
 
template<RankedBinNodeLike Node>
void insert_by_pos_xt (Node *&r, Node *p, size_t pos)
 Insert a node in a specific inorder position in a binary tree.
 
template<RankedBinNodeLike Node>
Node * join_exclusive_xt (Node *&ts, Node *&tg) noexcept
 Exclusive union of two extended binary search trees.
 
template<RankedBinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * remove_by_key_xt (Node *&root, const typename Node::key_type &key, Compare &cmp) noexcept
 Remove a key of extended binary tree.
 
template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * remove_by_key_xt (Node *&root, const typename Node::key_type &key, Compare &&cmp=Compare()) noexcept
 See remove_by_key_xt().
 
template<RankedBinNodeLike Node>
static Node * __remove_by_pos_xt (Node *&root, size_t pos) noexcept
 
template<RankedBinNodeLike Node>
Node * remove_by_pos_xt (Node *&root, size_t pos)
 Remove from a extended binary tree the node whose inorder position is pos.
 
template<RankedBinNodeLike Node>
bool check_rank_tree (Node *root) noexcept
 Return true if root is a valid extended binary tree.
 
template<RankedBinNodeLike Node>
Node * rotate_to_right_xt (Node *p) noexcept
 Rotate to right the extended bianry tree with root p
 
template<RankedBinNodeLike Node>
Node * rotate_to_left_xt (Node *p) noexcept
 Rotate to left the extended binary tree with root p.
 
template<RankedBinNodeLike Node, class Key , class Compare >
Node * search_or_insert_root_rec_xt (Node *root, Node *p, Compare &cmp) noexcept
 Search or insert a key in an extended binary search tree.
 
template<BinNodeLike Node, class Key , class Compare = Aleph::less<typename Node::key_type>>
Node * search_or_insert_root_rec_xt (Node *root, Node *p, Compare &&cmp=Compare()) noexcept
 See search_or_insert_root_rec_xt().
 
template<AlephGraph GT>
static long & color (typename GT::Node *p)
 
template<AlephGraph GT>
static long & color (typename GT::Arc *a)
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void compute_bipartite (const GT &g, DynDlist< typename GT::Node * > &l, DynDlist< typename GT::Node * > &r, SA sa=SA())
 Computes the partition sets of a bipartite graph.
 
template<AlephGraph GT, template< class > class Max_Flow = Ford_Fulkerson_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void compute_maximum_cardinality_bipartite_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
 Computes the maximum cardinality matching of a bipartite graph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
bool compute_bipartite_all_components (const GT &g, DynDlist< typename GT::Node * > &l, DynDlist< typename GT::Node * > &r, SA sa=SA())
 Computes the partition sets of a bipartite graph handling all connected components.
 
template<AlephGraph GT, ArcFilter< GT > SA>
GT::Node * hopcroft_karp_next (const GT &g, Hopcroft_Karp_Frame< GT, SA > &f, bool &free) noexcept(noexcept(f.it.next_ne()))
 
template<AlephGraph GT, ArcFilter< GT > SA>
void hopcroft_karp_match (const GT &g, Hopcroft_Karp_Frame< GT, SA > &f) noexcept
 
template<AlephGraph GT, ArcFilter< GT > SA>
static bool hopcroft_karp_dfs (const GT &g, typename GT::Node *u, Dfs_Stack< Hopcroft_Karp_Frame< GT, SA > > &frames, const SA &sa)
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void hopcroft_karp_matching (const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
 Computes a maximum cardinality matching on a bipartite graph using the Hopcroft-Karp algorithm.
 
template<AlephGraph GT>
Const_Graph_View< GT > const_view (const GT &g) noexcept
 Strict read-only view of a graph.
 
template<AlephGraph GT>
void const_view (const GT &&)=delete
 A view of a temporary graph would dangle.
 
const char * compiler_unify_result_kind_name (const Compiler_Unify_Result_Kind kind) noexcept
 Returns a stable debug name for one unification result kind.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Arc * > find_bridges (const GT &g, typename GT::Node *start, SA sa=SA())
 Find all bridge edges in a connected undirected graph.
 
template<AlephGraph GT>
DynList< typename GT::Arc * > find_bridges (const GT &g)
 Starts from the first node of the graph.
 
template<class T , class... Args>
Dfs_Here< T > dfs_here (Args &&...args)
 Builds the variable of the frame of a search, with the frame built with args.
 
template<class T >
T & dfs_frame (T &here) noexcept
 The frame that a Dfs_Here holds.
 
template<class T >
T & dfs_frame (std::optional< T > &here) noexcept
 The frame that a Dfs_Here holds.
 
template<class T , class... Args>
void dfs_replace (T &here, Args &&...args)
 Replaces the frame that a Dfs_Here holds with one built with args, by assignment.
 
template<class T , class... Args>
void dfs_replace (std::optional< T > &here, Args &&...args)
 Replaces the frame that a Dfs_Here holds with one built in its place with args.
 
template<class It >
decltype(auto) dfs_curr (const It &it)
 The current item of an iterator that has one.
 
template<typename T , class Compare >
size_t sift_up (DynArray< T > &a, const size_t l, const size_t r, Compare &cmp) noexcept(Aleph::NothrowPredicateWith< Compare &, T &, T & >)
 Restore heap order by moving an element up.
 
template<typename T , class Compare >
void sift_down (DynArray< T > &a, const size_t l, const size_t r, Compare &cmp) noexcept(Aleph::NothrowPredicateWith< Compare &, T &, T & >)
 Restore heap order by moving an element down.
 
template<typename T , class Op , class C >
DynMapTree< typename C::Item_Type, T > map_unify (const C &c, Op op)
 
template<typename T , class Op , class C >
DynSetTree< T > set_unify (const C &c, Op op)
 
template<AlephGraph GT, NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op >
requires std::is_invocable_r_v<void, Op &, typename GT::Node *>
void for_each_node (const GT &g, Op operation, SN sn=SN())
 Traverse all the nodes of graph filtering some ones according to a condition and executing an operation on them.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<void, Op &, typename GT::Arc *>
void for_each_arc (const GT &g, Op operation, SA sa=SA())
 Traverse all the arcs of graph filtering some ones according to a condition and executing an operation on them.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<void, Op &, typename GT::Arc *>
void for_each_arc (const GT &g, typename GT::Node *p, Op operation, SA sa=SA())
 Traverse all the arcs adjacent to a node filtering some ones according to a condition and executing an operation on them.
 
template<AlephGraph GT, NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op >
requires std::is_invocable_r_v<bool, Op &, typename GT::Node *>
bool forall_node (const GT &g, Op cond, SN sn=SN())
 Return true if condition cond is met on every filtered node of the graph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<bool, Op &, typename GT::Arc *>
bool forall_arc (const GT &g, Op cond, SA sa=SA())
 Return true if condition cond is met on every filtered arc of the graph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<bool, Op &, typename GT::Arc *>
bool forall_arc (typename GT::Node *p, Op cond, SA sa=SA())
 Return true if the condition cond is met on every filtered arc of a node.
 
template<AlephGraph GT, typename T , template< typename > class Container = DynList, NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op >
requires std::is_invocable_r_v<T, Op &, typename GT::Node *>
Container< T > nodes_map (GT &g, Op transformation, SN sn=SN())
 Map the filtered nodes of a graph to a transformed type.
 
template<AlephGraph GT, typename T , template< typename > class Container = DynList, NodeFilter< GT > SN = Dft_Show_Node<GT>>
Container< T > nodes_map (GT &g, std::function< T(typename GT::Node *)> transformation, SN sn=SN())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload for callers that pass an actual std::function<T (typename GT::Node *)> (rather than a lambda or other callable) and rely on T being deduced from it, as the generic overload above cannot: T appears only in its return type and requires clause, never in a parameter, so it is not a deduced context there.
 
template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<T, Op &, typename GT::Arc *>
Container< T > arcs_map (GT &g, Op transformation, SA sa=SA())
 Map the filtered arcs of a graph to a transformed type.
 
template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Container< T > arcs_map (GT &g, std::function< T(typename GT::Arc *)> transformation, SA sa=SA())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
 
template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<T, Op &, typename GT::Arc *>
Container< T > arcs_map (GT &g, typename GT::Node *p, Op transformation, SA sa=SA())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Map the filtered arcs of a specific node in a graph to a transformed type.
 
template<AlephGraph GT, typename T , template< typename > class Container = DynList, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Container< T > arcs_map (GT &g, typename GT::Node *p, std::function< T(typename GT::Arc *)> transformation, SA sa=SA())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
 
template<AlephGraph GT, typename T , NodeFilter< GT > SN = Dft_Show_Node<GT>, class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Node *>
T foldl_nodes (GT &g, const T &init, Op operation, SN sn=SN())
 Fold the filtered nodes of a graph.
 
template<AlephGraph GT, typename T , ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T foldl_arcs (GT &g, const T &init, Op operation, SA sa=SA())
 Fold the filtered arcs of a graph.
 
template<AlephGraph GT, typename T , ArcFilter< GT > SA = Dft_Show_Arc<GT>, class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T foldl_arcs (GT &g, typename GT::Node *p, const T &init, Op operation, SA sa=SA())
 Fold the filtered adjacent arcs of a node.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Node * > out_nodes (typename GT::Node *p, SA sa=SA())
 Return the nodes connected to the filtered outcoming arcs of p.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Node * > in_nodes (typename GT::Node *p, SA sa=SA())
 Return the nodes connected to the filtered incoming arcs to p.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Node * > in_nodes (const GT &g, typename GT::Node *p, SA sa=SA())
 Return the sources of the arcs of g into p that sa shows.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Arc * > out_arcs (typename GT::Node *p, SA sa=SA())
 Return the filtered incoming arcs of p.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Arc * > in_arcs (typename GT::Node *p, SA sa=SA())
 Return the filtered incoming arcs of p.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Arc * > in_arcs (const GT &g, typename GT::Node *p, SA sa=SA())
 Return the arcs of g into p that sa shows.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< typename GT::Arc * > arcs (typename GT::Node *p, SA sa=SA())
 Return all the filtered arcs related to p
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< ArcPair< GT > > in_pairs (typename GT::Node *p, SA sa=SA())
 Return the filtered incoming pairs of (arc,node) related to node p
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< ArcPair< GT > > in_pairs (const GT &g, typename GT::Node *p, SA sa=SA())
 Return the pairs (arc, source) of the arcs of g into p that sa shows.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
DynList< ArcPair< GT > > out_pairs (typename GT::Node *p, SA sa=SA())
 Return the filtered outcoming pairs of (arc,node) related to node p
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t in_degree (typename GT::Node *p, SA sa=SA())
 Compute the filtered in degree of node p.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t in_degree (const GT &g, typename GT::Node *p, SA sa=SA())
 Compute the number of arcs of g into p that sa shows.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t out_degree (typename GT::Node *p, SA sa=SA())
 Compute the filtered out degree of node p
 
template<AlephGraph GT, class Itor , class Operation >
bool traverse_arcs (typename GT::Node *p, Operation op=Operation())
 Generic arcs traverse of a node.
 
template<AlephGraph GT, class Itor , class Operation >
void for_each_arc (typename GT::Node *p, Operation op=Operation())
 Execute an operation on each arc of a node.
 
template<AlephGraph GT, class Op >
bool traverse_in_arcs (typename GT::Node *p, Op op=Op())
 Conditioned traversal of incoming arcs of a node.
 
template<AlephGraph GT, class Op >
bool traverse_in_arcs (const GT &g, typename GT::Node *p, Op op=Op())
 Conditioned traversal of the arcs of g into p.
 
template<AlephGraph GT, class Op >
void for_each_in_arc (typename GT::Node *p, Op op=Op())
 Traverse the incoming arcs of a node and executes an operation.
 
template<AlephGraph GT, class Op >
void for_each_in_arc (const GT &g, typename GT::Node *p, Op op=Op())
 Executes an operation on each arc of g into p: on a digraph, which the function tells at run time, among the arcs of the graph, in \(O(E)\).
 
template<AlephGraph GT, class Op >
bool all_in_arc (typename GT::Node *p, Op op=Op())
 Test if the incoming arcs meet a condition.
 
template<AlephGraph GT, class Op >
bool all_in_arc (const GT &g, typename GT::Node *p, Op op=Op())
 Test if the arcs of g into p meet a condition; on a digraph, in \(O(E)\).
 
template<AlephGraph GT, class Op >
bool exists_in_arc (typename GT::Node *p, Op op=Op())
 Test if it exists an incoming arc satisfying an operation.
 
template<AlephGraph GT, class Op >
bool exists_in_arc (const GT &g, typename GT::Node *p, Op op=Op())
 Test if an arc of g into p satisfies an operation; on a digraph, in \(O(E)\).
 
template<AlephGraph GT, class Op >
auto search_in_arc (typename GT::Node *p, Op op=Op())
 Search an incoming arc to a node satisfying a condition op.
 
template<AlephGraph GT, class Op >
auto search_in_arc (const GT &g, typename GT::Node *p, Op op=Op())
 Search an arc of g into p that satisfies op; on a digraph, in \(O(E)\).
 
template<AlephGraph GT, typename T , class Op >
requires (std::is_invocable_r_v<T, Op &, typename GT::Arc *> and not std::is_same_v<Op, std::function<T (typename GT::Arc *)>>)
auto map_in_arcs (typename GT::Node *p, Op op)
 Map the incoming arcs to a transformation,.
 
template<AlephGraph GT, typename T , class Op = std::function<T (typename GT::Arc *)>>
requires std::is_same_v<Op, std::function<T (typename GT::Arc *)>>
auto map_in_arcs (typename GT::Node *p, std::function< T(typename GT::Arc *)> op)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
 
template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, typename GT::Arc *>
auto map_in_arcs (const GT &g, typename GT::Node *p, Op op)
 Map the arcs of g into p to a transformation op, which must have the signature T op(Arc * arc); on a digraph, in \(O(E)\).
 
template<AlephGraph GT, typename T >
auto map_in_arcs (const GT &g, typename GT::Node *p, std::function< T(typename GT::Arc *)> op)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument.
 
template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T foldl_in_arcs (typename GT::Node *p, const T &init, Op op)
 Fold the incoming arcs of a node.
 
template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T foldl_in_arcs (const GT &g, typename GT::Node *p, const T &init, Op op)
 Fold the arcs of g into p with op, which must have the signature T op(const T & acc, Arc * arc); on a digraph, in \(O(E)\).
 
template<AlephGraph GT, class Op >
DynList< typename GT::Arc * > filter_in_arcs (typename GT::Node *p, Op cond)
 Filter the incoming arcs meeting an condition.
 
template<AlephGraph GT, class Op >
DynList< typename GT::Arc * > filter_in_arcs (const GT &g, typename GT::Node *p, Op cond)
 Return the arcs of g into p that meet a condition; on a digraph, in \(O(E)\).
 
template<AlephGraph GT, class Op >
bool traverse_out_arcs (typename GT::Node *p, Op op=Op())
 Conditioned traversal of outcoming arcs of a node.
 
template<AlephGraph GT, class Op >
void for_each_out_arc (typename GT::Node *p, Op op=Op())
 Traverse the outcoming arcs of a node and executes an operation.
 
template<AlephGraph GT, class Op >
bool all_out_arc (typename GT::Node *p, Op op=Op())
 Test if the outcoming arcs meet a condition.
 
template<AlephGraph GT, class Op >
bool exists_out_arc (typename GT::Node *p, Op op=Op())
 Test if it exists an outcoming arc satisfying an operation.
 
template<AlephGraph GT, class Op >
auto search_out_arc (typename GT::Node *p, Op op=Op())
 Search an outcoming arc to a node satisfying a condition op.
 
template<AlephGraph GT, typename T , class Op >
requires (std::is_invocable_r_v<T, Op &, typename GT::Arc *> and not std::is_same_v<Op, std::function<T (typename GT::Arc *)>>)
auto map_out_arcs (typename GT::Node *p, Op op)
 Map the outcoming arcs to a transformation,.
 
template<AlephGraph GT, typename T , class Op = std::function<T (typename GT::Arc *)>>
requires std::is_same_v<Op, std::function<T (typename GT::Arc *)>>
auto map_out_arcs (typename GT::Node *p, std::function< T(typename GT::Arc *)> op)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compatibility overload deducing T from an actual std::function<T (typename GT::Arc *)> argument; see the equivalent nodes_map overload for why the generic one above cannot deduce it.
 
template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T foldl_out_arcs (typename GT::Node *p, const T &init, Op op)
 Fold the outcoming arcs of a node.
 
template<AlephGraph GT, class Op >
DynList< typename GT::Arc * > filter_out_arcs (typename GT::Node *p, Op cond)
 Filter the outcoming arcs meeting an condition.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
GT::Arc * search_arc (const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept(nothrow_arc_filter_v< GT, SA >)
 Arc filtered searching given two nodes.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
GT::Arc * search_directed_arc (const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept(nothrow_arc_filter_v< GT, SA >)
 Searching of directed arc linking two nodes.
 
template<AlephGraph GT>
GT::Node * mapped_node (typename GT::Node *p) noexcept
 Return the mapped node through the cookie of p
 
template<AlephGraph GT>
GT::Arc * mapped_arc (typename GT::Arc *a) noexcept
 Return the mapped arc through the cookie of p
 
template<AlephGraph GTSRC, AlephGraph GTTGT>
GTTGT::Node * mapped_node (typename GTSRC::Node *p) noexcept
 See mapped_node(typename GT::Node * p).
 
template<AlephGraph GTSRC, AlephGraph GTTGT>
GTTGT::Arc * mapped_arc (typename GTSRC::Arc *a) noexcept
 See mapped_arc(typename GT::Arc * a).
 
template<AlephGraph GT>
void copy_graph (GT &gtgt, const GT &gsrc, bool cookie_map=false)
 Explicit copy of graph.
 
template<AlephGraph GT>
void clear_graph (GT &g)
 Clean a graph: all its nodes and arcs are removed and freed.
 
template<AlephGraph GT>
Path< GT > find_path_depth_first (const GT &g, typename GT::Node *start_node, typename GT::Node *end_node)
 Depth-first search of a path between two nodes.
 
template<class GT >
static bool __find_path_depth_first (const GT &g, typename GT::Node *curr_node, typename GT::Arc *curr_arc, typename GT::Node *end_node, Path< GT > &path)
 
template<AlephGraph GTS, AlephGraph GTT>
void map_nodes (typename GTS::Node *p, typename GTT::Node *q) noexcept
 Map two nodes of different types of graphs through their cookies.
 
template<AlephGraph GTS, AlephGraph GTT>
void map_arcs (typename GTS::Arc *p, typename GTT::Arc *q) noexcept
 Map two arcs of different types of graphs through their cookies.
 
template<AlephGraph GTT, AlephGraph GTS, class Copy_Node = Dft_Copy_Node<GTT, GTS>, class Copy_Arc = Dft_Copy_Arc<GTT, GTS>>
void inter_copy_graph (GTT &gtgt, const GTS &gsrc, const bool cookie_map=false)
 Copy between different types of graphs.
 
template<AlephGraph GT>
bool are_equal (const GT &g1, const GT &g2)
 Fast graph comparison.
 
template<AlephGraph GT>
static bool __depth_first_traversal (const GT &g, typename GT::Node *node, typename GT::Arc *arc, bool(*visit)(const GT &g, typename GT::Node *, typename GT::Arc *), size_t &count)
 Internal DFS used by depth_first_traversal().
 
template<AlephGraph GT>
size_t depth_first_traversal (const GT &g, typename GT::Node *start_node, bool(*visit)(const GT &g, typename GT::Node *, typename GT::Arc *))
 Depth-first traversal starting from a given node.
 
template<AlephGraph GT>
size_t depth_first_traversal (const GT &g, bool(*visit)(const GT &, typename GT::Node *, typename GT::Arc *))
 See depth_first_traversal(const GT&, typename GT::Node*, bool (*)(...)).
 
template<AlephGraph GT>
size_t breadth_first_traversal (const GT &g, typename GT::Node *start, bool(*visit)(const GT &, typename GT::Node *, typename GT::Arc *))
 Breadth-first traversal starting from a given node.
 
template<AlephGraph GT>
size_t breadth_first_traversal (GT &g, bool(*visit)(const GT &, typename GT::Node *, typename GT::Arc *))
 See breadth_first_traversal(const GT&, typename GT::Node*, bool (*)(...)).
 
template<AlephGraph GT>
Path< GT > find_path_breadth_first (const GT &g, typename GT::Node *start, typename GT::Node *end)
 Breadth-first search of a (shortest-by-edges) path between two nodes.
 
template<AlephGraph GT>
bool test_connectivity (const GT &g)
 Connectivity test for undirected graphs.
 
template<AlephGraph GT>
static bool __test_cycle (const GT &g, typename GT::Node *, typename GT::Node *)
 Internal helper used by test_for_cycle().
 
template<AlephGraph GT>
bool test_for_cycle (const GT &g, typename GT::Node *src)
 Search for a cycle reachable from a given node.
 
template<AlephGraph GT>
static bool __is_graph_acyclique (const GT &g, typename GT::Node *curr_node)
 Internal DFS used by is_graph_acyclique().
 
template<AlephGraph GT>
bool is_graph_acyclique (const GT &g, typename GT::Node *start_node)
 Return true if an undirected graph is acyclic.
 
template<AlephGraph GT>
bool is_graph_acyclique (const GT &g)
 Return true if an undirected graph is acyclic.
 
template<AlephGraph GT>
bool has_cycle (const GT &g)
 Return true if an undirected graph has at least one cycle.
 
template<AlephGraph GT>
bool test_for_path (const GT &g, typename GT::Node *start_node, typename GT::Node *end_node)
 Return true if there is a path between two nodes.
 
template<AlephGraph GT>
static bool __test_for_path (const GT &g, typename GT::Node *curr_node, typename GT::Node *end_node)
 Internal DFS used by test_for_path().
 
template<AlephGraph GT>
DynList< GT > inconnected_components (const GT &g)
 Forward declaration for inconnected_components().
 
template<AlephGraph GT>
void build_subgraph (const GT &g, GT &sg, typename GT::Node *g_src, size_t &node_count)
 Forward declaration for build_subgraph().
 
template<AlephGraph GT>
static bool __find_depth_first_spanning_tree (const GT &g, typename GT::Node *gnode, typename GT::Arc *garc, GT &tree, typename GT::Node *tnode)
 Internal DFS used by find_depth_first_spanning_tree().
 
template<AlephGraph GT>
GT find_depth_first_spanning_tree (const GT &g, typename GT::Node *gnode)
 Build a depth-first spanning tree (mapped to the original graph).
 
template<AlephGraph GT>
GT find_depth_first_spanning_tree (const GT &g)
 See find_depth_first_spanning_tree().
 
template<AlephGraph GT>
GT find_breadth_first_spanning_tree (GT &g, typename GT::Node *gp)
 Build a breadth-first spanning tree (mapped to the original graph).
 
template<AlephGraph GT>
GT build_spanning_tree (const DynArray< typename GT::Arc * > &arcs)
 Build a graph from a list of arcs (typically a spanning tree).
 
template<AlephGraph GT>
static long & df (typename GT::Node *p)
 Internal helper: DFS discovery time stored in NODE_COUNTER(p).
 
template<AlephGraph GT>
static long & low (typename GT::Node *p)
 Internal helper: low-link value stored directly in NODE_COOKIE(p).
 
template<AlephGraph GT>
static void __compute_cut_nodes (const GT &g, DynList< typename GT::Node * > &list, Dfs_Stack< graph_utils_detail::Cut_Frame< GT > > &frames, typename GT::Node *p, typename GT::Arc *a, long &curr_df)
 Internal DFS step used by compute_cut_nodes().
 
template<AlephGraph GT>
DynList< typename GT::Node * > compute_cut_nodes (const GT &g, typename GT::Node *start)
 Compute articulation points (cut vertices) of an undirected graph.
 
template<AlephGraph GT>
DynList< typename GT::Node * > compute_cut_nodes (const GT &g)
 See compute_cut_nodes(const GT & g, typename GT::Node * start).
 
template<AlephGraph GT>
static bool is_a_cross_arc (typename GT::Arc *a)
 Return true if the arc is marked as a cross-arc by paint_subgraphs().
 
template<AlephGraph GT>
static bool is_a_cut_node (typename GT::Node *p)
 Return true if the node is marked as an articulation point.
 
template<AlephGraph GT>
static bool is_an_cut_arc (typename GT::Arc *a)
 Return true if the arc is marked as a cut-arc (between cut nodes).
 
template<AlephGraph GT>
static bool is_node_painted (typename GT::Node *p)
 Return true if the node has a positive color.
 
template<AlephGraph GT>
static bool is_arc_painted (typename GT::Arc *arc)
 Return true if the arc has a positive color.
 
template<AlephGraph GT>
static void paint_node (typename GT::Node *p, const long &color)
 Set the node color (stored in NODE_COUNTER).
 
template<AlephGraph GT>
static void paint_arc (typename GT::Arc *a, const long &color)
 Set the arc color (stored in ARC_COUNTER).
 
template<AlephGraph GT>
static const long & get_color (typename GT::Node *p)
 Return the node color (stored in NODE_COUNTER).
 
template<AlephGraph GT>
static const long & get_color (typename GT::Arc *a)
 Return the arc color (stored in ARC_COUNTER).
 
template<AlephGraph GT>
static void __paint_subgraph (const GT &g, Dfs_Stack< graph_utils_detail::Paint_Frame< GT > > &frames, typename GT::Node *p, long current_color)
 Internal DFS that paints a non-cut block with current_color.
 
template<AlephGraph GT>
static void __paint_from_cut_node (const GT &g, Dfs_Stack< graph_utils_detail::Paint_Frame< GT > > &frames, typename GT::Node *p, long &current_color)
 Internal step that paints all blocks adjacent to a cut node.
 
template<AlephGraph GT>
long paint_subgraphs (const GT &g, const DynList< typename GT::Node * > &cut_node_list)
 Paint connected blocks around articulation points.
 
template<AlephGraph GT>
static void __map_subgraph (const GT &g, GT &sg, typename GT::Node *gsrc, const long color)
 Internal step used by map_subgraph().
 
template<AlephGraph GT>
GT map_subgraph (const GT &g, const long color)
 Extract a mapped subgraph containing a given color.
 
template<AlephGraph GT>
std::tuple< GT, DynList< typename GT::Arc * > > map_cut_graph (const GT &g, const DynList< typename GT::Node * > &cut_node_list)
 Extract the cut graph and cross-arc list.
 
template<AlephGraph GT>
GT invert_digraph (const GT &g)
 Compute the transpose (arc-reversed) digraph.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
GT::Arc * search_spanning_tree_arc (const GT &g, typename GT::Node *src, typename GT::Node *tgt, SA sa=SA()) noexcept(nothrow_arc_filter_v< GT, SA >)
 Helper to find the spanning tree arc between two nodes in a multigraph.
 
template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>>
Distance::Distance_Type get_min_path (typename GT::Node *s, typename GT::Node *end, Path< GT > &path, Distance distance=Distance())
 Extracts a shortest path from a graph painted by a shortest paths algorithm.
 
template<class Node >
auto & MAX_EP (Node *p) noexcept
 Access max_endpoint of an interval tree node.
 
template<class Node >
const auto & MAX_EP (const Node *p) noexcept
 
template<AlephGraph GT, template< class > class Max_Flow = Random_Preflow_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
long edge_connectivity (GT &g, SA sa=SA())
 Compute edge connectivity (arc connectivity) of an undirected graph.
 
template<AlephGraph GT, template< class > class Max_Flow = Heap_Preflow_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
long compute_min_cut (GT &g, DynSetTree< typename GT::Node * > &l, DynSetTree< typename GT::Node * > &r, DynDlist< typename GT::Arc * > &cut, SA sa=SA())
 Compute a minimum edge cut of an undirected graph.
 
template<AlephGraph GT, template< class > class Max_Flow = Random_Preflow_Maximum_Flow, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
long vertex_connectivity (GT &g, SA sa=SA())
 Compute vertex connectivity of an undirected graph.
 
template<class Net >
long & dinic_level (typename Net::Node *p) noexcept
 Access the node level in Dinic's algorithm.
 
template<class Net >
bool & dinic_blocked (typename Net::Node *p) noexcept
 Check if a node is blocked in Dinic's algorithm.
 
template<class Net >
size_t & dinic_current_arc (typename Net::Node *p) noexcept
 Access the current arc index in Dinic's algorithm.
 
template<class Net >
bool is_dinic_cookie_valid (typename Net::Node *p) noexcept
 Check if a node's cookie is properly initialized for Dinic's algorithm.
 
template<class Net >
bool build_level_graph (Net &net, typename Net::Node *source, typename Net::Node *sink)
 Build level graph using BFS from source.
 
template<class Net >
Net::Flow_Type dinic_blocking_flow (Net &net, typename Net::Node *source, typename Net::Node *sink)
 Find all blocking flows using iterative DFS with current-arc optimization.
 
template<FlowNetwork Net>
Net::Flow_Type dinic_maximum_flow (Net &net)
 Compute maximum flow using Dinic's algorithm.
 
template<FlowNetwork Net>
Net::Flow_Type capacity_scaling_maximum_flow (Net &net)
 Compute maximum flow using capacity scaling.
 
template<FlowNetwork Net>
FlowDecomposition< Net > decompose_flow (const Net &net)
 Decompose network flow into paths and cycles.
 
template<class Net >
long & hlpp_height (typename Net::Node *p) noexcept
 Access the height label stored in the node's cookie.
 
template<class Net >
Net::Flow_Type & hlpp_excess (typename Net::Node *p) noexcept
 Access the excess flow stored in the node's cookie.
 
template<FlowNetwork Net>
Net::Flow_Type hlpp_maximum_flow (Net &net)
 Compute maximum flow using Highest-Label Preflow-Push.
 
template<class Net >
FlowStatistics< typename Net::Flow_Type > compute_flow_statistics (const Net &net)
 Compute statistics about the current flow in a network.
 
template<class Net >
SSP_Node_Info< typename Net::Flow_Type > & ssp_info (typename Net::Node *p) noexcept
 Access SSP node info.
 
template<class Net >
Net::Flow_Type reduced_cost (const Net &net, typename Net::Arc *arc, bool forward)
 Compute reduced cost of an arc.
 
template<class Net >
bool ssp_shortest_path (Net &net, typename Net::Node *source, typename Net::Node *sink)
 
template<class Net >
std::pair< typename Net::Flow_Type, typename Net::Flow_Type > successive_shortest_paths (Net &net)
 Compute minimum cost maximum flow using Successive Shortest Paths.
 
template<class Net >
bool ssp_init_potentials (Net &net, typename Net::Node *source)
 Initialize potentials using Bellman-Ford.
 
template<class Net , class GetDemand >
TransshipmentResult< typename Net::Flow_Type > solve_transshipment (Net &net, GetDemand get_demand)
 Solve minimum cost transshipment problem.
 
template<typename Cost_Type >
AssignmentResult< Cost_Type > solve_assignment (const std::vector< std::vector< Cost_Type > > &costs)
 Solve the assignment problem using min-cost flow.
 
template<typename Cost_Type >
TransportationResult< Cost_Type > solve_transportation (const std::vector< Cost_Type > &supplies, const std::vector< Cost_Type > &demands, const std::vector< std::vector< Cost_Type > > &costs)
 Solve the transportation problem using min-cost flow.
 
template<class Net >
DynMapTree< typename Net::Arc *, typename Net::Flow_Type > save_flow_solution (const Net &net)
 Save network simplex solution for warm start.
 
template<class Net >
void restore_flow_solution (Net &net, const DynMapTree< typename Net::Arc *, typename Net::Flow_Type > &solution)
 Restore network simplex solution from warm start.
 
template<typename C , class M >
PolyFitAnalysis< C > analyze_fit (const Gen_MultiPolynomial< C, M > &poly, const Array< std::pair< Array< C >, C > > &data)
 Compute residual analysis for a polynomial fit.
 
template<typename C , class M >
Gen_MultiPolynomial< C, M > operator* (const C &s, const Gen_MultiPolynomial< C, M > &p)
 Scalar * polynomial (commutative).
 
template<typename C , class M >
Gen_MultiPolynomial< C, M > operator+ (const C &s, const Gen_MultiPolynomial< C, M > &p)
 Scalar + polynomial (commutative).
 
template<typename C , class M >
Gen_MultiPolynomial< C, M > operator- (const C &s, const Gen_MultiPolynomial< C, M > &p)
 Scalar - polynomial.
 
template<typename C , class M >
std::ostream & operator<< (std::ostream &out, const Gen_MultiPolynomial< C, M > &p)
 Stream insertion.
 
template<class Net >
MCF_Result< typename Net::Flow_Type > solve_multicommodity_flow (Net &net)
 Solve multi-commodity flow problem.
 
template<class Net >
bool is_residual (typename Net::Node *src, typename Net::Arc *a) noexcept
 Return true if arc a is residual with respect to src.
 
template<class Net >
Net::Flow_Type remaining_flow (typename Net::Node *src, typename Net::Arc *a) noexcept
 Return the remaining flow of a as seen from src.
 
template<class Net >
void print (const DynList< Parc< Net > > &sp)
 Print a semi-path to stdout.
 
template<class Net >
Net::Flow_Type increase_flow (Net &net, const Path< Net > &path)
 Increase flow along an augmenting path.
 
template<class Net >
void increase_flow (Net &net, const DynList< Parc< Net > > &semi_path, const typename Net::Flow_Type slack)
 Increase flow along a semi-path by a given slack.
 
template<class Net >
void decrease_flow (Net &net, const DynList< Parc< Net > > &semi_path, const typename Net::Flow_Type slack)
 Decrease flow along a semi-path by a given slack.
 
template<class Net , template< typename T > class Q>
Path< Net > find_aumenting_path (const Net &net, const typename Net::Flow_Type &min_slack)
 Find an augmenting path using DFS or BFS based on Q.
 
template<class Net >
Path< Net > find_aumenting_path_dfs (const Net &net, const typename Net::Flow_Type &min_slack)
 Find an augmenting path using DFS.
 
template<class Net >
Path< Net > find_aumenting_path_bfs (const Net &net, const typename Net::Flow_Type &min_slack)
 Find an augmenting path using BFS.
 
template<class Net , template< typename T > class Q>
SemiPath< Net > find_aumenting_semi_path (const Net &net, const typename Net::Flow_Type &slack)
 Find an augmenting semi-path using DFS or BFS based on Q.
 
template<class Net >
SemiPath< Net > find_aumenting_semi_path_dfs (const Net &net, const typename Net::Flow_Type &slack)
 Find an augmenting semi-path using DFS.
 
template<class Net >
SemiPath< Net > find_aumenting_semi_path_bfs (const Net &net, const typename Net::Flow_Type &slack)
 Find an augmenting semi-path using BFS.
 
template<class Net , template< typename T > class Q>
SemiPath< Net > find_decrementing_path (const Net &net, const typename Net::Flow_Type &slack)
 Find a decrementing semi-path using DFS or BFS based on Q.
 
template<class Net >
SemiPath< Net > find_decrementing_path_dfs (const Net &net, const typename Net::Flow_Type &slack)
 Find a decrementing semi-path using DFS.
 
template<class Net >
SemiPath< Net > find_decrementing_path_bfs (const Net &net, const typename Net::Flow_Type &slack)
 Find a decrementing semi-path using BFS.
 
template<class Net >
void create_residual_arc (const Net &net, PP_Res_Net< Net > &rnet, typename Net::Arc *a)
 Create residual arcs for a in the residual network.
 
template<class Net >
std::tuple< PP_Res_Net< Net >, typename PP_Res_Net< Net >::Node *, typename PP_Res_Net< Net >::Node * > preflow_create_residual_net (Net &net)
 Build the residual network for preflow-push algorithms.
 
template<class Rnet >
void update_flow (const Rnet &rnet)
 Propagate residual arc flows back to their original arcs.
 
template<class Net , template< class > class Find_Path>
Net::Flow_Type aumenting_path_maximum_flow (Net &net)
 Maximize flow using repeated augmenting-path searches.
 
template<class Net >
Net::Flow_Type ford_fulkerson_maximum_flow (Net &net)
 Maximize flow using the Ford-Fulkerson algorithm.
 
template<class Net >
Net::Flow_Type edmonds_karp_maximum_flow (Net &net)
 Maximize flow using the Edmonds-Karp algorithm.
 
template<class Net >
static bool is_node_active (const Net &net, typename Net::Node *p)
 Return true if p has excess flow in net.
 
template<class Rnet >
static bool is_node_active (typename Rnet::Node *p)
 Return true if residual node p has excess flow.
 
template<class Net >
static long & node_height (typename Net::Node *p)
 Access the height label stored in NODE_COUNTER.
 
template<class Net >
static void init_height_in_nodes (Net &net)
 Initialize node heights with BFS distance to the sink.
 
template<class Q_Type >
static void put_in_active_queue (Q_Type &q, typename Q_Type::Item_Type &p)
 Enqueue an active node if it is not already enqueued.
 
template<class Q_Type >
static Q_Type::Item_Type get_from_active_queue (Q_Type &q)
 Dequeue an active node and clear its queue mark.
 
template<class Q_Type >
static void remove_from_active_queue (Q_Type &q, typename Q_Type::Item_Type &p)
 Remove a node from the active queue and clear its queue mark.
 
template<class Net , class Q_Type >
Net::Flow_Type generic_preflow_vertex_push_maximum_flow (Net &net, Q_Type q=Q_Type())
 Generic preflow-push maximum flow (vertex-oriented).
 
template<class Rnet >
void init_height_in_nodes (Rnet &rnet, typename Rnet::Node *sink)
 Initialize node heights in a residual network from sink.
 
template<class Net >
Net::Flow_Type fifo_preflow_maximum_flow (Net &net)
 Preflow-push maximum flow using a FIFO queue of active nodes.
 
template<class Net >
Net::Flow_Type heap_preflow_maximum_flow (Net &net)
 Preflow-push maximum flow using a height-ordered heap.
 
template<class Net >
Net::Flow_Type random_preflow_maximum_flow (Net &net)
 Preflow-push maximum flow using a random active-node queue.
 
template<class Net >
Net::Flow_Type random_preflow_maximum_flow (Net &net, const unsigned long seed)
 Preflow-push maximum flow using a random active-node queue whose order takes the seed seed.
 
template<class Net , template< class > class Maxflow>
Net::Flow_Type min_cut (Net &net, DynSetTree< typename Net::Node * > &vs, DynSetTree< typename Net::Node * > &vt, DynList< typename Net::Arc * > &cuts, DynList< typename Net::Arc * > &cutt)
 Compute max flow and the corresponding minimum cut.
 
template<class Res_Net >
Res_Net::Arc * create_residual_arc (Res_Net &residual_net, typename Res_Net::Node *src, typename Res_Net::Node *tgt, const typename Res_Net::Flow_Type cap, const typename Res_Net::Flow_Type flow, const typename Res_Net::Flow_Type cost)
 Create a pair of residual arcs in the residual network.
 
template<class Net >
Residual_Net< typenameNet::Flow_Type >::Node * build_residual_net (const Net &net, Residual_Net< typename Net::Flow_Type > &rnet, DynMapTree< void *, void * > &arcs)
 Build a residual network from a flow network.
 
template<class Res_Net >
bool check_residual_net (const Res_Net &net)
 Verify residual network consistency.
 
template<class Res_Net >
void cancel_cycle (const Res_Net &, const Path< Res_Net > &path)
 Cancel a negative cycle by augmenting flow.
 
template<class Net >
void residual_to_net (const DynMapTree< void *, void * > &arcs)
 Transfer flow values from residual network back to original.
 
template<FlowNetwork Net, template< class > class Max_Flow_Algo = Ford_Fulkerson_Maximum_Flow>
std::tuple< size_t, double > max_flow_min_cost_by_cycle_canceling (Net &net, double it_factor=0.4, size_t step=10)
 Compute maximum flow at minimum cost using cycle canceling.
 
template<class Net >
void print_net_cost (const Net &net, std::ostream &out)
 Output a flow network to Graphviz format.
 
template<class Net >
void print_residual_net (const Residual_Net< typename Net::Flow_Type > &net, std::ostream &out)
 Output a residual network to Graphviz format.
 
template<class Net >
Feasible_Tree< Net > build_feasible_spanning_tree (const Net &net)
 Build feasible spanning tree classification.
 
template<class Net >
DynList< typename Net::Arc * > get_partial_arcs (const Net &net)
 Get arcs with partial flow (0 < flow < cap).
 
template<FlowNetwork Net, template< class > class Max_Flow_Algo = Ford_Fulkerson_Maximum_Flow>
size_t max_flow_min_cost_by_network_simplex (Net &net)
 Compute maximum flow at minimum cost using Network Simplex.
 
constexpr Bit_Column between (const std::int64_t lo, const std::int64_t hi)
 Column that holds the integers of [lo, hi].
 
constexpr Bit_Column bits (const unsigned n)
 Column of n bits without sign: the integers of [0, 2^n - 1].
 
constexpr Bit_Column signed_bits (const unsigned n)
 Column of n bits with sign: the integers of [-2^(n-1), 2^(n-1) - 1].
 
template<typename C >
Gen_Polynomial< C > operator* (const C &s, const Gen_Polynomial< C > &p)
 Scalar times polynomial (commutative form).
 
template<typename C >
Gen_Polynomial< C > operator+ (const C &s, const Gen_Polynomial< C > &p)
 Scalar plus polynomial (commutative form).
 
template<typename C >
Gen_Polynomial< C > operator- (const C &s, const Gen_Polynomial< C > &p)
 Scalar minus polynomial.
 
template<typename C >
std::ostream & operator<< (std::ostream &out, const Gen_Polynomial< C > &p)
 Stream output.
 
template<typename T , template< typename > class C>
auto shuffle (const C< T > &c)
 Randomly shuffle a sequence.
 
template<typename T , template< typename > class C>
C< T * > shuffle_ptr (const C< T > &c)
 Return a random sequence of pointers to items of a sequence.
 
template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
bool is_sorted (const Container< T > &cont, const Compare &cmp=Compare())
 Check if a container is sorted in ascending order.
 
template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
std::pair< bool, size_t > search_inversion (const Container< T > &cont, const Compare &cmp=Compare())
 Find the first inversion in a container.
 
template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
bool is_inversely_sorted (const Container< T > &cont, const Compare &cmp=Compare())
 Check if a container is sorted in descending order.
 
template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
std::pair< bool, size_t > test_sorted (const Container< T > &cont, const Compare &cmp=Compare())
 Test if a container is sorted, returning the inversion position.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void selection_sort (T *a, const size_t n, const Compare &cmp=Compare()) noexcept(noexcept(static_cast< bool >(cmp(a[0], a[0]))) and std::is_nothrow_swappable_v< T >)
 Sort an array using the selection sort algorithm.
 
template<class Link , class Compare >
Link * search_extreme (const Link &list, const Compare &cmp)
 Find the extreme (minimum or maximum) element in a linked list.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * search_extreme (const DynList< T > &list, const Compare &cmp=Compare())
 
template<class Compare >
Dlink * search_extreme (const Dlink &list, const Compare &cmp=Compare())
 
template<class Compare >
Slinknc * search_extreme (const Slinknc &list, const Compare &cmp=Compare())
 
template<class Compare >
void selection_sort (Dlink &list, Compare cmp)
 Selection sort for doubly-linked lists (Dlink).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void selection_sort (Dnode< T > &list, Compare cmp)
 Selection sort for Dnode-based doubly-linked lists.
 
template<typename T , class Equal = Aleph::equal_to<T>>
long sequential_search (T *a, const T &x, const long l, const long r, Equal eq=Equal())
 Linear search for an element in an array.
 
template<typename T , class Equal = Aleph::equal_to<T>>
long sequential_search (const DynArray< T > &a, const T &x, const long l, const long r, Equal eq=Equal())
 Linear search for an element in a dynamic array.
 
template<class Link , typename T , class Equal >
Link * sequential_search (const Link &list, const T &x, Equal &eq)
 Linear search for an element in a linked list.
 
template<typename T , class Equal = Aleph::equal_to<T>>
Dlink * sequential_search (const Dlink &list, const T &x, Equal eq=Equal())
 Linear search for an element in a Dlink list.
 
template<typename T , class Equal = Aleph::equal_to<T>>
Slinknc * sequential_search (const Slinknc &list, const T &x, Equal eq=Equal())
 Linear search for an element in an Slinknc list.
 
template<typename T , class Equal = Aleph::equal_to<T>>
Dnode< T > * sequential_search (Dnode< T > &list, const T &x, Equal &eq)
 Linear search over a list of Dnodes.
 
template<typename T , class Equal = Aleph::equal_to<T>>
Dnode< T > * sequential_search (Dnode< T > &list, const T &x, Equal &&eq=Equal())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , class Equal = Aleph::equal_to<T>>
const Dnode< T > * sequential_search (const Dnode< T > &list, const T &x, Equal &eq)
 Linear search over a list of Dnodes.
 
template<typename T , class Equal = Aleph::equal_to<T>>
const Dnode< T > * sequential_search (const Dnode< T > &list, const T &x, Equal &&eq=Equal())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , class Equal = Aleph::equal_to<T>>
T * sequential_search (DynDlist< T > &list, const T &x, Equal eq=Equal())
 Linear search on a DynDlist.
 
template<typename T , class Equal = Aleph::equal_to<T>>
const T * sequential_search (const DynDlist< T > &list, const T &x, Equal eq=Equal())
 Linear search on a DynDlist (const version).
 
template<typename T , class Equal = Aleph::equal_to<T>>
T * sequential_search (DynList< T > &list, const T &x, Equal eq=Equal())
 Linear search on a DynList.
 
template<typename T , class Equal = Aleph::equal_to<T>>
const T * sequential_search (const DynList< T > &list, const T &x, Equal eq=Equal())
 Linear search on a DynList (const version).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long search_extreme (T *a, const long l, const long r, const Compare &cmp=Compare())
 Generic search in an array of an extreme element.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long search_min (T *a, const long l, const long r, const Compare &cmp=Compare())
 Returns the smallest element of the array a between l and r.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
long search_max (T *a, const long l, const long r, const Compare &cmp=Compare())
 Returns the maximum element of the array a between l and r.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Dnode< T > * search_extreme (const Dnode< T > &list, const Compare &cmp=Compare())
 Overload of search_extreme.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * search_extreme (DynDlist< T > &list, const Compare &cmp=Compare())
 Search for an extreme element in a DynDlist.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * search_extreme (const DynDlist< T > &list, const Compare &cmp=Compare())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * search_extreme (DynList< T > &list, const Compare &cmp=Compare())
 Search for an extreme element in a DynList.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * search_min (DynDlist< T > &list, const Compare &cmp=Compare())
 Search for the minimum element in a DynDlist.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * search_min (const DynDlist< T > &list, const Compare &cmp=Compare())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
T * search_max (DynDlist< T > &list, const Compare &cmp=Compare())
 Search for the maximum element in a DynDlist.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
const T * search_max (const DynDlist< T > &list, const Compare &cmp=Compare())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void insertion_sort (T *a, const long l, const long r, const Compare &cmp=Compare()) noexcept(noexcept(static_cast< bool >(cmp(std::declval< T & >(), std::declval< T & >()))) and std::is_nothrow_move_constructible_v< T > and std::is_nothrow_move_assignable_v< T >)
 Sort an array using insertion sort.
 
template<class Compare >
void insert_sorted (Dlink &list, Dlink *p, const Compare &cmp)
 Inserts a node orderly into a doubly linked list.
 
template<class Compare >
void insert_sorted (HTList &list, Slinknc *p, const Compare &cmp)
 
template<class ListType , class Compare >
void list_insertion_sort (ListType &list, const Compare &cmp)
 Generic insertion sort for linked lists.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void insertion_sort (DynList< T > &l, const Compare &cmp=Compare())
 Insertion sort for DynList.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T > insertion_sort (DynList< T > &&l, const Compare &cmp=Compare())
 Insertion sort for DynList (rvalue overload).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void insertion_sort (Dnode< T > &list, const Compare &cmp=Compare())
 Insertion sort for Dnode-based lists.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void insertion_sort (DynDlist< T > &list, const Compare &cmp=Compare())
 Insertion sort for DynDlist.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void merge (T *a, const long l, const long m, const long r, Array< T > &buf, const Compare &cmp=Compare())
 Merge two sorted partitions of an array using a buffer.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void merge (T *a, const long l, const long m, const long r, const Compare &cmp=Compare())
 Merges two ordered partitions stored in an array.
 
template<typename T , class Compare >
void mergesort (T *a, const long l, const long r, Array< T > &buf, Compare cmp)
 Sort an array using merge sort with a reusable buffer.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void mergesort (T *a, const long l, const long r, const Compare &cmp=Compare())
 Sort an array using merge sort.
 
template<typename Tlist , class Compare >
void merge_lists (Tlist &l1, Tlist &l2, Tlist &result, const Compare &cmp=Compare())
 Merge two sorted lists into a single sorted list.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void merge_lists (Dnode< T > &l1, Dnode< T > &l2, Dnode< T > &result, const Compare &cmp=Compare())
 Merge two sorted Dnode-based lists.
 
template<typename Tlist , class Compare >
void mergesort (Tlist &list, const Compare &cmp=Compare())
 Sort a linked list using merge sort.
 
template<class Tlist , class Tlink , class Compare >
void __link_mergeinsertsort (Tlist &list, const size_t n, const Compare &cmp, const size_t lsz)
 
template<template< typename > class Tlist, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void mergeinsertsort (Tlist< T > &list, const Compare &cmp=Compare(), const size_t lsz=Aleph::Insertion_Threshold)
 Sort a list by mergesort combined with the insert method.
 
template<template< typename > class Tlist, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void mergesort (Tlist< T > &list, const Compare &cmp=Compare())
 Merge sort for generic list templates.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void mergesort (Dnode< T > &list, const Compare &cmp=Compare())
 Merge sort for Dnode-based lists.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void mergesort (DynDlist< T > &list, const Compare &cmp=Compare())
 Merge sort for DynDlist.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void mergesort (DynList< T > &list, const Compare &cmp=Compare())
 Merge sort for DynList.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T > mergesort (DynList< T > &&list, const Compare &cmp=Compare())
 Merge sort for DynList (rvalue overload).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long select_pivot (T *a, long l, long r, const Compare &cmp=Compare()) noexcept(noexcept(static_cast< bool >(cmp(a[0], a[0]))) and std::is_nothrow_swappable_v< T >)
 Select a pivot for partitioning using median-of-three.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long partition (T *a, const long l, const long r, const Compare &cmp=Compare()) noexcept(noexcept(static_cast< bool >(cmp(a[0], a[0]))) and std::is_nothrow_swappable_v< T >)
 Partition an array range [l, r] around a pivot.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort_rec (T *a, const long l, const long r, const Compare &cmp=Compare())
 Recursively sort an array using quicksort.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort_no_tail (T *a, long l, long r, const Compare &cmp=Compare())
 Quicksort implementation with tail-recursion optimization.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort_rec_min (T *a, const long l, const long r, const Compare &cmp=Compare())
 Sorts an array according to the quicksort method with minimum space consumption.
 
size_t introsort_depth_limit (size_t n) noexcept
 Forward declaration.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort (T *a, const long l, const long r, const Compare &cmp=Compare())
 Sort an array using iterative quicksort with optimizations.
 
template<typename T , class Compare >
void introsort_loop (T *a, long l, long r, size_t depth_limit, const Compare &cmp)
 Quicksort loop with a depth limit, after which heapsort sorts the range: the loop of introsort() before pattern-defeating quicksort.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void introsort (T *a, const long l, const long r, const Compare &cmp=Compare())
 Sort an array using introsort (introspective sort).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void introsort (T *a, const size_t n, const Compare &cmp=Compare())
 Sort an array using introsort (convenience overload).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void introsort (T *begin, T *end, const Compare &cmp=Compare())
 Sort a range using introsort (STL-style iterator interface).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void introsort (Array< T > &arr, const Compare &cmp=Compare())
 Introsort for Aleph Array.
 
template<class Compare >
void quicksort (Dlink &list, const Compare &cmp=Compare())
 Sorts a linked list by the quicksort method.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort (Dnode< T > &list, const Compare &cmp=Compare())
 Sorts a list by the quicksort method.
 
template<typename T , class Compare >
void quicksort (HTList &list, const Compare &cmp=Compare())
 Sort an HTList using the quicksort method.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort (DynList< T > &list, const Compare &cmp=Compare())
 Sort a DynList using the quicksort method.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort_insertion (T *a, const long l, const long r, const Compare &cmp=Compare())
 Sorts an array by the improved quicksort method.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long random_search (T *a, const T &x, const long l, const long r, const Compare &cmp=Compare())
 Random search for an element in an array.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long random_search (DynArray< T > &a, const T &x, const long l, const long r, const Compare &cmp=Compare())
 Random search for an element in a dynamic array.
 
template<typename T , class Compare >
Dnode< T > * dlink_random_search (Dlink &list, const T &x, const Compare &cmp=Compare())
 Random search for an element in a dlink list.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Dnode< T > * random_search (Dlink &list, const T &x, const Compare &cmp=Compare())
 Random search for an element in a Dnode<T> list.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * random_search (DynDlist< T > &list, const T &x, const Compare &cmp=Compare())
 Random search for an element in a dynamic list.
 
template<typename T , class Compare >
static std::pair< long, long > partition_three_way (T *a, long l, long r, const Compare &cmp)
 
template<class Container , typename T , class Compare >
static std::pair< long, long > partition_three_way_op (Container &a, long l, long r, const Compare &cmp)
 
template<typename T , class Compare >
static const T & __random_select (T *a, const long i, long l, long r, const Compare &cmp)
 
template<typename T , class Compare , typename Container >
long select_pivot_op_impl (const Container &a, const long l, const long r, const Compare &cmp)
 Implementation of pivot selection using operator().
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long select_pivot_op (const DynArray< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Selects a pivot element as the median between the ends and the center.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long select_pivot_op (const Array< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Selects a pivot element as the median between the ends and the center.
 
template<typename T , class Compare , typename Container >
long partition_op_impl (Container &a, const long l, const long r, const Compare &cmp)
 Implementation of partitioning using operator().
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long partition_op (DynArray< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Partition a DynArray using operator().
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long partition_op (Array< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Partition an Array using operator().
 
template<typename Container , class Compare >
static void insertion_sort_range (Container &a, long l, long r, const Compare &cmp)
 
template<typename T , class Compare >
static const T & __random_select (DynArray< T > &a, const long i, long l, long r, const Compare &cmp=Compare())
 
template<typename T , class Compare >
static const T & __random_select (Array< T > &a, const long i, long l, long r, const Compare &cmp=Compare())
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & random_select (DynArray< T > &a, const long i, const Compare &cmp=Compare())
 Select the i-th smallest element in a DynArray.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & random_select (Array< T > &a, const long i, const Compare &cmp=Compare())
 Select the i-th smallest element in an Array.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & random_select (T *a, const long i, const long n, const Compare &cmp=Compare())
 Select the k-th smallest element in an array (Quickselect).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & random_select (T *a, const long i, const long n, Compare &&cmp=Compare())
 Select the k-th smallest element in an array (convenience overload).
 
template<class Compare >
Dlink * dlink_random_select (Dlink &list, const size_t i, const Compare &cmp=Compare())
 Random selection of the ith element from a list based on Dlink.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Dnode< T > * random_select (Dlink &list, const size_t i, const Compare &cmp=Compare())
 Random selection of the ith element from a list based on Dlink.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * random_select (DynDlist< T > &list, const size_t i, const Compare &cmp=Compare())
 Random selection of the ith element from a dynamic list.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void selection_sort (DynArray< T > &a, const Compare &cmp=Compare())
 Sorts a dynamic array by the selection method.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void bubble_sort (DynArray< T > &a, const Compare &cmp=Compare())
 Sort a dynamic array using bubble sort.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void insertion_sort (C< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Sorts a dynamic array by the insert method.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void insertion_sort (C< T > &a, const Compare &cmp=Compare())
 See insertion_sort().
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void shellsort (DynArray< T > &a, const Compare &cmp=Compare())
 Sort a dynamic array using Shell sort.
 
static long back_index (const long i) noexcept
 Convert a 1-based heap index to a 0-based array index.
 
template<typename T , class Compare >
void sift_up (DynArray< T > &table, const long n, const Compare &cmp)
 Move an element up in a heap to restore heap property.
 
template<typename T , class Compare >
void sift_down (DynArray< T > &table, const long start, const long n, const Compare &cmp)
 Move an element down in a heap to restore heap property.
 
template<typename T , class Compare >
void sift_down (DynArray< T > &table, const long n, const Compare &cmp)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void heapsort (DynArray< T > &a, const Compare &cmp=Compare())
 Sort a dynamic array using heapsort.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long partition (C< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Partition a container using the last element as pivot.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort_rec (DynArray< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Recursively sort a dynamic array using quicksort.
 
template<class Stack , class A , class B >
void push2 (Stack &stack, const A &a, const B &b)
 Push two values onto a stack.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort (DynArray< T > &a, const Compare &cmp=Compare())
 Sorts a dynamic array by the quicksort method without recursion.
 
template<typename T , class Compare >
void sift_down_subrange (DynArray< T > &a, long start, const long n, const long offset, const Compare &cmp)
 Sift down operation for heapsort on a DynArray subrange.
 
template<typename T , class Compare >
void heapsort_subrange (DynArray< T > &a, const long l, const long r, const Compare &cmp)
 Heapsort implementation for a subrange of a DynArray.
 
template<typename T , class Compare >
void introsort_loop (DynArray< T > &a, long l, long r, size_t depth_limit, const Compare &cmp)
 Internal recursive function for introsort on DynArray.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void introsort (DynArray< T > &a, const Compare &cmp=Compare())
 Sort a dynamic array using introsort (introspective sort).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long search_extreme (const DynArray< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Generic search in a dynamic array of an extreme element.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
long search_max (const DynArray< T > &a, const long l, const long r, const Compare &cmp=Compare())
 Returns the maximum element of the array a between l and r.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long binary_search (const C< T > &a, const T &x, long l, long r, const Compare &cmp=Compare())
 Binary search on a sorted container.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long binary_search (const C< T * > &a, const T &x, long l, long r, const Compare &cmp=Compare())
 Binary search on a sorted container of pointers.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long binary_search (const C< T * > &a, const T &x, Compare &&cmp=Compare())
 Binary search on a sorted container of pointers (full range).
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long binary_search (const C< T > &a, const T &x, const Compare &cmp=Compare())
 Binary search on a dynamic ordered array.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< size_t > binary_search_dup (const C< T > &a, const T &x, const Compare &cmp=Compare())
 Binary search for all occurrences of a value.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< const T * > build_index_ptr (const C< T > &a, const Compare &cmp=Compare())
 Build an index array of pointers for indirect sorting (const version).
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< const T * > bsearch_dup (const C< T > &a, const T &x, const Compare &cmp=Compare())
 Search for all occurrences of a value returning pointers (const version).
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * bsearch (C< T > &a, const T &x, const Compare &cmp=Compare())
 Search for a value in a sorted container returning a pointer.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * bsearch (const C< T > &a, const T &x, const Compare &cmp=Compare())
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * bsearch (const C< T * > &a, const T &x, const Compare &cmp=Compare())
 Search for a value in a sorted container of pointers.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T * > bsearch_dup (C< T > &a, const T &x, const Compare &cmp=Compare())
 Search for all occurrences of a value returning pointers.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T * > bsearch_dup (const C< T * > &a, const T &x, const Compare &cmp=Compare())
 Search for all occurrences of a value in a container of pointers.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long binindex (const C< T > &a, const T &x, const Compare &cmp=Compare())
 Returns the index where a value appears (or should be inserted) in a sorted container.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< long > binindex_dup (const C< T > &a, const T &x, const Compare &cmp=Compare())
 Returns the indices of all occurrences of a value in a sorted container.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< long > binindex_dup (const C< T * > &a, const T &x, const Compare &cmp=Compare())
 Search for all indices of a value in a sorted container of pointers.
 
template<class C , StrictWeakOrder< sort_utils_detail::Indexed_Value_Type< C > > Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > build_index (const C &a, const Compare &cmp=Compare())
 Build an index array for indirect sorting.
 
template<class C , StrictWeakOrder< sort_utils_detail::Indexed_Value_Type< C > > Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > stable_build_index (const C &a, const Compare &cmp=Compare())
 Build a stable index array for indirect sorting.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< T * > build_index_ptr (C< T > &a, const Compare &cmp=Compare())
 Builds and returns an array of pointers to the elements of container a sorted according to the comparison functor.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< const T * > stable_build_index_ptr (const C< T > &a, const Compare &cmp=Compare())
 Build a stable index array of pointers for indirect sorting (const version).
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< T * > stable_build_index_ptr (C< T > &a, const Compare &cmp=Compare())
 Build a stable index array of pointers for indirect sorting.
 
template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void quicksort_op (C< T > &a, const Compare &cmp=Compare(), const size_t threshold=Quicksort_Threshold)
 Optimized quicksort for containers using operator().
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long binary_search_rec (T *a, const T &x, const long l, const long r, const Compare &cmp=Compare())
 Recursive binary search on an ordered array.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long binary_search (T *a, const T &x, long l, long r, const Compare &cmp=Compare())
 Iterative binary search on an ordered array.
 
template<typename KeyFn >
requires std::invocable<const KeyFn &, size_t>
and std::convertible_to< std::invoke_result_t< const KeyFn &, size_t >, int > void counting_sort_indices (Array< size_t > &sa, Array< size_t > &tmp, const size_t n, const int min_key, const int max_key, const KeyFn &key_of)
 Stable counting sort on an index array by integer keys.
 
template<typename T >
requires CountingSortable<T>
void counting_sort (DynArray< T > &a)
 Stable counting sort for integral DynArray values.
 
template<typename T >
requires CountingSortable<T>
void counting_sort (Array< T > &a)
 Stable counting sort for integral Array values.
 
template<typename T >
requires CountingSortable<T>
void counting_sort (DynList< T > &list)
 Stable counting sort for integral DynList values.
 
template<typename T >
requires CountingSortable<T>
void counting_sort (DynDlist< T > &list)
 Stable counting sort for integral DynDlist values.
 
template<typename T >
requires CountingSortable<T>
void counting_sort (T *a, const size_t n)
 Stable counting sort for raw integral arrays.
 
template<typename T , size_t N>
requires CountingSortable<T>
void counting_sort (T(&a)[N])
 Stable counting sort for fixed-size integral C arrays.
 
template<typename T >
requires RadixSortable<T>
void radix_sort (DynArray< T > &a)
 LSD radix sort for integral DynArray values.
 
template<typename T >
requires RadixSortable<T>
void radix_sort (Array< T > &a)
 LSD radix sort for integral Array values.
 
template<typename T >
requires RadixSortable<T>
void radix_sort (DynList< T > &list)
 LSD radix sort for integral DynList values.
 
template<typename T >
requires RadixSortable<T>
void radix_sort (DynDlist< T > &list)
 LSD radix sort for integral DynDlist values.
 
template<typename T >
requires RadixSortable<T>
void radix_sort (T *a, const size_t n)
 LSD radix sort for raw integral arrays.
 
template<typename T , size_t N>
requires RadixSortable<T>
void radix_sort (T(&a)[N])
 LSD radix sort for fixed-size integral C arrays.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>, class BucketKey >
void bucket_sort (T *a, const size_t n, const size_t num_buckets, const BucketKey &bucket_key, const Compare &cmp=Compare())
 Bucket sort with user-supplied bucket mapping.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void bucket_sort (T *a, const size_t n, const Compare &cmp=Compare())
 Bucket sort convenience for floating-point arrays.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void bucket_sort (DynArray< T > &a, const Compare &cmp=Compare())
 Bucket sort for DynArray (floating-point convenience).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void bucket_sort (Array< T > &a, const Compare &cmp=Compare())
 Bucket sort for Array (floating-point convenience).
 
template<typename T , size_t N, StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void bucket_sort (T(&a)[N], const Compare &cmp=Compare())
 Bucket sort for fixed-size C arrays (floating-point convenience).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void bucket_sort (DynList< T > &list, const Compare &cmp=Compare())
 Bucket sort for DynList (floating-point convenience).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>, class BucketKey >
void bucket_sort (DynArray< T > &a, const size_t num_buckets, const BucketKey &bucket_key, const Compare &cmp=Compare())
 Bucket sort for DynArray with user-supplied bucket mapping.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>, class BucketKey >
void bucket_sort (Array< T > &a, const size_t num_buckets, const BucketKey &bucket_key, const Compare &cmp=Compare())
 Bucket sort for Array with user-supplied bucket mapping.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void timsort (T *a, const size_t n, const Compare &cmp=Compare())
 Timsort — adaptive, stable, natural merge sort.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void timsort (T *a, const long l, const long r, const Compare &cmp=Compare())
 Timsort on a sub-range [l, r] (inclusive indices).
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void timsort (DynArray< T > &a, const Compare &cmp=Compare())
 Timsort for DynArray.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void timsort (Array< T > &a, const Compare &cmp=Compare())
 Timsort for Array.
 
template<typename T , size_t N, StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::is_invocable_r_v<bool, Compare, const T &, const T &>
void timsort (T(&a)[N], const Compare &cmp=Compare())
 Timsort for fixed-size C arrays.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void timsort (DynList< T > &list, const Compare &cmp=Compare())
 Timsort for DynList.
 
template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void timsort (DynDlist< T > &list, const Compare &cmp=Compare())
 Timsort for DynDlist.
 
template<class Node >
static void clone_tree (Node *src, Node *tgt)
 Copies the subtrees of the children of src as children of tgt.
 
template<class Node >
Node * clone_tree (Node *root)
 Returns a copy of the tree rooted at root.
 
template<class Node >
static void __tree_preorder_traversal (Node *root, const int &level, const int &child_index, void(*visitFct)(Node *, int, int))
 
template<class Node >
void tree_preorder_traversal (Node *root, void(*visitFct)(Node *, int, int))
 Preorder traversal of a tree.
 
template<class Node >
void forest_preorder_traversal (Node *root, void(*visitFct)(Node *, int, int))
 Preorder traversal of a forest.
 
template<class Node >
static void __tree_postorder_traversal (Node *node, const int &level, const int &child_index, void(*visitFct)(Node *, int, int))
 
template<class Node >
void tree_postorder_traversal (Node *root, void(*visitFct)(Node *, int, int))
 Postorder traversal of a tree.
 
template<class Node >
void forest_postorder_traversal (Node *root, void(*visitFct)(Node *, int, int))
 Postorder traversal of a forest.
 
template<class Node , class Eq >
bool are_tree_equal (Node *t1, Node *t2, Eq &eq)
 Returns true if t1 is equal to t2.
 
template<class Node , class Eq = std::equal_to<typename Node::key_type>>
bool are_tree_equal (Node *t1, Node *t2, Eq &&eq=Eq())
 
template<class Node >
void destroy_tree (Node *root)
 Destroys (frees memory) the tree whose root is root.
 
template<class Node >
void destroy_forest (Node *root)
 Destroys (frees memory) the forest whose first tree is root.
 
template<class Node >
size_t compute_height (Node *root)
 Computes the height of the tree root.
 
template<class Node >
static Node * __deway_search (Node *node, int path[], const int &idx, const size_t &size)
 
template<class Node >
Node * deway_search (Node *root, int path[], const size_t &size)
 Returns a node of a forest given its Dewey number.
 
template<class Node , class Equal >
static Node * __search_deway (Node *root, const typename Node::key_type &key, const size_t &current_level, int deway[], const size_t &size, size_t &n)
 
template<class Node , class Equal = Aleph::equal_to<typename Node::key_type>>
Node * search_deway (Node *root, const typename Node::key_type &key, int deway[], const size_t &size, size_t &n)
 Searches key in a forest and computes the Dewey number of the node containing the key.
 
template<class TNode , class BNode >
BNode * forest_to_bin (TNode *root)
 Converts a forest to its equivalent binary tree.
 
template<class TNode , class BNode >
static void insert_child (BNode *lnode, TNode *tree_node)
 
template<class TNode , class BNode >
static void insert_sibling (BNode *rnode, TNode *tree_node)
 
template<class TNode , class BNode >
static void bin_to_tree (BNode *broot, TNode *troot)
 
template<class TNode , class BNode >
TNode * bin_to_forest (BNode *broot)
 Converts a binary tree to its equivalent forest.
 
template<class Node >
unsigned long & PRIO (Node *p) noexcept
 Access the priority of a treap node.
 
template<class Node >
bool is_treap (Node *root) noexcept
 Validate that a tree satisfies treap (heap) property.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Array< size_t > tree_subtree_sizes (const GT &g, typename GT::Node *root, SA sa=SA())
 Compute subtree sizes for every node.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Array< size_t > tree_max_distance (const GT &g, typename GT::Node *root, SA sa=SA())
 Compute the maximum distance from each node to any leaf.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Array< size_t > tree_sum_of_distances (const GT &g, typename GT::Node *root, SA sa=SA())
 Compute sum of distances from each node to all others.
 
template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void warshall_compute_transitive_clausure (GT &g, Bit_Mat_Graph< GT, SA > &mat, SA sa=SA())
 Computes the transitive closure of a graph using Warshall's algorithm.
 

Variables

constexpr unexpect_t unexpect {}
 Tag value of type unexpect_t.
 
constexpr size_t dynamic_extent = static_cast<size_t>(-1)
 Sentinel marking an axis whose extent is only known at run time.
 
template<typename... Args>
constexpr bool are_stream_insertable_v
 
bool daemonized = false
 Flag indicating if the process is running as a daemon.
 
const IPv4_Address Null_IPv4_Address = 0
 Null/invalid IPv4 address constant.
 
bool verbose = false
 Flag enabling verbose output.
 
double max_time = 300
 Maximum allowed execution time (in seconds).
 
const int UnknownSize = -1
 Constant indicating unknown size.
 
const int UnknownLine = -1
 Constant indicating unknown line number.
 
const int UnknownLoad = -1
 Constant indicating unknown load factor.
 
template<AlephSequentialIterableContainer Container, class Hash , class Equal >
requires (const typename Container::Item_Type &v, Hash h, Equal e)
 and
 Check uniqueness with explicit hash + equality functors.
 
const unsigned char Unprocessed = 0
 The node have not bees processed.
 
const unsigned char Processing = 1
 The node are being processed; probably it is inside a queue, stack or heap.
 
const unsigned char Processed = 2
 The node or arc has already been processed.
 
static const long No_Visited = 0
 
Gsl_Compatible_Rng * rand_gen = nullptr
 Internal RNG handle used by the helper functors in this header.
 
template<class Container >
constexpr bool filter_iterator_keeps_copy
 Whether a Filter_Iterator keeps a copy of its container, and not its address.
 
constexpr size_t Max_Tree_Node_Depth = 1024
 The depth of the trees that generate_tree() wrote before 7.3.2; it writes trees of any depth now.
 
const float hash_default_lower_alpha = 0.25
 
const float hash_default_upper_alpha = 0.90
 
const unsigned Default_Hash_Seed = 52679987
 
static long tab [256]
 
static std::once_flag jsw_init_flag
 
static std::atomic< bool > init {false}
 
static std::shared_mutex jsw_mtx
 
static constexpr std::uint32_t Aleph_Snd_Hash_Seed = 0x9e3779b9u
 Fixed seed used by the secondary hash function.
 
const Geom_Number LINE_EPSILON (0)
 Default epsilon for geometric comparisons.
 
constexpr size_t MIN_NODE_FIELDS = 7
 Minimum expected columns for a node record.
 
constexpr size_t Buffer_Size = 512
 Default buffer size for token parsing.
 
int current_line_number = 1
 Current line number in the input stream.
 
int current_col_number = 1
 Current column number in the input stream.
 
int previous_line_number = 1
 Line number at the start of the current token.
 
int previous_col_number = 1
 Column number at the start of the current token.
 
std::string token_instance
 The most recently scanned token.
 
constexpr double PI = 3.1415926535897932384626433832795028841971693993751
 
constexpr double PI_2 = PI / 2.0
 
constexpr double PI_4 = PI / 4.0
 
constexpr size_t Search_Unlimited = std::numeric_limits<size_t>::max()
 Sentinel used by SearchLimits to mean "no bound".
 
template<class Fct , class... Args>
constexpr bool nothrow_condition_v
 Whether calling Fct with Args, and taking its result as a bool in either way, cannot throw.
 
template<class Cmp , class Key >
constexpr bool nothrow_compare_keys_v
 Whether the calls of Cmp that compare two keys of type Key, constant or not, give a bool without throwing.
 
template<class Compare , class Key >
constexpr bool nothrow_compare_v
 Whether Compare compares two keys of type Key without throwing, as the operations of the trees call it.
 
template<class Compare , class Key >
constexpr bool nothrow_compare_copy_v
 Whether Compare compares two keys of type Key without throwing, as nothrow_compare_v, and can be copied without throwing.
 
constexpr size_t Bin_Tree_Depth_Bound = 128
 Depth up to which the traversals below work inside the call stack.
 
template<class GT , class SA >
constexpr bool nothrow_arc_filter_v
 Whether a filter of type SA of the arcs of GT is copied, moved and called without exceptions: then an iterator that it filters, and a search through one, throw nothing.
 
constexpr long Cross_Arc = -1
 Special marker for arcs connecting a cut node to a non-cut block.
 
size_t Insertion_Threshold = 40
 Threshold for switching to insertion sort in hybrid algorithms.
 
size_t Quicksort_Threshold = 40
 Threshold for using quicksort vs simpler algorithms.
 
const int Not_Found = -1
 Return value for search functions when element is not found.
 
template<typename F , typename T >
constexpr bool is_known_non_idempotent_op
 True if F is known not to be idempotent over T.
 
const long Max_Priority = ULONG_MAX
 Maximum priority value (used for sentinel/leaves)
 
const long Min_Priority = 0
 Minimum priority value.
 
bool with_power = false
 Configuration options for DOT file generation.
 
bool with_nes = false
 If true, include NES percentage in node labels.
 
bool only_num = false
 If true, show only the node number, not the full label.
 
bool with_class = false
 If true, set node shapes based on class field.
 
size_t font_size = 6
 Font size for the DOT output.
 
bool vertical = true
 If true, use vertical layout (default).
 

Detailed Description

Main namespace for Aleph-w library functions.

When compiling with libc++, the gmpxx library's low-level stream operators (compiled against libstdc++) are unavailable.

The gmpxx header template operator<<(__gmp_expr<T,U>) ultimately calls o << temp.__get_mp(), which resolves to these overloads. Provide them here so that all GMP expression types can be printed, not just mpq_class.

Typedef Documentation

◆ __Net_Iterator

template<class Net >
using Aleph::__Net_Iterator = typedef Digraph_Iterator<Net, Net_Filt<Net> >

Definition at line 269 of file tpl_net.H.

◆ AdversarialTranspositionTable

template<typename StateKey , SearchMove Move, AdversarialScore Score, template< typename, typename, class > class HashMapTable = MapOLhash, class Cmp = Aleph::equal_to<AdversarialTranspositionKey<StateKey>>>
using Aleph::AdversarialTranspositionTable = typedef Transposition_Table<AdversarialTranspositionKey<StateKey>, AdversarialTranspositionEntry<Move, Score>, HashMapTable, Cmp, Prefer_Exact_Adversarial_Entry<Move, Score> >

Definition at line 146 of file Negamax.H.

◆ AP_Res_Net

template<class Net >
using Aleph::AP_Res_Net = typedef Array_Digraph<Net_Node<Empty_Class>, __Res_Arc<Net> >

Residual network for augmenting-path algorithms.

Definition at line 2144 of file tpl_net.H.

◆ Arco

using Aleph::Arco = typedef Graph_Arc<std::string>

Arc type for the digraph (edge info is a string).

Definition at line 99 of file load_digraph.H.

◆ B_Tree

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
using Aleph::B_Tree = typedef Gen_B_Tree<Key, Compare, MinDegree>

Convenient B-Tree alias.

Template Parameters
KeyKey type stored in the tree.
CompareOrdering functor.
MinDegreeMinimum degree t.

Definition at line 940 of file tpl_b_tree.H.

◆ Binary_Lifting_LCA

template<class GT , class SA = Dft_Show_Arc<GT>>
using Aleph::Binary_Lifting_LCA = typedef Gen_Binary_Lifting_LCA<GT, SA>

Convenience alias for binary-lifting LCA.

Definition at line 1088 of file LCA.H.

◆ bounded_channel

template<typename T >
using Aleph::bounded_channel = typedef BoundedChannel<T>

Alias for Aleph::BoundedChannel.

Template Parameters
TValue type stored in the channel.
Note
Inherits the same thread-safety, blocking, close, and cancellation semantics as BoundedChannel<T>.

Definition at line 1452 of file concurrency_utils.H.

◆ BPlus_Tree

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
using Aleph::BPlus_Tree = typedef Gen_BPlus_Tree<Key, Compare, MinDegree>

Convenient B+ Tree alias.

Template Parameters
KeyKey type stored in the tree.
CompareOrdering functor.
MinDegreeMinimum degree t.

Definition at line 1175 of file tpl_bplus_tree.H.

◆ Centroid_Decomposition

template<class GT , class SA = Dft_Show_Arc<GT>>
using Aleph::Centroid_Decomposition = typedef Gen_Centroid_Decomposition<GT, SA>

Convenience alias for centroid decomposition.

Definition at line 1669 of file Tree_Decomposition.H.

◆ Code_Map

typedef DynMapTree<std::string, BitArray, Treap_Vtl> Aleph::Code_Map

Definition at line 108 of file Huffman.H.

◆ Color

typedef unsigned char Aleph::Color

Definition at line 50 of file rbNodeRk.H.

◆ Compare_Snodenc

template<typename T , class Compare >
using Aleph::Compare_Snodenc = typedef Compare_Tnode<Slinknc, Snodenc, T, Compare>

Comparator specialization for Snodenc objects.

Definition at line 520 of file tpl_sort_utils.H.

◆ Compiler_Bytecode_Block_Id

using Aleph::Compiler_Bytecode_Block_Id = typedef size_t

Definition at line 79 of file Bytecode.H.

◆ Compiler_Bytecode_Constant_Id

using Aleph::Compiler_Bytecode_Constant_Id = typedef size_t

Definition at line 77 of file Bytecode.H.

◆ Compiler_Bytecode_Function_Id

using Aleph::Compiler_Bytecode_Function_Id = typedef size_t

Definition at line 78 of file Bytecode.H.

◆ Compiler_Bytecode_PC

using Aleph::Compiler_Bytecode_PC = typedef size_t

Definition at line 80 of file Bytecode.H.

◆ Compiler_Bytecode_Register_Id

using Aleph::Compiler_Bytecode_Register_Id = typedef size_t

Definition at line 76 of file Bytecode.H.

◆ Compiler_CFG_Block_Id

using Aleph::Compiler_CFG_Block_Id = typedef size_t

Typedef for unique block identifiers within a function.

Definition at line 71 of file Compiler_CFG.H.

◆ Compiler_IR_Block_Id

using Aleph::Compiler_IR_Block_Id = typedef size_t

Definition at line 69 of file Compiler_IR_Model.H.

◆ Compiler_IR_Function_Id

using Aleph::Compiler_IR_Function_Id = typedef size_t

Definition at line 68 of file Compiler_IR_Model.H.

◆ Compiler_IR_Global_Slot_Id

using Aleph::Compiler_IR_Global_Slot_Id = typedef size_t

Definition at line 67 of file Compiler_IR_Model.H.

◆ Compiler_IR_Local_Slot_Id

using Aleph::Compiler_IR_Local_Slot_Id = typedef size_t

Definition at line 66 of file Compiler_IR_Model.H.

◆ Compiler_IR_Value_Id

using Aleph::Compiler_IR_Value_Id = typedef size_t

Definition at line 65 of file Compiler_IR_Model.H.

◆ Compiler_SSA_Block_Id

using Aleph::Compiler_SSA_Block_Id = typedef size_t

Definition at line 69 of file SSA.H.

◆ Compiler_SSA_Value_Id

using Aleph::Compiler_SSA_Value_Id = typedef size_t

Definition at line 68 of file SSA.H.

◆ Compiler_Symbol_Id

using Aleph::Compiler_Symbol_Id = typedef size_t

Definition at line 52 of file Compiler_Symbol_Bindings.H.

◆ Compiler_Type_Constraint

◆ Compiler_Type_Constraint_Set

◆ Compiler_Type_Id

using Aleph::Compiler_Type_Id = typedef size_t

Definition at line 64 of file Compiler_Types.H.

◆ const_iterator_t

template<class C >
using Aleph::const_iterator_t = typedef Const_Iterator<typename C::Iterator>

The read-only iterator of the container C.

Template Parameters
Ca container with a nested Iterator.

Definition at line 538 of file ah-iterator.H.

◆ Default_Planar_Dual_Graph

Definition at line 454 of file Planarity_Test.H.

◆ dextents

template<class IndexType , size_t Rank>
using Aleph::dextents = typedef typename decltype(mdspan_detail::dextents_of<IndexType>( std::make_index_sequence<Rank>{}))::type

extents<IndexType, ...> with all Rank axes dynamic — the common case.

Definition at line 402 of file ah-mdspan.H.

◆ Df_Low_Non_Tree_Arc

Arc of the graph that is not in the depth-first tree.

The tree nodes of its two ends: first the descendant, then the ancestor.

Definition at line 117 of file generate_df_tree.H.

◆ Df_Low_Tree_Node

Node of the depth-first tree that build_df_low_tree() returns.

Definition at line 110 of file generate_df_tree.H.

◆ Digrafo

using Aleph::Digrafo = typedef List_Digraph<Nodo, Arco>

Digraph type used by the loader.

Definition at line 102 of file load_digraph.H.

◆ Distinct_Count_Mo

template<typename T >
using Aleph::Distinct_Count_Mo = typedef Gen_Mo_Algorithm<T, Distinct_Count_Policy<T> >

Mo's algorithm specialised for counting distinct elements.

Template Parameters
TElement type (must be hashable).

Definition at line 583 of file tpl_mo_algorithm.H.

◆ Double

typedef Field<double> Aleph::Double

Definition at line 142 of file ahField.H.

◆ DynHashMap

template<typename Key , typename Data , template< typename, typename, class > class HashMapTable = MapOLhash, class Cmp = Aleph::equal_to<Key>>
using Aleph::DynHashMap = typedef HashMap<Key, Data, HashMapTable, Cmp>

Alias for HashMap (for consistency with other Dyn containers).

Defaults to MapOLhash (linear probing) for better cache locality. Use MapODhash explicitly when double-hashing distribution is preferred.

Definition at line 183 of file tpl_hash.H.

◆ DynHashSet

template<typename Key , template< typename, class > class HashSetTable = OLhashTable, class Cmp = Aleph::equal_to<Key>>
using Aleph::DynHashSet = typedef HashSet<Key, HashSetTable, Cmp>

Alias for HashSet (for consistency with other Dyn containers).

Defaults to OLhashTable (linear probing) for better cache locality. Use ODhashTable explicitly when double-hashing distribution is preferred.

Definition at line 174 of file tpl_hash.H.

◆ Euler_RMQ_LCA

template<class GT , class SA = Dft_Show_Arc<GT>>
using Aleph::Euler_RMQ_LCA = typedef Gen_Euler_RMQ_LCA<GT, SA>

Convenience alias for Euler+RMQ LCA.

Definition at line 1092 of file LCA.H.

◆ ExceptionCallback

using Aleph::ExceptionCallback = typedef std::function<void(std::exception_ptr)>

Type for exception callback in detached tasks.

Definition at line 606 of file thread_pool.H.

◆ Feasible_Tree

template<class Net >
using Aleph::Feasible_Tree = typedef std::tuple<DynList<typename Net::Arc *>, DynList<typename Net::Arc *>, DynList<typename Net::Arc *> >

Feasible spanning tree classification.

Tuple of (empty arcs, full arcs, partial arcs) where:

  • Empty: flow = 0
  • Full: flow = capacity
  • Partial: 0 < flow < capacity
Template Parameters
NetNetwork type.

Definition at line 1081 of file tpl_netcost.H.

◆ File_B_Map

template<typename Key , typename Value , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename KeyCodec = detail::Paged_Value_Codec<Key>, typename ValueCodec = detail::Paged_Value_Codec<Value>>
using Aleph::File_B_Map = typedef Gen_File_B_Map<Key, Value, Compare, MinDegree, KeyCodec, ValueCodec>

Convenient alias for a persistent B-Tree map.

Definition at line 715 of file tpl_file_b_map.H.

◆ File_B_Tree

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using Aleph::File_B_Tree = typedef Gen_File_B_Tree<Key, Compare, MinDegree, Codec>

Convenient alias for a page-managed persistent B-Tree.

Definition at line 2663 of file tpl_file_b_tree.H.

◆ File_BPlus_Map

template<typename Key , typename Value , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename KeyCodec = detail::Paged_Value_Codec<Key>, typename ValueCodec = detail::Paged_Value_Codec<Value>>
using Aleph::File_BPlus_Map = typedef Gen_File_BPlus_Map<Key, Value, Compare, MinDegree, KeyCodec, ValueCodec>

Convenient alias for a persistent B+ Tree map.

Definition at line 744 of file tpl_file_bplus_map.H.

◆ File_BPlus_Tree

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16, typename Codec = detail::Paged_Value_Codec<Key>>
using Aleph::File_BPlus_Tree = typedef Gen_File_BPlus_Tree<Key, Compare, MinDegree, Codec>

Convenient alias for a page-managed persistent B+ Tree.

Definition at line 2881 of file tpl_file_bplus_tree.H.

◆ Find_Aumenting_Path_BFS

Augmenting-path finder using BFS (queue).

Definition at line 2008 of file tpl_net.H.

◆ Find_Aumenting_Path_DFS

Augmenting-path finder using DFS (stack).

Warning
With a floating flow, its paths may not end on networks of some hundreds of nodes with capacities not exact in binary, as tenths: see aumenting_path_maximum_flow().

Definition at line 2004 of file tpl_net.H.

◆ Float

typedef Field<float> Aleph::Float

Definition at line 140 of file ahField.H.

◆ Freq_Node

using Aleph::Freq_Node = typedef BinNode<std::pair<std::string, size_t> >

Definition at line 62 of file Huffman.H.

◆ FunnelPortal

Definition at line 1237 of file tikzgeom_algorithms.H.

◆ Geom_Number

using Aleph::Geom_Number = typedef mpq_class

Numeric type used by the geometry module.

Currently, this is an arbitrary precision rational (mpq_class). All helper routines convert to/from mpfr_class internally when transcendentals are required.

Definition at line 113 of file point.H.

◆ Graph_Traverse_BFS_Generator

template<class GT , class Itor , class Show_Arc = Dft_Show_Arc<GT>>
using Aleph::Graph_Traverse_BFS_Generator = typedef Graph_Traverse_Generator<GT, Itor, DynListQueue, Show_Arc>

Lazy breadth-first traversal: Graph_Traverse_Generator with a DynListQueue frontier.

Mirrors Graph_Traverse_BFS.

Definition at line 252 of file graph-traverse-generators.H.

◆ Graph_Traverse_DFS_Generator

template<class GT , class Itor , class Show_Arc = Dft_Show_Arc<GT>>
using Aleph::Graph_Traverse_DFS_Generator = typedef Graph_Traverse_Generator<GT, Itor, DynListStack, Show_Arc>

Lazy depth-first traversal: Graph_Traverse_Generator with a DynListStack frontier.

Mirrors Graph_Traverse_DFS.

Definition at line 246 of file graph-traverse-generators.H.

◆ Heavy_Light_Decomposition

template<class GT , class SA = Dft_Show_Arc<GT>>
using Aleph::Heavy_Light_Decomposition = typedef Gen_Heavy_Light_Decomposition<GT, SA>

Convenience alias for heavy-light decomposition.

Definition at line 1658 of file Tree_Decomposition.H.

◆ HLD_Path_Query

template<class GT , typename T = typename GT::Node::Node_Type, class Op = Aleph::plus<T>, class SA = Dft_Show_Arc<GT>>
using Aleph::HLD_Path_Query = typedef Gen_HLD_Path_Query<GT, T, Op, SA>

Convenience alias for segment-tree-backed HLD queries.

Definition at line 1665 of file Tree_Decomposition.H.

◆ Huffman_Heap

typedef BinHeap<size_t> Aleph::Huffman_Heap

Definition at line 91 of file Huffman.H.

◆ Incumbent

template<typename Solution , typename Compare = KeepFirstSolution<Solution>>
using Aleph::Incumbent = typedef BestSolution<Solution, Compare>

Alias used by optimization/search engines for their current best.

Definition at line 604 of file state_search_common.H.

◆ Info_Nodo

using Aleph::Info_Nodo = typedef std::pair<std::string, DynDlist<std::string> >

Node payload: (id, fields) where fields come from the input row.

Definition at line 93 of file load_digraph.H.

◆ Integer

typedef Field<int> Aleph::Integer

Definition at line 136 of file ahField.H.

◆ Interpreter_Host_Function

using Aleph::Interpreter_Host_Function = typedef bool (*)(void *user_data, const DynArray<Interpreter_Value> &arguments, Interpreter_Value &result, Interpreter_Runtime_Error &error)

Host callback signature used by runtime built-ins or embeddings.

Parameters
user_dataOpaque embedding-owned pointer.
argumentsPositional arguments already evaluated by the runtime.
resultOutput slot for the produced runtime value.
errorOutput slot for structured runtime failures.
Returns
true on success, false if error was populated.

Definition at line 179 of file Interpreter_Runtime.H.

◆ interval_endpoint_t

template<typename Key >
using Aleph::interval_endpoint_t = typedef typename interval_endpoint<Key>::type

Definition at line 251 of file tpl_interval_tree.H.

◆ IntMultiPolynomial

Multivariate polynomial with integer (long long) coefficients, grevlex.

Definition at line 4606 of file tpl_multi_polynomial.H.

◆ IntMultiPolynomial_Lex

Multivariate polynomial with integer (long long) coefficients, lex.

Definition at line 4609 of file tpl_multi_polynomial.H.

◆ IntPolynomial

using Aleph::IntPolynomial = typedef Gen_Polynomial<long long>

Polynomial with long long (integer) coefficients.

Definition at line 2940 of file tpl_polynomial.H.

◆ IPv4_Address

typedef uint32_t Aleph::IPv4_Address

Type alias for IPv4 addresses stored as 32-bit integers.

Definition at line 91 of file ahDefs.H.

◆ Item_Type

using Aleph::Item_Type = typedef T

Type of elements from the first container.

Definition at line 161 of file ah-zip.H.

◆ Karger_Stein_Min_Cut

template<class GT , class SA = Dft_Show_Arc<GT>>
using Aleph::Karger_Stein_Min_Cut = typedef Karger_Min_Cut<GT, SA>

Alias for Karger_Min_Cut (use fast() method for Karger-Stein)

The Karger-Stein algorithm is implemented as the fast() method in Karger_Min_Cut. This alias is provided for clarity.

Template Parameters
GTGraph type
SAArc filter (default: show all arcs)
size_t cut = ks.fast(g, S, T, cut_arcs); // O(n² log³ n)
Karger's randomized minimum cut algorithm.
Definition Karger.H:165
size_t fast(GT &g, DynList< typename GT::Node * > &vs, DynList< typename GT::Node * > &vt, DynList< typename GT::Arc * > &cut, size_t num_iter=0)
Compute minimum cut using Karger-Stein fast algorithm.
Definition Karger.H:639
std::decay_t< typename HeadC::Item_Type > T
Definition ah-zip.H:152

Definition at line 105 of file Karger_Stein.H.

◆ Ldouble

typedef Field<long double> Aleph::Ldouble

Definition at line 144 of file ahField.H.

◆ Link_Cut_Tree

Convenience alias for a connectivity-only Link-Cut Tree.

Uses the DefaultMonoid and NoLazyTag, meaning it only stores an int per vertex and is typically used just for structural operations (link, cut, connected, lca).

Definition at line 1143 of file tpl_link_cut_tree.H.

◆ Link_Cut_Tree_WithEdges

template<typename EdgeT = int, class Monoid = DefaultMonoid<EdgeT>>
using Aleph::Link_Cut_Tree_WithEdges = typedef Gen_Link_Cut_Tree_WithEdges<int, EdgeT, Monoid>

Convenience alias for edge-weighted Link-Cut Tree.

Definition at line 581 of file tpl_link_cut_tree_with_edges.H.

◆ ModularMatrix

using Aleph::ModularMatrix = typedef Modular_Matrix<Array<Array<uint64_t> >>

Alias for common Array-based modular matrix.

Recommended for dense matrices where O(1) access is prioritized over memory efficiency for zeros.

Definition at line 393 of file modular_linalg.H.

◆ ModularSparseMatrix

Alias for sparse DynMatrix-based modular matrix.

Recommended for large sparse matrices where unwritten entries (zeros) should not consume memory.

Definition at line 400 of file modular_linalg.H.

◆ mpsc_queue

template<typename T >
using Aleph::mpsc_queue = typedef MpscQueue<T>

Alias for Aleph::MpscQueue.

Template Parameters
TValue type stored in the queue.
Note
Inherits the same lock-free, multi-producer/single-consumer semantics as MpscQueue<T>.

Definition at line 354 of file tpl_mpsc_queue.H.

◆ MultiPolynomial

Multivariate polynomial with double coefficients, grevlex.

Definition at line 4597 of file tpl_multi_polynomial.H.

◆ MultiPolynomial_Grlex

Multivariate polynomial with grlex ordering.

Definition at line 4603 of file tpl_multi_polynomial.H.

◆ MultiPolynomial_Lex

Multivariate polynomial with lex ordering.

Definition at line 4600 of file tpl_multi_polynomial.H.

◆ Net_Cost_Node

template<typename Node_Info = Empty_Class>
using Aleph::Net_Cost_Node = typedef Net_Node<Node_Info>

Node type alias for cost networks.

Uses the same node type as regular flow networks.

Template Parameters
Node_InfoType of information stored in the node.

Definition at line 74 of file tpl_netcost.H.

◆ Net_Iterator

template<class Net , class Show_Arc = Dft_Show_Arc<Net>>
using Aleph::Net_Iterator = typedef Filter_Iterator<typename Net::Node *, __Net_Iterator<Net>, Show_Arc>

Residual-graph iterator adapter for flow networks.

Definition at line 273 of file tpl_net.H.

◆ Net_Node

template<typename Node_Info = Empty_Class>
using Aleph::Net_Node = typedef Graph_Anode<Node_Info>

Node type for flow networks.

Definition at line 290 of file tpl_net.H.

◆ Nodo

using Aleph::Nodo = typedef Graph_Node<Info_Nodo>

Node type for the digraph.

Definition at line 96 of file load_digraph.H.

◆ Packed_Matrix_Of

template<packed_matrix_detail::Column_Array auto Columns>
using Aleph::Packed_Matrix_Of = typedef typename packed_matrix_detail::Columns_At<Columns, std::make_index_sequence<Columns.size()> >::Matrix

Packed_Matrix whose columns are the entries of an array.

The same type as Packed_Matrix<Columns[0], Columns[1], ...>; see Packed_Row_Of for the array. A whole row of many columns is best written on a copy, column by column:

Wide m(1000);
Wide::Row r{}; // every column at its lowest value
for (size_t j = 0; j < Wide::cols(); ++j)
r(j) = value_of(j);
m(7) = r;
typename packed_matrix_detail::Columns_At< Columns, std::make_index_sequence< Columns.size()> >::Matrix Packed_Matrix_Of
Packed_Matrix whose columns are the entries of an array.
FooMap m(5, fst_unit_pair_hash, snd_unit_pair_hash)
Gsl_Compatible_Rng r
Template Parameters
ColumnsA std::array<Bit_Column, N>, with N from 1 to 65535, given by any constant expression.
See also
Packed_Matrix
Packed_Row_Of

Definition at line 1295 of file tpl_packed_matrix.H.

◆ Packed_Row_Of

template<packed_matrix_detail::Column_Array auto Columns>
using Aleph::Packed_Row_Of = typedef typename packed_matrix_detail::Columns_At<Columns, std::make_index_sequence<Columns.size()> >::Row

Packed_Row whose columns are the entries of an array.

The same type as Packed_Row<Columns[0], Columns[1], ...>. A row of many columns is easier to describe with code than with one template argument per column:

constexpr auto columns = [] {
std::array<Bit_Column, 300> c{};
for (size_t j = 0; j < c.size(); ++j)
c[j] = j % 3 == 0 ? bits(1) : j % 3 == 1 ? bits(8) : signed_bits(11);
return c;
}();
using Row = Packed_Row_Of<columns>; // 300 columns
constexpr Bit_Column bits(const unsigned n)
Column of n bits without sign: the integers of [0, 2^n - 1].
constexpr Bit_Column signed_bits(const unsigned n)
Column of n bits with sign: the integers of [-2^(n-1), 2^(n-1) - 1].

Two arrays with the same columns give the same type, whatever their names. A few columns can be written in place: Packed_Row_Of<std::array{bits(1), bits(8), signed_bits(11)}>.

Template Parameters
ColumnsA std::array<Bit_Column, N>, with N from 1 to 65535, given by any constant expression. A C array decays to a pointer, which is refused: pass std::to_array(columns).
See also
Packed_Row
Packed_Matrix_Of

Definition at line 1268 of file tpl_packed_matrix.H.

◆ pair

template<typename First , typename Second >
using Aleph::pair = typedef std::pair<First, Second>

Alias to std::pair kept for backwards compatibility.

Aleph historically provided its own pair type prior to C++11. Modern compilers already ship a standards-compliant implementation in <utility>, so this header simply re-exports that type within the Aleph namespace to avoid code churn in legacy headers.

All constructors, assignment operators and comparison operators behave exactly like the ones provided by std::pair.

Template Parameters
FirstFirst element type.
SecondSecond element type.

Definition at line 89 of file ahPair.H.

◆ Parc

template<class Net >
using Aleph::Parc = typedef std::tuple<typename Net::Arc *, bool>

Arc entry for a semi-path.

Second field is true for a forward arc, false for a residual arc.

Definition at line 1188 of file tpl_net.H.

◆ Polynomial

using Aleph::Polynomial = typedef Gen_Polynomial<double>

Polynomial with double coefficients.

Definition at line 2931 of file tpl_polynomial.H.

◆ PolynomialF

using Aleph::PolynomialF = typedef Gen_Polynomial<float>

Polynomial with float coefficients.

Definition at line 2934 of file tpl_polynomial.H.

◆ PolynomialLD

using Aleph::PolynomialLD = typedef Gen_Polynomial<long double>

Polynomial with long double coefficients.

Definition at line 2937 of file tpl_polynomial.H.

◆ Powerful_Array_Mo

template<typename T >
using Aleph::Powerful_Array_Mo = typedef Gen_Mo_Algorithm<T, Powerful_Array_Policy<T> >

Mo's algorithm specialised for the "powerful array" query.

Template Parameters
TArithmetic element type.

Definition at line 590 of file tpl_mo_algorithm.H.

◆ PP_Res_Net

template<class Net >
using Aleph::PP_Res_Net = typedef Array_Digraph<PP_Res_Node<Net>, __Res_Arc<Net> >

Residual network for preflow-push algorithms.

Definition at line 2148 of file tpl_net.H.

◆ Range_Mode_Mo

template<typename T >
using Aleph::Range_Mode_Mo = typedef Gen_Mo_Algorithm<T, Range_Mode_Policy<T> >

Mo's algorithm specialised for range mode queries.

Template Parameters
TElement type (must be hashable).

Definition at line 597 of file tpl_mo_algorithm.H.

◆ Reroot_DP

template<class GT , typename T , class SA = Dft_Show_Arc<GT>>
using Aleph::Reroot_DP = typedef Gen_Reroot_DP<GT, T, SA>

Convenient alias for Gen_Reroot_DP.

Template Parameters
GTGraph type.
TValue type.
SAArc filter.

Definition at line 718 of file Tree_DP.H.

◆ Residual_Net

template<typename Ftype >
using Aleph::Residual_Net = typedef Net_Cost_Graph<Net_Node<Empty_Class>, Res_Arc<Ftype> >

Residual network type alias.

Template Parameters
FtypeFlow/cost numeric type.

Definition at line 560 of file tpl_netcost.H.

◆ RStarTree

template<typename Payload , size_t MaxEntries = 16, size_t MinEntries = MaxEntries / 2>
using Aleph::RStarTree = typedef RTree<Payload, MaxEntries, MinEntries, RTreeVariant::RStar>

Dynamic R*-tree spatial index (R-tree with the R*-tree heuristics).

Template Parameters
PayloadValue associated with each stored bounding box.
MaxEntriesMaximum number of entries per node (>= 2).
MinEntriesMinimum number of entries per non-root node. Defaults to MaxEntries / 2; must satisfy 2 * MinEntries <= MaxEntries + 1.

Definition at line 82 of file tpl_r_star_tree.H.

◆ rw_synchronized

template<typename T , typename SharedMutex = std::shared_mutex>
using Aleph::rw_synchronized = typedef RwSynchronized<T, SharedMutex>

Alias for Aleph::RwSynchronized.

Template Parameters
TProtected value type.
SharedMutexShared mutex type guarding the value.
Note
Inherits the same reader/writer concurrency and callback lifetime rules as RwSynchronized<T, SharedMutex>.

Definition at line 1470 of file concurrency_utils.H.

◆ SearchClock

using Aleph::SearchClock = typedef std::chrono::steady_clock

Monotonic clock used for search timings.

Definition at line 105 of file state_search_common.H.

◆ SearchPath

template<SearchMove Move>
using Aleph::SearchPath = typedef Array<Move>

Default Aleph container used to store a move path.

Definition at line 103 of file state_search_common.H.

◆ SearchStorageMap

template<typename Key , typename Data , template< typename, typename, class > class HashMapTable = MapOLhash, class Cmp = Aleph::equal_to<Key>>
using Aleph::SearchStorageMap = typedef DynHashMap<Key, Data, HashMapTable, Cmp>

Aleph hash map alias for memoization/transposition storage.

Template Parameters
KeyCache key type.
DataStored value type.
HashMapTableAleph hash-table backend.
CmpEquality comparator for keys.

Definition at line 123 of file state_search_common.H.

◆ SearchStorageSet

template<typename Key , template< typename, class > class HashSetTable = OLhashTable, class Cmp = Aleph::equal_to<Key>>
using Aleph::SearchStorageSet = typedef DynHashSet<Key, HashSetTable, Cmp>

Aleph hash set alias for visited-state storage.

Template Parameters
KeyKey type to store in the set.
HashSetTableAleph hash-table backend.
CmpEquality comparator for keys.

Definition at line 134 of file state_search_common.H.

◆ SemiPath

template<class Net >
using Aleph::SemiPath = typedef std::tuple<bool, typename Net::Flow_Type, DynList<Parc<Net> >>

Semi-path tuple:

  • bool: whether a path was found
  • Flow_Type: slack value of the path
  • DynList<Parc<Net>>: arc list with direction flags

Definition at line 1198 of file tpl_net.H.

◆ SetODhash

template<typename Key , class Cmp = Aleph::equal_to<Key>>
using Aleph::SetODhash = typedef ODhashTable<Key, Cmp>

Definition at line 1233 of file tpl_odhash.H.

◆ SetOLhash

template<typename Key , class Cmp = Aleph::equal_to<Key>>
using Aleph::SetOLhash = typedef OLhashTable<Key, Cmp>

Definition at line 781 of file tpl_olhash.H.

◆ Short

typedef Field<short> Aleph::Short

Definition at line 138 of file ahField.H.

◆ size_type

using Aleph::size_type = typedef size_t

Definition at line 55 of file ahAlgo.H.

◆ Source_File_Id

using Aleph::Source_File_Id = typedef size_t

Definition at line 61 of file ah-source.H.

◆ Source_Offset

using Aleph::Source_Offset = typedef size_t

Definition at line 62 of file ah-source.H.

◆ spsc_queue

template<typename T >
using Aleph::spsc_queue = typedef SpscQueue<T>

Alias for Aleph::SpscQueue.

Template Parameters
TValue type stored in the queue.
Note
Inherits the same non-blocking single-producer/single-consumer semantics as SpscQueue<T>.

Definition at line 1478 of file concurrency_utils.H.

◆ Symbol_Map

using Aleph::Symbol_Map = typedef DynMapTree<std::string, Huffman_Node *, Treap_Vtl>

Definition at line 60 of file Huffman.H.

◆ synchronized

template<typename T , typename Mutex = std::mutex>
using Aleph::synchronized = typedef Synchronized<T, Mutex>

Alias for Aleph::Synchronized.

Template Parameters
TProtected value type.
MutexMutex type guarding the value.
Note
Inherits the same thread-safety and callback lifetime rules as Synchronized<T, Mutex>.

Definition at line 1461 of file concurrency_utils.H.

◆ T

typedef std::decay_t< typename HeadC::Item_Type > Aleph::T
Initial value:
{
Read-only view of an Aleph iterator: the iterator of a constant container.

Definition at line 152 of file ah-zip.H.

◆ to_index_tuple

template<typename... Types>
using Aleph::to_index_tuple = typedef typename make_index_tuple<sizeof...(Types)>::type

Convenience alias to generate an index tuple from a parameter pack.

Template Parameters
TypesThe types whose count determines the index sequence length.

Definition at line 292 of file ah-stl-utils.H.

◆ Tree_DP

template<class GT , typename T , class SA = Dft_Show_Arc<GT>>
using Aleph::Tree_DP = typedef Gen_Tree_DP<GT, T, SA>

Convenient alias for Gen_Tree_DP.

Template Parameters
GTGraph type.
TValue type.
SAArc filter.

Definition at line 505 of file Tree_DP.H.

◆ Tuple_Type

using Aleph::Tuple_Type = typedef decltype(std::tuple_cat(std::declval<std::tuple<T> >(), std::declval<typename ZipIterator<TailC...>::Tuple_Type>()))

The tuple type returned by get_curr() and get_curr_ne()

Definition at line 156 of file ah-zip.H.

Enumeration Type Documentation

◆ AdversarialTraceEventKind

Trace event kinds emitted by adversarial search engines.

Enumerator
Enter_Node 

One search node has just been entered.

Exit_Node 

One search node finished with an exact local result.

Terminal_Node 

A terminal state was evaluated.

Depth_Cutoff 

Search stopped at the configured horizon.

Domain_Prune 

Domain-side pruning hook discarded the state.

Expansion_Limit 

Search stopped because the expansion limit was hit.

Alpha_Beta_Cutoff 

One Alpha-Beta fail-high cutoff occurred.

Transposition_Hit 

One cached transposition entry was reused.

Iteration_Begin 

One iterative-deepening iteration started.

Iteration_End 

One iterative-deepening iteration completed.

Aspiration_Retry 

An aspiration window failed and was widened.

Definition at line 208 of file Negamax.H.

◆ Bipartite_Color

Enumerator
Bp_White 
Bp_Red 
Bp_Blue 

Definition at line 63 of file tpl_bipartite.H.

◆ Compiler_Associativity

enum class Aleph::Compiler_Associativity
strong

Associativity metadata for binary operators.

Determines how operators of the same precedence are grouped (e.g., a - b - c).

Note
Thread-safety: Thread-safe (POD).
Complexity: O(1).
Enumerator
None 

The operator is not associative (e.g., chained comparators prohibited).

Left 

Left-associative: (a - b) - c.

Right 

Right-associative: a = (b = c).

Definition at line 53 of file Compiler_Token.H.

◆ Compiler_Builtin_Type

enum class Aleph::Compiler_Builtin_Type
strong

Built-in scalar types available in the MVP type graph.

Enumerator
Invalid 
Unit 
Bool 
Integer 
String 
Character 

Definition at line 78 of file Compiler_Types.H.

◆ Compiler_Bytecode_Completion_Kind

Final status produced by one VM execution request.

Enumerator
Returned 

Execution finished with an explicit Return.

Halted 

Execution reached Halt and therefore produced Unit.

Runtime_Error 

Execution failed with a structured runtime error.

Definition at line 81 of file Bytecode_Interpreter.H.

◆ Compiler_Bytecode_Constant_Kind

Constant kinds supported by the bytecode constant pool.

Enumerator
Unit 

unit

Boolean 

true or false

Integer 

Signed integer literal.

String 

String literal payload.

Character 

Character literal payload.

Raw_Text 

Fallback textual payload when the literal cannot be classified better.

Definition at line 90 of file Bytecode.H.

◆ Compiler_Bytecode_Opcode

VM opcodes supported by the bytecode MVP.

Enumerator
Load_Constant 

dst <- constant_pool[id]

Load_Local 

dst <- locals[slot]

Store_Local 

locals[slot] <- src

Load_Global 

dst <- globals[slot]

Store_Global 

globals[slot] <- src

Load_Function 

dst <- function_ref[id]

Unary 

dst <- op(src)

Binary 

dst <- op(lhs, rhs)

Call 

dst <- callee(args...)

Jump 

pc <- target

Branch 

pc <- condition ? true_target : false_target

Return 

Return one register value.

Halt 

Canonical exit instruction.

Trap 

Unreachable code path marker.

Definition at line 101 of file Bytecode.H.

◆ Compiler_Bytecode_Value_Kind

Runtime categories that can live inside bytecode registers/slots.

Bytecode execution needs one extra case that Interpreter_Value does not model: references to bytecode functions addressed by function_id. Those references are not interchangeable with HIR callables, so the VM wraps both concepts in a distinct tagged value.

Enumerator
Invalid 

Uninitialized register/slot or explicit invalid placeholder.

Value 

Regular runtime payload stored as Interpreter_Value.

Function_Ref 

Reference to one bytecode function in the current module.

Definition at line 73 of file Bytecode_Interpreter.H.

◆ Compiler_CFG_Terminator_Kind

Categories of basic block terminators.

Every basic block must end with exactly one terminator that defines how control flow proceeds to successors.

Enumerator
None 

Unset or invalid terminator.

Jump 

Unconditional jump to exactly one successor.

Branch 

Conditional branch to two successors (true and false targets).

Return 

Function exit with an optional return value.

Exit 

Sentinel terminator for the canonical exit block.

Unreachable 

Marks code paths that should never be executed (e.g., after a break).

Definition at line 87 of file Compiler_CFG.H.

◆ Compiler_Dataflow_Constant_Kind

Constant-lattice states used by local constant propagation.

Enumerator
Unknown 

A value exists but is not known to be constant.

Undefined 

A slot has not been definitely initialized yet.

Integer 

Integer constant.

Boolean 

Boolean constant.

Unit 

Unit constant.

Definition at line 135 of file Compiler_Dataflow.H.

◆ Compiler_Driver_Action

enum class Aleph::Compiler_Driver_Action
strong

High-level actions supported by compiler pipeline drivers.

Enumerator
Parse_Only 

Stop after parsing and publish AST/frontend artifacts.

Sema_Only 

Stop after semantic analysis.

HIR 

Stop after lowering to typed HIR.

IR 

Stop after lowering to explicit IR.

Run 

Execute the lowered HIR module with Interpreter_Runtime.

Emit_C 

Lower to IR and emit portable C.

Emit_Bytecode 

Lower to IR and emit reusable bytecode.

Definition at line 55 of file Compiler_Driver_Contracts.H.

◆ Compiler_Expr_Kind

enum class Aleph::Compiler_Expr_Kind
strong

Enumeration of expression node kinds.

Distinguishes between different types of expressions in the AST for runtime type identification and dispatch.

Note
Thread-safety: Thread-safe (POD).
Complexity: O(1).
Enumerator
Invalid 

Placeholder for malformed expressions.

Identifier 

Variable or function name reference.

Integer_Literal 

Numeric integer constant.

String_Literal 

String constant.

Char_Literal 

Character constant.

Bool_Literal 

Boolean constant (true/false).

Grouping 

Parenthesized expression.

Unary 

Prefix unary operation (e.g., -x, !p).

Binary 

Infix binary operation (e.g., x + y).

Call 

Function or method call.

Definition at line 104 of file Compiler_AST.H.

◆ Compiler_HIR_Constant_Kind

Kinds of HIR constants.

Enumerator
Integer 
String 
Character 
Bool 
Unit 

Definition at line 98 of file Compiler_HIR_Model.H.

◆ Compiler_HIR_Expr_Kind

enum class Aleph::Compiler_HIR_Expr_Kind
strong

Kinds of HIR expressions.

Enumerator
Invalid 
Constant 
Variable 
Unary 
Binary 
Call 

Definition at line 73 of file Compiler_HIR_Model.H.

◆ Compiler_HIR_Stmt_Kind

enum class Aleph::Compiler_HIR_Stmt_Kind
strong

Kinds of HIR statements.

Enumerator
Invalid 
Eval 
Let 
Return 
Block 
If 
While 
Break 
Continue 

Definition at line 84 of file Compiler_HIR_Model.H.

◆ Compiler_Import_Decl_Kind

Enumeration of top-level import declaration node kinds.

Imports are intentionally small in the current MVP: they name one other source unit through a string literal such as import "math.aw";.

Note
Thread-safety: Thread-safe (POD).
Complexity: O(1).
Enumerator
Invalid 

Placeholder for malformed import declarations.

Import 

One concrete import "name"; declaration.

Definition at line 179 of file Compiler_AST.H.

◆ Compiler_Integer_Status

enum class Aleph::Compiler_Integer_Status
strong

Outcome of one integer operation of the language.

Enumerator
Ok 

The result is in value.

Overflow 

The result does not fit in a signed 64-bit integer.

Division_By_Zero 

/ with a zero divisor.

Modulo_By_Zero 

% with a zero divisor.

Definition at line 316 of file Compiler_Operator.H.

◆ Compiler_IR_Instruction_Kind

Instruction kinds supported by the MVP IR.

Enumerator
Constant 
Load 
Store 
Unary 
Binary 
Call 
Function_Ref 

Definition at line 86 of file Compiler_IR_Model.H.

◆ Compiler_IR_Slot_Kind

enum class Aleph::Compiler_IR_Slot_Kind
strong

Storage-space classification for slots.

Enumerator
Parameter 
Local 
Global 

Definition at line 78 of file Compiler_IR_Model.H.

◆ Compiler_IR_Terminator_Kind

Terminator kinds supported by the MVP IR.

Enumerator
None 
Jump 
Branch 
Return 
Exit 
Unreachable 

Definition at line 98 of file Compiler_IR_Model.H.

◆ Compiler_Module_Binding_Issue_Kind

Structural issues emitted while binding linked module surfaces.

Enumerator
Missing_Metadata 
Ambiguous_Value_Name 
Ambiguous_Type_Name 

Definition at line 74 of file Compiler_Module_Binder.H.

◆ Compiler_Module_Export_Kind

Export kinds currently modeled by reusable module metadata.

Enumerator
Function 
Global 
Type 

Definition at line 52 of file Compiler_Module_Metadata.H.

◆ Compiler_Module_Linkage_Issue_Kind

Structural issues emitted while linking module surfaces.

Enumerator
Missing_Metadata 
Duplicate_Value_Export 
Duplicate_Type_Export 

Definition at line 75 of file Compiler_Module_Linker.H.

◆ Compiler_Module_Name_Filter

Query filters supported by reusable module-name resolution.

Enumerator
Any 
Value 
Function 
Global 
Type 

Definition at line 53 of file Compiler_Module_Name_Resolver.H.

◆ Compiler_Module_Name_Resolution_Status

Result status for one module-name query.

Enumerator
Resolved 
Missing_Module 
Missing_Name 
Wrong_Kind 
Ambiguous_Name 

Definition at line 63 of file Compiler_Module_Name_Resolver.H.

◆ Compiler_Module_Resolution_Issue_Kind

Structural issue kinds produced by module dependency resolution.

Enumerator
Missing_Dependency 
Cyclic_Dependency 

Definition at line 67 of file Compiler_Module_Resolver.H.

◆ Compiler_Operator_Kind

enum class Aleph::Compiler_Operator_Kind
strong

Stable operator kinds shared by reusable compiler layers.

Enumerator
Invalid 
Assign 
Plus 
Minus 
Star 
Slash 
Percent 
EqEq 
NotEq 
Less 
LessEq 
Greater 
GreaterEq 
AndAnd 
OrOr 
Bang 
Amp 
Pipe 
Caret 
Tilde 
PlusEq 
MinusEq 
StarEq 
SlashEq 
PercentEq 
PlusPlus 
MinusMinus 

Definition at line 52 of file Compiler_Operator.H.

◆ Compiler_SSA_Instruction_Kind

Instruction kinds supported by the SSA form.

Enumerator
Constant 
Load_Global 
Store_Global 
Unary 
Binary 
Call 
Function_Ref 

Definition at line 79 of file SSA.H.

◆ Compiler_Stmt_Kind

enum class Aleph::Compiler_Stmt_Kind
strong

Enumeration of statement node kinds.

Identifies the type of a statement for structured control flow analysis and execution.

Note
Thread-safety: Thread-safe (POD).
Complexity: O(1).
Enumerator
Invalid 

Placeholder for malformed statements.

Expr 

Expression evaluated for side effects (e.g., assignment, call).

Let 

Variable declaration and optional initialization.

Return 

Exit current function with an optional value.

Block 

Scoped sequence of statements.

If 

Conditional execution.

While 

Loop while a condition is true.

Break 

Immediate exit from the innermost loop.

Continue 

Skip to the next iteration of the innermost loop.

Definition at line 126 of file Compiler_AST.H.

◆ Compiler_Symbol_Declare_Status

Result status for one declaration attempt.

Enumerator
Inserted 
Duplicate_Local 
Inserted_Shadowing 

Definition at line 95 of file Compiler_Symbol_Bindings.H.

◆ Compiler_Symbol_Kind

enum class Aleph::Compiler_Symbol_Kind
strong

Generic symbol kinds reusable across multiple frontends.

Enumerator
Function 
Parameter 
Local 
Global 
Type 

Definition at line 55 of file Compiler_Symbol_Bindings.H.

◆ Compiler_Token_Kind

enum class Aleph::Compiler_Token_Kind
strong

Token kinds supported by the compiler MVP.

Includes keywords, literals, operators, and punctuation. Keywords have their own enumerators to avoid string comparisons in the parser.

Note
Thread-safety: Thread-safe (POD).
Complexity: O(1).
Enumerator
Invalid 

Sentinel for lexer errors or uninitialized tokens.

End_Of_File 

End of the source stream.

Identifier 

Named identifier (e.g., variable or function name).

Integer_Literal 

Integer constant.

String_Literal 

String constant (with escape sequences).

Char_Literal 

Single character constant.

Line_Comment 

Single-line comment (// ...).

Block_Comment 

Multi-line comment (/* ... *&zwj;/).

Kw_If 
Kw_Else 
Kw_While 
Kw_For 
Kw_Return 
Kw_Break 
Kw_Continue 
Kw_Func 
Kw_Fn 
Kw_Var 
Kw_Let 
Kw_Const 
Kw_Type 
Kw_Struct 
Kw_Enum 
Kw_Class 
Kw_Import 
Kw_Export 
Kw_Namespace 
Kw_Try 
Kw_Catch 
Kw_Throw 
Kw_True 
Kw_False 
LParen 
RParen 
LBrace 
RBrace 
LBracket 
RBracket 
Comma 
Semicolon 
Colon 
Dot 
Arrow 
Double_Colon 
Question 
Assign 
Plus 
Minus 
Star 
Slash 
Percent 
EqEq 
NotEq 
Less 
LessEq 
Greater 
GreaterEq 
AndAnd 
OrOr 
Bang 
Amp 
Pipe 
Caret 
Tilde 
PlusEq 
MinusEq 
StarEq 
SlashEq 
PercentEq 
PlusPlus 
MinusMinus 

Definition at line 68 of file Compiler_Token.H.

◆ Compiler_Type_Decl_Kind

enum class Aleph::Compiler_Type_Decl_Kind
strong

Enumeration of top-level type declaration node kinds.

These declarations introduce named surface-level types such as aliases, nominal structs, and nominal enums.

Note
Thread-safety: Thread-safe (POD).
Complexity: O(1).
Enumerator
Invalid 

Placeholder for malformed type declarations.

Alias 

Transparent type alias declaration.

Struct 

Nominal struct declaration.

Enum 

Nominal enum declaration.

Definition at line 163 of file Compiler_AST.H.

◆ Compiler_Type_Expr_Kind

enum class Aleph::Compiler_Type_Expr_Kind
strong

Enumeration of parsed type-expression node kinds.

Type expressions represent explicit source-level annotations and are later resolved into Compiler_Types.H.

Note
Thread-safety: Thread-safe (POD).
Complexity: O(1).
Enumerator
Invalid 

Placeholder for malformed type syntax.

Named 

Named type such as Int or T.

Tuple 

Tuple type such as (Int, Bool).

Function 

Function type such as fn(Int) -> Bool.

Definition at line 147 of file Compiler_AST.H.

◆ Compiler_Type_Kind

enum class Aleph::Compiler_Type_Kind
strong

Category of one stored type node.

Enumerator
Builtin 
Tuple 
Function 
Struct 
Enum 
Type_Variable 

Definition at line 67 of file Compiler_Types.H.

◆ Compiler_Unify_Result_Kind

Result category returned by type unification.

Enumerator
Success 
Invalid_Type 
Kind_Mismatch 
Arity_Mismatch 
Occurs_Check_Failed 
Rigid_Variable 

Definition at line 146 of file tpl_constraints.H.

◆ ConstraintType

enum class Aleph::ConstraintType
strong

Constraint type for linear programming.

Specifies the type of inequality or equality for a constraint.

Enumerator
LE 
GE 
EQ 

Definition at line 85 of file Simplex.H.

◆ Diagnostic_Label_Kind

enum class Aleph::Diagnostic_Label_Kind
strong

Kind of source label attached to a diagnostic.

Enumerator
Primary 
Secondary 

Definition at line 68 of file ah-diagnostics.H.

◆ Diagnostic_Severity

enum class Aleph::Diagnostic_Severity
strong

Severity level of a diagnostic message.

Enumerator
Note 
Warning 
Error 
Fatal 

Definition at line 59 of file ah-diagnostics.H.

◆ Eulerian_Type

enum class Aleph::Eulerian_Type
strong

Enumeration for Eulerian graph classification.

Represents the three possible Eulerian states of a graph:

  • Cycle: Contains an Eulerian cycle (visits all edges exactly once, returns to start)
  • Path: Contains an Eulerian path but not a cycle (visits all edges exactly once)
  • None: Neither Eulerian cycle nor path exists
Enumerator
Cycle 

Graph has an Eulerian cycle.

Path 

Graph has an Eulerian path but not a cycle.

None 

Graph is not Eulerian.

Definition at line 113 of file eulerian.H.

◆ InCircleResult

enum class Aleph::InCircleResult
strong

Classification of a point with respect to a triangle circumcircle.

Enumerator
INSIDE 
ON_CIRCLE 
OUTSIDE 
DEGENERATE 

Definition at line 2913 of file point.H.

◆ Interpreter_Control_Flow_Kind

Structured control-flow outcomes during evaluation.

Enumerator
None 
Return 
Break 
Continue 
Runtime_Error 

Definition at line 95 of file Interpreter_Runtime.H.

◆ Interpreter_Value_Kind

enum class Aleph::Interpreter_Value_Kind
strong

Runtime categories supported by the interpreter MVP.

Enumerator
Invalid 
Unit 
Bool 
Integer 
String 
Character 
Tuple 
Function 
Host_Function 

Definition at line 81 of file Interpreter_Runtime.H.

◆ MoveOrderingMode

enum class Aleph::MoveOrderingMode
strong

Built-in move-ordering modes supported by the framework.

Enumerator
Domain 

Preserve the order emitted by for_each_successor().

Estimated_Score 

Rank successors by a cheap heuristic score estimate.

Estimated_Bound 

Rank successors by an optimistic child bound.

Definition at line 63 of file search_move_ordering.H.

◆ OptimizationSense

enum class Aleph::OptimizationSense
strong

Optimization direction supported by branch and bound.

Enumerator
Minimize 

Smaller objective values are better.

Maximize 

Larger objective values are better.

Definition at line 61 of file Branch_And_Bound.H.

◆ OptimizationType

enum class Aleph::OptimizationType
strong

Optimization direction for linear programming.

Specifies whether to maximize or minimize the objective function.

Enumerator
Maximize 
Minimize 

Definition at line 91 of file Simplex.H.

◆ Orientation

enum class Aleph::Orientation
strong

Classification of three-point orientation.

Enumerator
CCW 
CW 
COLLINEAR 

Definition at line 2893 of file point.H.

◆ Paged_File_Open_Mode

enum class Aleph::Paged_File_Open_Mode : std::uint8_t
strong

Open mode for paged persistent tree files.

Read_Write opens the backing file for mutations and durable commits. Read_Only opens an existing clean file for read-only access under a shared advisory lock.

Enumerator
Read_Write 
Read_Only 

Definition at line 75 of file tpl_paged_tree_durability.H.

◆ RTreeVariant

enum class Aleph::RTreeVariant
strong

Node-split / insertion strategy for RTree.

Guttman uses the original quadratic split. RStar uses the R*-tree heuristics (overlap-minimizing subtree choice, margin/overlap/area split and leaf-level forced reinsertion). See RStarTree in tpl_r_star_tree.H.

Enumerator
Guttman 
RStar 

Definition at line 99 of file tpl_r_tree.H.

◆ SearchStatus

enum class Aleph::SearchStatus
strong

Final state of a search execution.

Enumerator
NotStarted 

Search object exists but no traversal has run yet.

Exhausted 

Search space within the configured bounds was exhausted.

StoppedOnSolution 

Search stopped because solution handling requested it.

LimitReached 

Search stopped because an external hard limit was hit.

Definition at line 73 of file state_search_common.H.

◆ Simplex_Arc_State

enum class Aleph::Simplex_Arc_State : unsigned char
strong

Arc state in Network Simplex.

Indicates whether an arc is in the basis (tree) and its bound state.

Enumerator
Lower 

Non-basic arc at lower bound (flow = 0).

Upper 

Non-basic arc at upper bound (flow = cap).

Tree 

Basic arc (in spanning tree).

Definition at line 1170 of file tpl_netcost.H.

◆ ThreeWayCmp

enum Aleph::ThreeWayCmp : int

Constants for three-way comparison results.

Enumerator
CmpLess 

First argument is less than second.

CmpEqual 

Arguments are equal.

CmpGreater 

First argument is greater than second.

Definition at line 1711 of file tpl_binNodeUtils.H.

◆ TokenType

enum class Aleph::TokenType
strong

Enumeration of basic token types.

Enumerator
END_OF_FILE 

End of input.

IDENTIFIER 

Variable/function name.

INTEGER 

Integer literal.

FLOAT 

Floating-point literal.

STRING 

String literal.

CHAR 

Character literal.

OPERATOR 

Operator (+, -, etc.)

PUNCTUATION 

Punctuation (;, {, }, etc.)

KEYWORD 

Reserved keyword.

COMMENT 

Comment (if preserving)

UNKNOWN 

Unknown/invalid token.

Definition at line 1500 of file parse_utils.H.

◆ TranspositionBound

enum class Aleph::TranspositionBound
strong

Stored bound classification for memoized search entries.

Enumerator
Exact 

Exact value for the stored search configuration.

Lower_Bound 

Value is a lower bound (fail-high style).

Upper_Bound 

Value is an upper bound (fail-low style).

Definition at line 59 of file Transposition_Table.H.

◆ TranspositionStoreStatus

Outcome of one store/update attempt in a transposition table.

Enumerator
Inserted 

A new key was inserted.

Replaced 

An existing key was updated according to replacement policy.

Rejected 

Existing entry was kept and candidate was discarded.

Definition at line 67 of file Transposition_Table.H.

Function Documentation

◆ __compute_cut_nodes()

template<AlephGraph GT>
static void Aleph::__compute_cut_nodes ( const GT &  g,
DynList< typename GT::Node * > &  list,
Dfs_Stack< graph_utils_detail::Cut_Frame< GT > > &  frames,
typename GT::Node *  p,
typename GT::Arc *  a,
long &  curr_df 
)
inlinestatic

Internal DFS step used by compute_cut_nodes().

Internal step for compute_cut_nodes(): the search from p.

Visits p, reached through a, and what it reaches, and appends to list the cut nodes among them. A path can have as many nodes as the graph, too many for recursion, so that the search keeps its frames in frames; the order of the visits is that of a recursion.

Definition at line 1774 of file tpl_graph_utils.H.

References and, Aleph::DynList< T >::append(), Cut, low(), Aleph::graph_utils_detail::next_cut_child(), NODE_BITS, and Aleph::graph_utils_detail::visit_cut().

Referenced by compute_cut_nodes().

◆ __depth_first_traversal()

template<AlephGraph GT>
static bool Aleph::__depth_first_traversal ( const GT &  g,
typename GT::Node *  node,
typename GT::Arc *  arc,
bool(*)(const GT &g, typename GT::Node *, typename GT::Arc *)  visit,
size_t &  count 
)
inlinestatic

Internal DFS used by depth_first_traversal().

Template Parameters
GTGraph type.
Parameters
[in]gGraph being traversed.
[in]nodeCurrent node.
[in]arcArc used to discover node (nullptr for the root call).
[in]visitOptional callback invoked when a node is discovered.
[in,out]countNumber of discovered nodes so far.
Returns
true if the traversal must stop early; false otherwise.
Note
Uses the Depth_First control bit on both nodes and arcs.
A path can have as many nodes as the graph, too many for recursion, so that the search keeps its own stack; the order of the visits is that of a recursion.

Definition at line 309 of file tpl_graph_utils.H.

References count(), Depth_First, GraphCommon< GT, Node, Arc >::get_arc_it(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::Dfs_Stack< T >::is_empty(), IS_NODE_VISITED, NODE_BITS, Aleph::Dfs_Stack< T >::pop(), Aleph::Dfs_Stack< T >::push(), and Aleph::Dfs_Stack< T >::top().

Referenced by depth_first_traversal().

◆ __deway_search()

template<class Node >
static Node * Aleph::__deway_search ( Node *  node,
int  path[],
const int &  idx,
const size_t &  size 
)
inlinestatic

Definition at line 1548 of file tpl_tree_node.H.

References ah_out_of_range_error_if, and, and size().

Referenced by deway_search().

◆ __dfp_phase1()

template<AlephGraph GT>
static void Aleph::__dfp_phase1 ( const GT &  g,
typename GT::Node *  p,
DynArray< typename GT::Node * > &  df 
)
inlinestatic

◆ __dfp_phase2_list()

template<AlephGraph GT>
static void Aleph::__dfp_phase2_list ( const GT &  g,
typename GT::Node *  p,
DynList< typename GT::Node * > &  list 
)
inlinestatic

DFS on transposed graph that builds an SCC node list (Phase 2).

Traverses the transposed graph starting from node p, appending all reachable nodes (mapped back to original graph) to the list.

This is the second phase of Kosaraju's algorithm (lightweight version).

Template Parameters
GTGraph type.
Parameters
[in]gThe transposed directed graph.
[in]pStarting node for the DFS.
[out]listList where nodes of this SCC are appended.

Definition at line 217 of file kosaraju.H.

References Aleph::DynList< T >::append(), and Aleph::kosaraju_detail::search().

Referenced by kosaraju_connected_components().

◆ __dfp_phase2_subgraph()

template<AlephGraph GT>
static void Aleph::__dfp_phase2_subgraph ( const GT &  g,
typename GT::Node *  p,
GT &  blk,
const int &  color 
)
inlinestatic

DFS on transposed graph that builds an SCC subgraph (Phase 2).

Traverses the transposed graph starting from node p, inserting all reachable nodes into the block subgraph. Each node in the block is assigned the same color (component ID) and mapped to the original graph.

This is the second phase of Kosaraju's algorithm (subgraph version).

Template Parameters
GTGraph type.
Parameters
[in]gThe transposed directed graph.
[in]pStarting node for the DFS.
[out]blkSubgraph where nodes of this SCC are inserted.
[in]colorComponent ID assigned to all nodes in this SCC.

Definition at line 190 of file kosaraju.H.

References color(), GTNodeCommon< NodeInfo >::get_info(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), GraphCommon< GT, Node, Arc >::map_nodes(), NODE_COUNTER, and Aleph::kosaraju_detail::search().

Referenced by kosaraju_connected_components().

◆ __find_depth_first_spanning_tree()

◆ __find_path_depth_first()

template<class GT >
static bool Aleph::__find_path_depth_first ( const GT &  g,
typename GT::Node *  curr_node,
typename GT::Arc *  curr_arc,
typename GT::Node *  end_node,
Path< GT > &  path 
)
inlinestatic

◆ __generate_tree()

template<typename Node , class Write >
static void Aleph::__generate_tree ( Node *  node,
int  deway[],
const size_t &  current_level,
const size_t &  size,
std::ostream &  output 
)
static

Definition at line 107 of file generate_tree.H.

References ah_overflow_error_if, and, deway(), output, and size().

◆ __graph_to_tree_node()

template<AlephGraph GT, typename Key , typename Convert , ArcFilter< GT > SA>
static void Aleph::__graph_to_tree_node ( GT &  g,
typename GT::Node *  groot,
Tree_Node< Key > *  troot,
const SA &  sa 
)
inlinestatic

Definition at line 392 of file graph_to_tree.H.

◆ __is_graph_acyclique()

template<AlephGraph GT>
static bool Aleph::__is_graph_acyclique ( const GT &  g,
typename GT::Node *  curr_node 
)
inlinestatic

Internal DFS used by is_graph_acyclique().

A path can have as many nodes as the graph, too many for recursion, so that the search keeps its own stack; the order of the visits is that of a recursion.

Definition at line 840 of file tpl_graph_utils.H.

References GraphCommon< GT, Node, Arc >::get_arc_it(), Aleph::Dfs_Stack< T >::is_empty(), IS_NODE_VISITED, NODE_BITS, Aleph::Dfs_Stack< T >::pop(), Aleph::Dfs_Stack< T >::push(), Test_Cycle, and Aleph::Dfs_Stack< T >::top().

Referenced by is_graph_acyclique(), and is_graph_acyclique().

◆ __link_mergeinsertsort()

template<class Tlist , class Tlink , class Compare >
void Aleph::__link_mergeinsertsort ( Tlist &  list,
const size_t  n,
const Compare &  cmp,
const size_t  lsz 
)
inline

Definition at line 1427 of file tpl_sort_utils.H.

References cmp(), Aleph::DynList< T >::get_first_ne(), l, and r.

◆ __map_subgraph()

template<AlephGraph GT>
static void Aleph::__map_subgraph ( const GT &  g,
GT &  sg,
typename GT::Node *  gsrc,
const long  color 
)
inlinestatic

Internal step used by map_subgraph().

Copies into sg, from gsrc, whose image is in sg, the arcs of the given color not copied yet, with the nodes that they reach; the search goes on from the target of each arc that it copies. A path can have as many nodes as the graph, too many for recursion, so that the search keeps its own stack; the order of the visits is that of a recursion.

Definition at line 2066 of file tpl_graph_utils.H.

References ALEPH_FLATTEN, ARC_BITS, ARC_COOKIE, Build_Subtree, color(), GraphCommon< GT, Node, Arc >::get_arc_it(), GTNodeCommon< NodeInfo >::get_info(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), IS_ARC_VISITED, Aleph::Dfs_Stack< T >::is_empty(), IS_NODE_VISITED, GraphCommon< GT, Node, Arc >::map_arcs(), GraphCommon< GT, Node, Arc >::map_nodes(), NODE_BITS, NODE_COOKIE, Aleph::Dfs_Stack< T >::pop(), Aleph::Dfs_Stack< T >::push(), and Aleph::Dfs_Stack< T >::top().

Referenced by map_subgraph().

◆ __paint_from_cut_node()

template<AlephGraph GT>
static void Aleph::__paint_from_cut_node ( const GT &  g,
Dfs_Stack< graph_utils_detail::Paint_Frame< GT > > &  frames,
typename GT::Node *  p,
long &  current_color 
)
inlinestatic

Internal step that paints all blocks adjacent to a cut node.

Definition at line 1977 of file tpl_graph_utils.H.

References __paint_subgraph(), ARC_BITS, Cross_Arc, Cut, and GraphCommon< GT, Node, Arc >::get_arc_it().

Referenced by paint_subgraphs().

◆ __paint_subgraph()

template<AlephGraph GT>
static void Aleph::__paint_subgraph ( const GT &  g,
Dfs_Stack< graph_utils_detail::Paint_Frame< GT > > &  frames,
typename GT::Node *  p,
long  current_color 
)
inlinestatic

Internal DFS that paints a non-cut block with current_color.

A path can have as many nodes as the graph, too many for recursion, so that the search keeps its own stack; the order of the visits is that of a recursion.

Definition at line 1932 of file tpl_graph_utils.H.

Referenced by __paint_from_cut_node().

◆ __random_select() [1/3]

template<typename T , class Compare >
static const T & Aleph::__random_select ( Array< T > &  a,
const long  i,
long  l,
long  r,
const Compare &  cmp = Compare() 
)
inlinestatic

Definition at line 3214 of file tpl_sort_utils.H.

References and, cmp(), insertion_sort_range(), l, and r.

◆ __random_select() [2/3]

template<typename T , class Compare >
static const T & Aleph::__random_select ( DynArray< T > &  a,
const long  i,
long  l,
long  r,
const Compare &  cmp = Compare() 
)
inlinestatic

Definition at line 3186 of file tpl_sort_utils.H.

References and, cmp(), insertion_sort_range(), l, and r.

◆ __random_select() [3/3]

template<typename T , class Compare >
static const T & Aleph::__random_select ( T *  a,
const long  i,
long  l,
long  r,
const Compare &  cmp 
)
inlinestatic

Definition at line 2977 of file tpl_sort_utils.H.

References and, cmp(), l, and r.

◆ __remove_by_pos_xt()

template<RankedBinNodeLike Node>
static Node * Aleph::__remove_by_pos_xt ( Node *&  root,
size_t  pos 
)
inlinestaticnoexcept

Definition at line 986 of file tpl_binNodeXt.H.

References __remove_by_pos_xt(), COUNT(), join_exclusive_xt(), LLINK, RLINK, and root().

Referenced by __remove_by_pos_xt(), and remove_by_pos_xt().

◆ __search_deway()

template<class Node , class Equal >
static Node * Aleph::__search_deway ( Node *  root,
const typename Node::key_type &  key,
const size_t &  current_level,
int  deway[],
const size_t &  size,
size_t &  n 
)
inlinestatic

Definition at line 1640 of file tpl_tree_node.H.

References ah_overflow_error_if, and, deway(), root(), and size().

◆ __select_rec()

template<RankedBinNodeLike Node>
static Node * Aleph::__select_rec ( Node *  r,
const size_t  i 
)
inlinestaticnoexcept

Definition at line 92 of file tpl_binNodeXt.H.

References __select_rec(), COUNT(), LLINK, r, and RLINK.

Referenced by __select_rec(), and select_rec().

◆ __split_pos_rec()

template<RankedBinNodeLike Node>
static void Aleph::__split_pos_rec ( Node *  r,
size_t  i,
Node *&  ts,
Node *&  tg 
)
inlinestaticnoexcept

Definition at line 809 of file tpl_binNodeXt.H.

References __split_pos_rec(), COUNT(), LLINK, r, and RLINK.

Referenced by __split_pos_rec().

◆ __test_cycle()

template<AlephGraph GT>
static bool Aleph::__test_cycle ( const GT &  g,
typename GT::Node *  src,
typename GT::Node *  curr 
)
inlinestatic

◆ __test_for_path()

template<AlephGraph GT>
static bool Aleph::__test_for_path ( const GT &  g,
typename GT::Node *  curr_node,
typename GT::Node *  end_node 
)
inlinestatic

Internal DFS used by test_for_path().

A path can have as many nodes as the graph, too many for recursion, so that the search keeps its own stack; the order of the visits is that of a recursion.

Definition at line 1035 of file tpl_graph_utils.H.

References Find_Path, GraphCommon< GT, Node, Arc >::get_arc_it(), Aleph::Dfs_Stack< T >::is_empty(), IS_NODE_VISITED, NODE_BITS, Aleph::Dfs_Stack< T >::pop(), Aleph::Dfs_Stack< T >::push(), and Aleph::Dfs_Stack< T >::top().

Referenced by test_for_path().

◆ __tree_postorder_traversal()

template<class Node >
static void Aleph::__tree_postorder_traversal ( Node *  node,
const int &  level,
const int &  child_index,
void(*)(Node *, int, int)  visitFct 
)
inlinestatic

◆ __tree_preorder_traversal()

template<class Node >
static void Aleph::__tree_preorder_traversal ( Node *  root,
const int &  level,
const int &  child_index,
void(*)(Node *, int, int)  visitFct 
)
inlinestatic

◆ accumulate() [1/2]

template<class Itor , class T >
T Aleph::accumulate ( Itor  beg,
Itor  end,
T  initValue 
)
inline

Accumulate values in a range.

Computes the sum of initValue and all elements in [beg, end).

Template Parameters
ItorIterator type.
TAccumulator type.
Parameters
begIterator to the first element.
endIterator past the last element.
initValueInitial value for the accumulation.
Returns
The accumulated value.

Definition at line 1493 of file ahAlgo.H.

Referenced by demo_vector_dynarray(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST_P().

◆ accumulate() [2/2]

template<class Itor , class T , class BinaryFunc >
T Aleph::accumulate ( Itor  beg,
Itor  end,
T  initValue,
BinaryFunc  op 
)
inline

Accumulate values with custom operation.

Computes the generalized sum of initValue and all elements in [beg, end) using the binary operation op.

Template Parameters
ItorIterator type.
TAccumulator type.
BinaryFuncBinary operation type.
Parameters
begIterator to the first element.
endIterator past the last element.
initValueInitial value for the accumulation.
opBinary operation for combining values.
Returns
The accumulated value.

Definition at line 1518 of file ahAlgo.H.

◆ add_hash() [1/3]

size_t Aleph::add_hash ( const char *  key)
inlinenoexcept

Definition at line 647 of file hash-fct.H.

References h.

◆ add_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::add_hash ( const Key &  key)
inlinenoexcept

Definition at line 544 of file hash-fct.H.

References add_hash().

◆ add_hash() [3/3]

size_t Aleph::add_hash ( const std::string &  key)
inlinenoexcept

Definition at line 786 of file hash-fct.H.

References add_hash().

◆ adjacent_difference() [1/2]

template<class Itor1 , class Itor2 >
Itor2 Aleph::adjacent_difference ( Itor1  sourceBeg,
Itor1  sourceEnd,
Itor2  destBeg 
)
inline

Compute adjacent differences.

Computes differences between consecutive elements in [sourceBeg, sourceEnd) and writes them to the range starting at destBeg. The first element is copied unchanged.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
Returns
Iterator past the last computed element in destination.

Definition at line 1667 of file ahAlgo.H.

Referenced by TEST(), and TEST().

◆ adjacent_difference() [2/2]

template<class Itor1 , class Itor2 , class BinaryFunc >
Itor2 Aleph::adjacent_difference ( Itor1  sourceBeg,
Itor1  sourceEnd,
Itor2  destBeg,
BinaryFunc  op 
)
inline

Compute adjacent differences with custom operation.

Computes differences using the binary operation op.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
BinaryFuncBinary operation type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
opBinary operation for computing differences.
Returns
Iterator past the last computed element in destination.

Definition at line 1703 of file ahAlgo.H.

◆ adjacent_find()

template<class Itor , class BinaryPredicate = Aleph::equal_to<typename Itor::value_type>>
Itor Aleph::adjacent_find ( Itor  beg,
const Itor &  end,
BinaryPredicate  op = BinaryPredicate() 
)
inline

Find first pair of adjacent equal elements.

Searches the range [beg, end) for two consecutive elements that are equal according to the predicate.

Template Parameters
ItorIterator type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element.
endIterator past the last element.
opBinary predicate for comparison.
Returns
Iterator to the first of the equal pair, or end.

Definition at line 443 of file ahAlgo.H.

References next().

Referenced by TEST(), TEST(), TEST(), and unique().

◆ aleph_hash_value()

template<typename StateKey >
size_t Aleph::aleph_hash_value ( const AdversarialTranspositionKey< StateKey > &  key)
inlinenoexcept

◆ align_text_to_left()

std::string Aleph::align_text_to_left ( const std::string &  text,
const size_t  page_width,
const size_t  left_margin = 0 
)
inline

Align text to the left by wrapping lines at page_width.

Parameters
[in]textInput text.
[in]page_widthMaximum line width.
[in]left_marginOptional left margin (spaces).
Returns
Wrapped text.

Definition at line 1180 of file ah-string-utils.H.

References split_text_into_words().

Referenced by align_text_to_left_except_first(), demo_formatting(), and TEST().

◆ align_text_to_left_except_first()

std::string Aleph::align_text_to_left_except_first ( const std::string &  text,
const size_t  width,
const size_t  left_margin = 0 
)
inline

Align all lines except the first one.

Parameters
[in]textInput text.
[in]widthMaximum line width.
[in]left_marginLeft margin for lines after the first.
Returns
Wrapped text.

Definition at line 1219 of file ah-string-utils.H.

References align_text_to_left(), split_text_into_lines(), and to_string().

Referenced by TEST().

◆ all() [1/4]

template<class Container , class Operation >
requires requires(const Container &c, Operation &op) { { c.template traverse<Operation>(op) } -> std::convertible_to<bool>; }
bool Aleph::all ( const Container &  container,
Operation &&  operation = Operation() 
)
inline

Overload of all.

Definition at line 828 of file ahFunctional.H.

◆ all() [2/4]

template<class Container , class Operation >
requires requires(const Container &c, Operation &op) { { c.template traverse<Operation>(op) } -> std::convertible_to<bool>; }
bool Aleph::all ( const Container &  container,
Operation &  operation 
)
inline

Overload of all.

Definition at line 812 of file ahFunctional.H.

◆ all() [3/4]

template<class Container , class Operation >
requires requires(Container &c, Operation &op) { { c.traverse(op) } -> std::convertible_to<bool>; }
bool Aleph::all ( Container &  container,
Operation &&  operation = Operation() 
)
inline

Overload of all.

Definition at line 820 of file ahFunctional.H.

◆ all() [4/4]

template<class Container , class Operation >
requires requires(Container &c, Operation &op) { { c.traverse(op) } -> std::convertible_to<bool>; }
bool Aleph::all ( Container &  container,
Operation &  operation 
)
inline

Return true if all elements satisfy a predicate.

Tests whether the predicate returns true for every element in the container. Short-circuits on the first false result. Returns true for empty containers (vacuous truth).

Template Parameters
ContainerContainer type with traverse() method.
OperationPredicate type (const Item_Type&) -> bool.
Parameters
containerSource container.
operationPredicate to test each element.
Returns
true if operation(item) is true for all items.
Example:
DynList<int> nums = {2, 4, 6, 8};
bool all_even = all(nums, [](int x) { return x % 2 == 0; });
// all_even = true
Doubly-linked list (defined in tpl_dynList.H).
Definition htlist.H:1231
bool all(Container &container, Operation &operation)
Return true if all elements satisfy a predicate.
See also
exists() for testing if any element satisfies predicate.
none() for testing if no element satisfies predicate.

Definition at line 804 of file ahFunctional.H.

Referenced by graph_oracles::dominators(), for_each_in_arc(), main(), main(), Aleph::ConstrainedDelaunayTriangulation::merge_and_deduplicate(), Aleph::DelaunayTriangulationRandomizedIncremental::operator()(), stl_take_last(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynMap(), test_DynMapLinHash(), test_DynSet(), test_DynSetLinHash(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), traverse_in_arcs(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST_P(), TYPED_TEST_P(), Aleph::DelaunayTriangulationBowyerWatson::unique_points(), and Aleph::RegularTriangulationBowyerWatson::unique_sites().

◆ all_in_arc() [1/2]

template<AlephGraph GT, class Op >
bool Aleph::all_in_arc ( const GT &  g,
typename GT::Node *  p,
Op  op = Op() 
)
inline

Test if the arcs of g into p meet a condition; on a digraph, in \(O(E)\).

Parameters
[in]gthe graph of p
[in]pnode pointer
[in]optesting operation
Returns
true if op returns true for all the incoming arcs

Definition at line 3053 of file tpl_graph.H.

References traverse_in_arcs().

◆ all_in_arc() [2/2]

template<AlephGraph GT, class Op >
bool Aleph::all_in_arc ( typename GT::Node *  p,
Op  op = Op() 
)
inline

Test if the incoming arcs meet a condition.

op must have the following signature:

bool op(Arc * arc)

It does not compile on a digraph type: use all_in_arc(g, p, op).

Parameters
[in]pnode pointer
[in]optesting operation
Returns
true if op returns true for all the incoming arcs

Definition at line 3032 of file tpl_graph.H.

Referenced by TYPED_TEST(), and TYPED_TEST().

◆ all_of_tuple()

template<class Pred , class Tuple >
bool Aleph::all_of_tuple ( Pred &&  pred,
const Tuple &  t 
)

Return true if all tuple elements satisfy pred.

Checks if every element in the tuple satisfies the given predicate. Uses fold expressions for compile-time iteration over tuple elements. For an empty tuple, returns true (vacuous truth).

Template Parameters
PredPredicate type (must be callable with each tuple element type).
TupleTuple type to check.
Parameters
predPredicate to test on each element.
tTuple to check.
Returns
true if pred returns true for all elements.
Example:
auto t = std::make_tuple(2, 4, 6);
bool all_even = all_of_tuple([](auto x) { return x % 2 == 0; }, t);
// all_even is true
bool all_of_tuple(Pred &&pred, const Tuple &t)
Return true if all tuple elements satisfy pred.
Definition ah-zip.H:1982

Definition at line 1982 of file ah-zip.H.

References Aleph::zip_index_detail::all_of_tuple_impl(), and pred.

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ all_out_arc()

template<AlephGraph GT, class Op >
bool Aleph::all_out_arc ( typename GT::Node *  p,
Op  op = Op() 
)
inline

Test if the outcoming arcs meet a condition.

op must have the following signature:

bool op(Arc * arc)

Parameters
[in]pnode pointer
[in]optesting operation
Returns
true if op returns true for all the incoming arcs

Definition at line 3403 of file tpl_graph.H.

◆ all_perm() [1/2]

template<typename T , class Pred >
bool Aleph::all_perm ( const DynList< DynList< T > > &  l,
Pred &&  pred 
)

Convenience overload accepting an rvalue callable.

Definition at line 675 of file ah-comb.H.

References all_perm(), l, and pred.

◆ all_perm() [2/2]

template<typename T , class Pred >
bool Aleph::all_perm ( const DynList< DynList< T > > &  l,
Pred &  pred 
)

Check if all permutations satisfy a predicate.

Stops as soon as a permutation makes pred return false.

Template Parameters
TElement type.
PredCallable with signature bool(const DynList<T>&).
Parameters
[in]lList of lists.
[in]predPredicate to test.
Returns
true if all permutations satisfy pred.

Definition at line 666 of file ah-comb.H.

References l, pred, and traverse_perm().

Referenced by all_perm(), demo_perm_predicates(), TEST(), TEST(), TEST(), and TEST().

◆ all_ready()

template<typename T >
bool Aleph::all_ready ( DynList< std::future< T > > &  future_list)
inline

Check if all futures in a list are ready.

Non-blocking check to determine if all futures have completed. Does not consume the futures, but may modify their internal state (wait_for is not const in the standard).

Template Parameters
TThe result type of the futures.
Parameters
[in,out]future_listList of futures to check.
Returns
true if all futures are ready, false otherwise.

Definition at line 174 of file future_utils.H.

Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ all_unique() [1/4]

template<AlephSequentialIterableContainer Container, class Equal = std::equal_to<typename Container::Item_Type>>
bool Aleph::all_unique ( const Container &  container,
Equal &&  eq = Equal() 
)
inline

Check if all elements in a container are unique using an rvalue/lvalue comparator.

This overload accepts comparators by forwarding reference and also provides a default comparator (std::equal_to<Item_Type>).

See also
all_unique(const Container &, Equal &)

This function determines whether all elements in the container are unique according to the provided equality comparator.

Parameters
containerSource container to check.
eqEquality comparator used to compare elements (may be rvalue or lvalue; defaults to std::equal_to).
Returns
true if all elements are unique according to the comparator, false otherwise.

Definition at line 2686 of file ahFunctional.H.

References eq().

◆ all_unique() [2/4]

template<AlephSequentialIterableContainer Container, class Equal >
bool Aleph::all_unique ( const Container &  container,
Equal &  eq 
)
inline

Check if all elements in a container are unique using a comparator.

This function determines whether all elements in the container are unique according to the provided equality comparator.

Complexity:

  • If Equal is std::equal_to<T>, std::hash<T> is available, and DynSetLhash is complete in the current translation unit, the check runs in expected O(n).
  • Otherwise, it falls back to pairwise comparison (O(n²)).
Parameters
containerSource container to check.
eqEquality comparator used to compare elements.
Returns
true if all elements are unique according to the comparator, false otherwise.

Definition at line 2650 of file ahFunctional.H.

References Aleph::functional_detail::all_unique_hash_path(), and, eq(), Aleph::functional_detail::pairwise_all_unique(), and value.

Referenced by all_unique(), Aleph::blossom_weighted_detail::mwmatching::impl::check_input_graph(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ all_unique() [3/4]

bool Aleph::all_unique ( const Container &  container,
Hash &&  hash,
Equal &&  eq 
)
inline

See all_unique(container, hash, eq).

Definition at line 2724 of file ahFunctional.H.

References all_unique(), and eq().

◆ all_unique() [4/4]

bool Aleph::all_unique ( const Container &  container,
Hash &  hash,
Equal &  eq 
)
inline

Definition at line 2712 of file ahFunctional.H.

References Aleph::functional_detail::all_unique_hash_path(), and eq().

◆ allocate() [1/2]

template<class T , typename... Args>
T * Aleph::allocate ( AhArenaAllocator &  arena,
Args &&...  args 
)

Allocate and construct an object in an arena.

Convenience function that allocates and constructs an object of type T in the given arena.

Template Parameters
TType to construct.
ArgsConstructor argument types.
Parameters
[in]arenaArena allocator to use.
[in]argsConstructor arguments.
Returns
Pointer to constructed object, or nullptr if allocation fails.

Example

struct Point { int x, y; Point(int x, int y) : x(x), y(y) {} };
AhArenaAllocator arena(1024);
Point* p = allocate<Point>(arena, 10, 20);
Represents a point with rectangular coordinates in a 2D plane.
Definition point.H:221
Point()
Default constructor.
Definition point.H:234
static mpfr_t y
Definition mpfr_mul_d.c:3

Definition at line 478 of file ah-arena.H.

References Aleph::AhArenaAllocator::alloc(), and Aleph::AhArenaAllocator::TEMPLATE.

Referenced by Node_Pool< Node >::allocate(), Node_Pool< Node >::allocate(), Aleph::Simplex< T >::create_restriction(), operator new(), operator new(), operator new[](), operator new[](), TEST(), and TEST().

◆ allocate() [2/2]

void * Aleph::allocate ( const std::size_t  size)
inline

Allocate size bytes using the C heap.

Parameters
sizeNumber of bytes to allocate. Must be greater than zero.
Returns
Pointer to a block of size bytes.
Exceptions
std::invalid_argumentwhen size == 0.
std::bad_allocwhen the underlying allocation fails.

Definition at line 73 of file ahMem.H.

References ah_bad_alloc_if, ah_invalid_argument_if, and size().

◆ allocate_zeroed()

void * Aleph::allocate_zeroed ( const std::size_t  size)
inline

Allocate size zero-initialized bytes.

Parameters
sizeNumber of bytes to allocate and clear.
Returns
Pointer to a zeroed block of size bytes.
Exceptions
std::invalid_argumentwhen size == 0.
std::bad_allocwhen the underlying allocation fails.

Definition at line 91 of file ahMem.H.

References ah_bad_alloc_if, ah_invalid_argument_if, and size().

Referenced by TEST(), and TEST().

◆ alpha_beta_search() [1/6]

template<AdversarialGameDomain Domain>
auto Aleph::alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for one-shot Alpha-Beta search.

Definition at line 797 of file Alpha_Beta.H.

References alpha_beta_search().

Referenced by alpha_beta_search(), alpha_beta_search(), alpha_beta_search(), alpha_beta_search(), alpha_beta_search(), alpha_beta_search(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ alpha_beta_search() [2/6]

template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto Aleph::alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Alpha-Beta search with domain-provided state key.

Definition at line 853 of file Alpha_Beta.H.

References alpha_beta_search().

◆ alpha_beta_search() [3/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto Aleph::alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Alpha-Beta search with transposition table.

Definition at line 822 of file Alpha_Beta.H.

References alpha_beta_search().

◆ alpha_beta_search() [4/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
Tracer &  tracer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Alpha-Beta search with TT/keyer and tracing.

Definition at line 837 of file Alpha_Beta.H.

References alpha_beta_search().

◆ alpha_beta_search() [5/6]

template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Tracer &  tracer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Alpha-Beta search with domain-provided key and tracing.

Definition at line 868 of file Alpha_Beta.H.

References alpha_beta_search().

◆ alpha_beta_search() [6/6]

template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto Aleph::alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Tracer &  tracer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for one-shot Alpha-Beta search with tracing.

Definition at line 809 of file Alpha_Beta.H.

References alpha_beta_search().

◆ analyze_dataflow_function()

Compiler_Dataflow_Function_Analysis Aleph::analyze_dataflow_function ( const Compiler_IR_Function &  function)
inline

Computes reachability, liveness, definite assignment, and constant propagation for one IR function.

Parameters
functionIR function to analyse; must have a valid entry and exit block.
Returns
Populated Compiler_Dataflow_Function_Analysis for function.
Note
Complexity: O(B·S·iter) where B = number of blocks, S = number of local slots, and iter = number of fixed-point iterations (typically O(B) in the worst case). Not thread-safe on shared state.

Definition at line 978 of file Compiler_Dataflow.H.

References Aleph::DynArray< T >::access(), Aleph::DynArray< T >::append(), Aleph::Compiler_Dataflow_Function_Analysis::assigned_in_slots, Aleph::Compiler_Dataflow_Function_Analysis::assigned_out_slots, Aleph::Compiler_Dataflow_Detail::bit_set_equals(), Aleph::Compiler_Dataflow_Detail::bit_set_intersection(), Aleph::Compiler_Dataflow_Detail::bit_set_subtract(), Aleph::Compiler_Dataflow_Detail::bit_set_union(), Aleph::Compiler_IR_Function::blocks, Boolean, Aleph::Compiler_Dataflow_Detail::compute_block_use_def(), Aleph::Compiler_Dataflow_Detail::compute_predecessor_lists(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_Dataflow_Function_Analysis::constant_in_slots, Aleph::Compiler_Dataflow_Function_Analysis::constant_out_slots, Aleph::Compiler_Dataflow_Detail::constant_vector_equals(), Aleph::Compiler_IR_Function::entry_block, Aleph::Compiler_Dataflow_Function_Analysis::foldable_branch_count, Aleph::Compiler_Dataflow_Detail::initial_assigned_state(), Aleph::Compiler_Dataflow_Detail::initial_constant_state(), Aleph::Compiler_Dataflow_Function_Analysis::live_in_slots, Aleph::Compiler_Dataflow_Function_Analysis::live_out_slots, Aleph::Compiler_Dataflow_Function_Analysis::local_slot_count, Aleph::Compiler_IR_Function::local_slots, Aleph::Compiler_Dataflow_Detail::make_bit_set(), Aleph::Compiler_Dataflow_Detail::make_constant_vector(), Aleph::Compiler_Dataflow_Detail::meet_constants(), pred, Aleph::Compiler_Dataflow_Function_Analysis::reachable_blocks, Aleph::Compiler_Dataflow_Detail::simulate_block(), Aleph::DynArray< T >::size(), Aleph::Compiler_SSA_Terminator::successors, Aleph::Compiler_SSA_Block::terminator, Aleph::Compiler_Dataflow_Function_Analysis::uninitialized_reads, and Aleph::Compiler_Dataflow_Detail::unknown_constant().

Referenced by eliminate_dead_code(), main(), TEST(), TEST(), TEST(), and validate_dead_code_elimination().

◆ analyze_fit()

template<typename C , class M >
PolyFitAnalysis< C > Aleph::analyze_fit ( const Gen_MultiPolynomial< C, M > &  poly,
const Array< std::pair< Array< C >, C > > &  data 
)

Compute residual analysis for a polynomial fit.

Template Parameters
CCoefficient type.
MMonomial ordering.
Parameters
[in]polyFitted polynomial.
[in]dataOriginal (point, value) pairs.
Returns
Structure containing R², RMSE, residuals, etc.

Definition at line 4497 of file tpl_multi_polynomial.H.

References Aleph::PolyFitAnalysis< C >::ess, Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::eval(), m, Aleph::PolyFitAnalysis< C >::mean_y, pred, Aleph::PolyFitAnalysis< C >::r_squared, Aleph::PolyFitAnalysis< C >::residuals, Aleph::PolyFitAnalysis< C >::rmse, Aleph::PolyFitAnalysis< C >::rss, OhashCommon< HashTbl, Key >::size(), and Aleph::PolyFitAnalysis< C >::tss.

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ any_of_tuple()

template<class Pred , class Tuple >
bool Aleph::any_of_tuple ( Pred &&  pred,
const Tuple &  t 
)

Return true if any tuple element satisfies pred.

Checks if at least one element in the tuple satisfies the given predicate. Uses fold expressions for compile-time iteration over tuple elements.

Template Parameters
PredPredicate type (must be callable with each tuple element type).
TupleTuple type to check.
Parameters
predPredicate to test on each element.
tTuple to check.
Returns
true if pred returns true for at least one element.
Example:
auto t = std::make_tuple(1, -5, 3);
bool has_negative = any_of_tuple([](auto x) { return x < 0; }, t);
// has_negative is true (because -5 < 0)
bool any_of_tuple(Pred &&pred, const Tuple &t)
Return true if any tuple element satisfies pred.
Definition ah-zip.H:2012

Definition at line 2012 of file ah-zip.H.

References Aleph::zip_index_detail::any_of_tuple_impl(), and pred.

Referenced by none_of_tuple(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ append_in_container()

template<class C , typename... Args>
size_t Aleph::append_in_container ( C &  c,
Args &&...  args 
)
inline

Append multiple items into a container.

Each item is passed to c.append(), in argument order; an rvalue is moved.

Returns
Number of items the container added: a set leaves out a key it already holds (its append() returns a null pointer then).

Definition at line 1930 of file ahFunctional.H.

Referenced by build_container(), TEST(), TEST(), and TEST().

◆ append_unique_tikz_library()

void Aleph::append_unique_tikz_library ( Array< std::string > &  libraries,
const std::string &  library 
)
inline

Append library into libraries unless already present.

Shared by Tikz_Plane::required_tikz_libraries and Tikz_Scene's overlay/beamer export helpers so both single-item and bulk-merge callers use the same "already present" scan.

Definition at line 86 of file tikzgeom.H.

References Aleph::Array< T >::append(), and Aleph::Array< T >::size().

Referenced by Aleph::Tikz_Scene::append_unique_libraries(), and Aleph::Tikz_Plane::required_tikz_libraries().

◆ approximate_string_size()

size_t Aleph::approximate_string_size ( const std::string &  str)
inline

Estimate the count of printable characters in a LaTeX string.

Skips LaTeX commands (starting with ), braces, and math mode markers.

Parameters
strThe LaTeX string to estimate.
Returns
The estimated number of printable characters.

Definition at line 2778 of file point.H.

References and.

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ arctan()

Geom_Number Aleph::arctan ( const Geom_Number &  m)
inline

Arc tangent of m (wrapper over mpfr).

Definition at line 173 of file point.H.

References atan(), and m.

Referenced by TEST().

◆ arctan2()

Geom_Number Aleph::arctan2 ( const Geom_Number &  m,
const Geom_Number &  n 
)
inline

Two-argument arc tangent (wrapper over mpfr).

Definition at line 179 of file point.H.

References atan2(), and m.

Referenced by Aleph::Polar_Point::Polar_Point(), Aleph::Segment::counterclockwise_angle_with(), and TEST().

◆ are_eq()

template<class C1 , class C2 , class Eq = std::equal_to<typename C1::Item_Type>>
std::tuple< bool, size_t, typename C1::Item_Type, typename C2::Item_Type > Aleph::are_eq ( const C1 &  c1,
const C2 &  c2,
Eq  e = Eq() 
)
inline

Detailed equality check returning mismatch position and values.

Like eq() but returns detailed information about the comparison:

  • Whether the containers are equal
  • The position of first mismatch (if any)
  • The mismatched values from both containers
Template Parameters
C1Type of the first container.
C2Type of the second container.
EqEquality predicate type.
Parameters
c1First container.
c2Second container.
eEquality predicate.
Returns
Tuple of (equal, position, value1, value2).
Example:
DynList<int> a = {1, 2, 5, 4};
DynList<int> b = {1, 2, 3, 4};
auto [equal, pos, v1, v2] = are_eq(a, b);
// equal=false, pos=2, v1=5, v2=3
std::tuple< bool, size_t, typename C1::Item_Type, typename C2::Item_Type > are_eq(const C1 &c1, const C2 &c2, Eq e=Eq())
Detailed equality check returning mismatch position and values.
bool equal(Itor1 beg, const Itor1 &end, Itor2 cmpBeg, BinaryPredicate op=BinaryPredicate())
Test if two ranges are equal.
Definition ahAlgo.H:482
See also
eq() for simple boolean result.

Definition at line 1283 of file ahFunctional.H.

References and.

Referenced by TEST().

◆ are_equal()

template<AlephGraph GT>
bool Aleph::are_equal ( const GT &  g1,
const GT &  g2 
)
inline

Fast graph comparison.

If the data types stored in the nodes are sortable then this method can respond if two graphs are isomorphic in \(O(V \lg V) + O(E)\).

Both graphs must be of same type.

Warning
The cookies of nodes are used and set

Since this function uses node indexes, this is defined in tpl_indexGraph.H.

Parameters
[in]g1a graph
[in]g2a graph
Returns
true if the graphs are equal; false otherwise
See also
find_depth_first_spanning_tree() find_breadth_first_spanning_tree()
Kruskal_Min_Spanning_Tree Prim_Min_Spanning_Tree
Dijkstra_Min_Paths Bellman_Ford

Definition at line 242 of file tpl_indexGraph.H.

References GraphCommon< GT, Node, Arc >::all_arcs(), GraphCommon< GT, Node, Arc >::all_nodes(), GraphCommon< GT, Node, Arc >::esize(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), and GraphCommon< GT, Node, Arc >::vsize().

Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ are_equals() [1/2]

template<class T , class Compare >
bool Aleph::are_equals ( const T &  op1,
const T &  op2,
Compare &&  cmp = Compare() 
)
inline

Determines if operands are equal using a comparison operator.

Parameters
op1First operand
op2Second operand
cmpComparison functor
Returns
true if op1 == op2 according to cmp

Definition at line 1126 of file ahFunction.H.

References cmp().

Referenced by binary_search_dup(), binindex_dup(), binindex_dup(), bsearch(), bsearch(), bsearch(), bsearch_dup(), bsearch_dup(), and bsearch_dup().

◆ are_equals() [2/2]

template<class T , class Compare >
bool Aleph::are_equals ( const T &  op1,
const T &  op2,
Compare &  cmp 
)
inline

See are_equals().

Definition at line 1136 of file ahFunction.H.

References cmp().

◆ are_near()

constexpr bool Aleph::are_near ( const double  v1,
const double  v2,
const double  e 
)
constexprnoexcept

Return true if v1 is within absolute distance e of v2.

Definition at line 468 of file ahUtils.H.

Referenced by TEST().

◆ are_tree_equal()

template<class Node , class Eq = std::equal_to<typename Node::key_type>>
bool Aleph::are_tree_equal ( Node *  t1,
Node *  t2,
Eq &&  eq = Eq() 
)
inline

Definition at line 1362 of file tpl_tree_node.H.

References eq().

◆ area_of_parallelogram()

Geom_Number Aleph::area_of_parallelogram ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Compute the signed area of the parallelogram defined by vectors a->b and a->c.

Equivalent to the 2D cross product (b-a) x (c-a).

Parameters
aThe first point.
bThe second point.
cThe third point.
Returns
The signed area (positive for CCW, negative for CW).

Definition at line 2886 of file point.H.

References Aleph::Point::get_x(), and Aleph::Point::get_y().

Referenced by Aleph::Triangle::Triangle(), Aleph::Triangle::Triangle(), Aleph::Triangle::Triangle(), area_of_triangle(), c_is_to_left_(), Aleph::TrapezoidalMapPointLocation::dag_locate(), Aleph::RotatingCalipersConvexPolygon::diameter(), Aleph::VisvalingamWhyattSimplification::effective_area(), Aleph::QuickHull::get_farthest_point(), Aleph::QuickHull::get_right_points(), Aleph::Segment::intersects_properly_with(), is_clockwise(), Aleph::Point::is_clockwise_with(), Aleph::Point::is_colinear_with(), Aleph::Polygon::is_convex(), Aleph::GeomPolygonUtils::is_convex(), Aleph::Point::is_left_of(), Aleph::Point::is_right_of(), Aleph::Point::is_to_right_from(), left_on(), Aleph::TrapezoidalMapPointLocation::Result::locate(), Aleph::RotatingCalipersConvexPolygon::minimum_width(), Aleph::GrahamScanConvexHull::operator()(), Aleph::AlphaShape::operator()(), orientation(), Aleph::QuickHull::partition(), Aleph::TrapezoidalMapPointLocation::point_above_segment(), Aleph::BooleanPolygonOperations::point_inside_ccw(), points_are_colinear(), TEST(), TEST(), TEST_F(), Aleph::MonotonePolygonTriangulation::triangulate_monotone(), Aleph::AndrewMonotonicChainConvexHull::turn(), and Aleph::GrahamScanConvexHull::turn().

◆ area_of_triangle()

Geom_Number Aleph::area_of_triangle ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Return the (unsigned) area of triangle (a, b, c) as an exact rational.

Definition at line 3037 of file point.H.

References abs(), and area_of_parallelogram().

Referenced by area_of_triangle_legacy(), TEST(), TEST(), TEST(), and TEST().

◆ area_of_triangle_legacy()

Geom_Number Aleph::area_of_triangle_legacy ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Definition at line 54 of file point_utils.H.

References area_of_triangle(), and area_of_triangle_legacy().

Referenced by area_of_triangle_legacy().

◆ areEquivalents() [1/2]

template<BinNodeLike Node, class Equal = std::equal_to<typename Node::key_type>>
bool Aleph::areEquivalents ( Node *  t1,
Node *  t2,
Equal &&  op = Equal() 
)
inlinenoexcept

See areEquivalents(Node * t1, Node * t2, Equal & op).

Definition at line 952 of file tpl_binNodeUtils.H.

References areEquivalents().

◆ areEquivalents() [2/2]

template<BinNodeLike Node, class Equal >
bool Aleph::areEquivalents ( Node *  t1,
Node *  t2,
Equal &  op 
)
inlinenoexcept

Return true if trees are equivalents.

Two binary tree are similar if they are similar and each pair of nodes in preorder traversal have the same keys

Parameters
[in]t1root of first tree
[in]t2root of second tree
[in]opcomparison operation
Returns
true t1 and t2 are equivalents; false otherwise
See also
areEquivalents()

Definition at line 936 of file tpl_binNodeUtils.H.

References and, areEquivalents(), KEY, LLINK, and RLINK.

Referenced by areEquivalents(), areEquivalents(), and main().

◆ areSimilar()

template<BinNodeLike Node>
bool Aleph::areSimilar ( Node *  t1,
Node *  t2 
)
inlinenoexcept

Return true if both trees are similar.

Two binary tree are similar if they have the same topological form.

Parameters
[in]t1root of first tree
[in]t2root of second tree
Returns
true if t1 and t2 are similar; false otherwise
See also
areEquivalents()

Definition at line 912 of file tpl_binNodeUtils.H.

References and, areSimilar(), LLINK, and RLINK.

Referenced by areSimilar(), main(), and TEST().

◆ argsort()

template<class C , class Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > Aleph::argsort ( const C &  a,
const Compare &  cmp = Compare() 
)
inline

Return indices that visit an array-like container in sorted order.

This is the high-level ahSort.H synonym for build_index() from tpl_sort_utils.H. It works with both Aleph arrays (Array, DynArray, and other containers exposing operator()) and STL-style random-access containers such as std::vector (via operator[]). It returns an Array<size_t> because the number of indices is fixed once the source container size is known.

The returned index array has the direction idx[sorted_pos] = original_pos. In other words, iterating a(idx(i)) for Aleph arrays, or a[idx(i)] for STL arrays, observes the original container in sorted order without moving its elements.

Template Parameters
CArray-like container type. Must provide size() and either operator()(size_t) or operator[](size_t).
CompareStrict weak ordering over the element type.
Parameters
aContainer whose elements define the ordering.
cmpComparator used to order elements.
Returns
Array<size_t> of original positions in sorted order.
Note
Complexity: O(n log n) comparisons and O(n) extra storage.
Stability: not stable; equal elements may appear in any relative order accepted by quicksort_op().
Example
Array<int> a = {30, 10, 20};
auto idx = argsort(a); // {1, 2, 0}
for (size_t i = 0; i < idx.size(); ++i)
std::cout << a(idx(i)) << ' '; // 10 20 30
Simple dynamic array with automatic resizing and functional operations.
Definition tpl_array.H:141
Array< size_t > argsort(const C &a, const Compare &cmp=Compare())
Return indices that visit an array-like container in sorted order.
Definition ahSort.H:385
See also
build_index() Shared implementation in tpl_sort_utils.H.
stable_argsort() for a stable variant.
ranks() for the inverse direction, rank[original_pos] = sorted_pos.

Definition at line 385 of file ahSort.H.

References build_index(), and cmp().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ array_to_DynArray()

template<class T >
DynArray< T > Aleph::array_to_DynArray ( const Array< T > &  a)

Convert an Array to a DynArray.

Creates a new DynArray containing copies of all elements from the given Array.

Template Parameters
TThe element type.
Parameters
aThe source Array.
Returns
A DynArray containing copies of all elements from a.

Definition at line 285 of file ah-convert.H.

References Aleph::DynArray< T >::append(), and Aleph::Array< T >::size().

Referenced by TEST(), and TEST().

◆ assign_container()

template<class SrcC , class TgtC >
TgtC Aleph::assign_container ( const SrcC &  srcc)

Convert one container type to another.

Definition at line 1953 of file ahFunctional.H.

◆ aumenting_path_maximum_flow()

template<class Net , template< class > class Find_Path>
Net::Flow_Type Aleph::aumenting_path_maximum_flow ( Net &  net)

Maximize flow using repeated augmenting-path searches.

With a floating type of flow, the residues of rounding that the paths leave go back at the end, as those of the preflows (see net_detail::return_dust()): every node keeps its flow within the tolerance of check_node(). What a node keeps within it stays, as the rounding of the sums of its flows: returning it lowered by an ulp arcs that the paths had filled, and min_cut() put the sink with the source.

Warning
With a floating flow, the paths of a depth-first search, as those of Find_Aumenting_Path_DFS, take the residues of rounding that capacities not exact in binary, as tenths, leave on the arcs, of the order of an ulp, and spread them, so that the slacks of the paths go down to 1e-17: they may not end, as on a network of 400 nodes in tenths. ford_fulkerson_maximum_flow() takes the shortest paths then, those of Find_Aumenting_Path_BFS, which end after O(V E) of them.
Parameters
[in,out]netFlow network (must have a single source and sink).
Returns
Maximized flow value.

Definition at line 2258 of file tpl_net.H.

References ah_domain_error_if, and, Aleph::Net_Graph< NodeT, ArcT >::check_network(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), and Aleph::net_detail::return_dust().

◆ back_index()

static long Aleph::back_index ( const long  i)
inlinestaticnoexcept

Convert a 1-based heap index to a 0-based array index.

Definition at line 3689 of file tpl_sort_utils.H.

Referenced by sift_down(), and sift_up().

◆ backtracking_search() [1/2]

template<BacktrackingDomain Domain>
auto Aleph::backtracking_search ( Domain  domain,
typename Domain::State  initial_state,
ExplorationPolicy  policy = {},
SearchLimits  limits = {} 
)

Convenience wrapper that runs a one-shot DFS/backtracking search.

Definition at line 560 of file Backtracking.H.

References backtracking_search().

Referenced by backtracking_search(), and backtracking_search().

◆ backtracking_search() [2/2]

template<BacktrackingDomain Domain, typename OnSolution >
requires SearchSolutionVisitor<OnSolution, SearchSolution<typename Domain::State, typename Domain::Move>>
auto Aleph::backtracking_search ( Domain  domain,
typename Domain::State  initial_state,
OnSolution &  on_solution,
ExplorationPolicy  policy = {},
SearchLimits  limits = {} 
)

Convenience wrapper with a solution callback/collector.

Definition at line 572 of file Backtracking.H.

References backtracking_search().

◆ balance_tree()

template<class Node >
Node * Aleph::balance_tree ( Node *  root)
inline

Rebalance a binary search tree.

balance_tree(root) takes the binary search tree rooted at root and rebalances it "perfectly", in the sense that, for every node, the sizes of its two subtrees differ by at most one.

The operation takes \(O(n\; \lg n)\) time.

Parameters
[in]rootthe root of the binary search tree to rebalance.
Returns
the root of the rebalanced binary search tree.

Definition at line 110 of file tpl_balanceXt.H.

References balance_tree(), COUNT(), LLINK, RLINK, root(), and select_gotoup_root().

Referenced by balance_tree(), and main().

◆ benchmark_maxflow()

template<class Net , class Algo >
MaxFlowBenchmarkResult< typename Net::Flow_Type > Aleph::benchmark_maxflow ( Net &  net,
Algo  algo,
const std::string &  name 
)

Run and time a max-flow algorithm.

Template Parameters
NetNetwork type.
AlgoAlgorithm functor type.
Parameters
netNetwork (will be modified).
algoAlgorithm functor.
nameAlgorithm name for reporting.
Returns
Benchmark result.

Definition at line 971 of file net_utils.H.

References Aleph::MaxFlowBenchmarkResult< Flow_Type >::algorithm_name, Aleph::MaxFlowBenchmarkResult< Flow_Type >::elapsed_ms, and Aleph::MaxFlowBenchmarkResult< Flow_Type >::flow_value.

Referenced by TEST_F().

◆ between() [1/2]

bool Aleph::between ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

◆ between() [2/2]

constexpr Bit_Column Aleph::between ( const std::int64_t  lo,
const std::int64_t  hi 
)
constexpr

Column that holds the integers of [lo, hi].

It takes std::bit_width(hi - lo) bits: none if lo == hi, and 64 if the range spans every std::int64_t.

Parameters
[in]loLowest value.
[in]hiHighest value.
Returns
The column.
Exceptions
std::domain_errorif lo > hi. As a template argument, that is a compile-time error.

Definition at line 116 of file tpl_packed_matrix.H.

References ah_domain_error_if, and between().

◆ bin_to_gray()

template<std::unsigned_integral T>
constexpr T Aleph::bin_to_gray ( const T  n)
constexprnoexcept

Convert a binary number to its Gray code representation.

The i-th bit of the Gray code is 1 if the i-th and (i+1)-th bits of the binary number are different.

Template Parameters
TUnsigned integral type.
Parameters
nBinary number.
Returns
Gray code representation of n.

Definition at line 1071 of file ah-comb.H.

Referenced by build_gray_code(), main(), TEST(), and TEST().

◆ bin_to_tree()

template<class TNode , class BNode >
static void Aleph::bin_to_tree ( BNode *  broot,
TNode *  troot 
)
inlinestatic

◆ binary_search() [1/7]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::binary_search ( const C< T * > &  a,
const T &  x,
Compare &&  cmp = Compare() 
)
inline

Binary search on a sorted container of pointers (full range).

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container of pointers.
xElement to search for.
cmpComparison functor.
Returns
Index where element is found or should be inserted.

Definition at line 4301 of file tpl_sort_utils.H.

References binary_search(), and cmp().

◆ binary_search() [2/7]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::binary_search ( const C< T * > &  a,
const T &  x,
long  l,
long  r,
const Compare &  cmp = Compare() 
)
inline

Binary search on a sorted container of pointers.

Performs binary search to find an element or its insertion point in a sorted container that stores pointers to elements. Comparisons are performed on the pointed-to values.

Template Parameters
CContainer template (must support operator() and size()).
TElement type.
CompareComparison functor type.
Parameters
aSorted container of pointers.
xElement to search for.
lLeft index (inclusive).
rRight index (inclusive).
cmpComparison functor.
Returns
Index where element is found or should be inserted.

Definition at line 4273 of file tpl_sort_utils.H.

References cmp(), l, m, and r.

◆ binary_search() [3/7]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::binary_search ( const C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Binary search on a dynamic ordered array.

binary_search(a,x) searches for x in the array a between 0 and size().

The routine uses the binary search algorithm, which requires that the arrangement is orderly. This condition is not verified in the algorithm.

The method always returns an integer between [0..size()). If the element is found, then the value of return is the index where this is located; otherwise, the index where x would be inserted is returned so that the array was ordered.

Warning
The routine does not fail if the array is empty, but be careful about accessing it in this situation
Parameters
[in]athe dynamic array on which to perform the search.
[in]xthe element to search for.
cmpcomparison object.
Returns
index of the element where x is located or the index of the position where x would be inserted.
See also
sequential_search()

Definition at line 4337 of file tpl_sort_utils.H.

References binary_search(), and cmp().

◆ binary_search() [4/7]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::binary_search ( const C< T > &  a,
const T &  x,
long  l,
long  r,
const Compare &  cmp = Compare() 
)
inline

Binary search on a sorted container.

Performs binary search to find an element or its insertion point in a sorted container. This is the fundamental search algorithm for sorted data, achieving O(log n) time complexity.

Algorithm

  1. Compare target with middle element
  2. If equal, return index
  3. If target < middle, search left half
  4. If target > middle, search right half
  5. Repeat until found or range exhausted

Semantics

The return value has two meanings:

  • If element is found: index where it exists
  • If not found: index where it should be inserted to maintain order

To check if the element was actually found:

long i = binary_search(a, x);
if (i < a.size() && are_equals(a(i), x, cmp))
// found at index i
int cmp(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
Definition gmpfrxx.h:4196
bool are_equals(const T &op1, const T &op2, Compare &&cmp=Compare())
Determines if operands are equal using a comparison operator.
bool binary_search(Itor beg, Itor end, const T &value)
Binary search for a value.
Definition ahAlgo.H:1284

Time complexity: O(log n) Space complexity: O(1)

Template Parameters
CContainer template (must support operator() and size()).
TElement type.
CompareComparison functor type (default: Aleph::less<T>).
Parameters
aSorted container to search.
xElement to search for.
lLeft index (inclusive) of the search range.
rRight index (inclusive) of the search range.
cmpComparison functor.
Returns
Index where element is found, or where it should be inserted.
Precondition
Container must be sorted according to cmp.
See also
bsearch(), sequential_search()

Definition at line 4239 of file tpl_sort_utils.H.

References cmp(), l, m, and r.

◆ binary_search() [5/7]

template<class Itor , class T >
bool Aleph::binary_search ( Itor  beg,
Itor  end,
const T &  value 
)
inline

Binary search for a value.

Tests whether value exists in the sorted range [beg, end).

Template Parameters
ItorForward iterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to search for.
Returns
true if value is found.

Definition at line 1284 of file ahAlgo.H.

References and, lower_bound(), and value.

Referenced by binary_search(), binary_search(), binary_search_dup(), binindex(), binindex_dup(), binindex_dup(), bsearch(), bsearch(), bsearch(), bsearch_dup(), bsearch_dup(), bsearch_dup(), Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::index_node(), Aleph::matgraph_detail::node_index(), TEST(), TEST(), test_DynSet(), test_DynSetLinHash(), and test_hash_table().

◆ binary_search() [6/7]

template<class Itor , class T , class BinaryPredicate >
bool Aleph::binary_search ( Itor  beg,
Itor  end,
const T &  value,
BinaryPredicate  op 
)
inline

Binary search with custom comparison.

Tests whether value exists in the sorted range [beg, end) according to the comparison predicate.

Template Parameters
ItorForward iterator type.
TValue type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to search for.
opBinary comparison predicate.
Returns
true if value is found.

Definition at line 1307 of file ahAlgo.H.

References and, lower_bound(), and value.

◆ binary_search() [7/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::binary_search ( T *  a,
const T &  x,
long  l,
long  r,
const Compare &  cmp = Compare() 
)
inline

Iterative binary search on an ordered array.

Parameters
aPointer to the sorted array.
xValue to search for.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the element if found, or its insertion position.

Definition at line 5204 of file tpl_sort_utils.H.

References cmp(), l, m, and r.

◆ binary_search_dup()

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< size_t > Aleph::binary_search_dup ( const C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Binary search for all occurrences of a value.

Finds all indices in a sorted container that contain a value equal to x.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container.
xElement to search for.
cmpComparison functor.
Returns
DynList containing all indices where x is found.

Definition at line 4360 of file tpl_sort_utils.H.

References Aleph::DynList< T >::append(), are_equals(), binary_search(), cmp(), Aleph::DynList< T >::insert(), and Aleph::DynList< T >::size().

◆ binary_search_rec()

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::binary_search_rec ( T *  a,
const T &  x,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Recursive binary search on an ordered array.

Parameters
aPointer to the sorted array.
xValue to search for.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the element if found, or its insertion position.

Definition at line 5179 of file tpl_sort_utils.H.

References cmp(), l, m, and r.

◆ bind1st()

template<class _Operation , class _Tp >
binder1st< _Operation > Aleph::bind1st ( const _Operation &  __fn,
const _Tp &  __x 
)
inline

Definition at line 479 of file ahFunction.H.

◆ bind2nd()

template<class _Operation , class _Tp >
binder2nd< _Operation > Aleph::bind2nd ( const _Operation &  __fn,
const _Tp &  __x 
)
inline

Definition at line 518 of file ahFunction.H.

Referenced by count(), find(), remove(), replace(), and replace_copy().

◆ binindex()

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::binindex ( const C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Returns the index where a value appears (or should be inserted) in a sorted container.

This function performs a binary search over the container a to locate the element x. The container is assumed to be ordered according to the comparison functor cmp.

The search is delegated to binary_search, and therefore follows the same semantics:

  • If x is found, the returned value is the index at which it is located.
  • If x is not found, the returned value is the index at which x should be inserted to keep the container ordered.

The function does not check that a is actually sorted.

Template Parameters
CTemplate for the container type. It must support random access via operator() and provide size().
TType of the stored elements.
CompareComparison functor type; by default Aleph::less<T>.
Parameters
[in]aSorted container in which the search is performed.
[in]xValue to search for.
cmpComparison functor that defines the ordering.
Returns
Index of the found element or the insertion position.
See also
binary_search()

Definition at line 4654 of file tpl_sort_utils.H.

References binary_search(), and cmp().

◆ binindex_dup() [1/2]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< long > Aleph::binindex_dup ( const C< T * > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Search for all indices of a value in a sorted container of pointers.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container of pointers.
xValue to search for.
cmpComparison functor.
Returns
DynList of indices where pointers point to values equal to x.

Definition at line 4732 of file tpl_sort_utils.H.

References Aleph::DynList< T >::append(), are_equals(), binary_search(), cmp(), and Aleph::DynList< T >::insert().

◆ binindex_dup() [2/2]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< long > Aleph::binindex_dup ( const C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Returns the indices of all occurrences of a value in a sorted container.

This function performs a binary search on the sorted container a to locate the value x. If x is found, it then scans linearly to the left and right of the first found position to collect the indices of all elements equal to x.

The container is assumed to be sorted according to the comparison functor cmp. No verification of this precondition is performed.

The returned list of indices is ordered from smallest to largest.

Template Parameters
CTemplate for the container type. It must support random access via operator() and provide size().
TType of the stored elements.
CompareComparison functor type; by default Aleph::less<T>.
Parameters
[in]aSorted container in which the search is performed.
[in]xValue to search for.
cmpComparison functor that defines the ordering.
Returns
A DynList<long> containing the indices of all elements equal to x. If x is not found, the returned list is empty.
See also
binary_search_dup()
binary_search()

Definition at line 4689 of file tpl_sort_utils.H.

References Aleph::DynList< T >::append(), are_equals(), binary_search(), cmp(), and Aleph::DynList< T >::insert().

◆ bits()

◆ bits_to_tree_helper()

template<BinNodeLike Node>
Node * Aleph::bits_to_tree_helper ( const BitArray &  array,
int &  i 
)
inline

◆ boyer_moore_horspool_search()

Array< size_t > Aleph::boyer_moore_horspool_search ( const std::string_view  text,
const std::string_view  pattern 
)
inline

Find all occurrences using Boyer-Moore-Horspool.

Parameters
[in]textText where matches are searched.
[in]patternPattern to find.
Returns
Array with all match start indices (0-based).
Exceptions
None.
Note
If pattern is empty, returns all positions in [0, text.size()].
Complexity
Average-case sublinear. Worst-case O(nm). Extra space O(1) (fixed 256-byte alphabet table).

Definition at line 313 of file String_Search.H.

References Aleph::string_search_detail::all_match_positions(), and, Aleph::Array< T >::append(), Aleph::Array< T >::create(), m, OhashCommon< HashTbl, Key >::size(), and Aleph::Array< T >::size().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ branch_and_bound_search() [1/2]

template<BranchAndBoundDomain Domain, typename ObjectivePolicy = Maximize_Objective<typename Domain::Objective>>
requires BranchAndBoundObjectivePolicy<ObjectivePolicy, typename Domain::Objective>
auto Aleph::branch_and_bound_search ( Domain  domain,
typename Domain::State  initial_state,
ExplorationPolicy  policy = Branch_And_Bound<Domain, ObjectivePolicy>::default_policy(),
SearchLimits  limits = {},
ObjectivePolicy  objective = {} 
)

Convenience wrapper for one-shot branch and bound.

Definition at line 990 of file Branch_And_Bound.H.

References branch_and_bound_search().

Referenced by branch_and_bound_search(), branch_and_bound_search(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ branch_and_bound_search() [2/2]

template<BranchAndBoundDomain Domain, typename OnSolution , typename ObjectivePolicy = Maximize_Objective<typename Domain::Objective>>
requires BranchAndBoundObjectivePolicy<ObjectivePolicy, typename Domain::Objective>
and SearchSolutionVisitor< OnSolution, OptimizationSolution< typename Domain::State, typename Domain::Move, typename Domain::Objective > > auto Aleph::branch_and_bound_search ( Domain  domain,
typename Domain::State  initial_state,
OnSolution &  on_solution,
ExplorationPolicy  policy = Branch_And_Bound<Domain, ObjectivePolicy>::default_policy(),
SearchLimits  limits = {},
ObjectivePolicy  objective = {} 
)

Convenience wrapper for branch and bound with a solution callback.

Definition at line 1012 of file Branch_And_Bound.H.

References branch_and_bound_search().

◆ breadth_first_traversal()

template<AlephGraph GT>
size_t Aleph::breadth_first_traversal ( GT &  g,
bool(*)(const GT &, typename GT::Node *, typename GT::Arc *)  visit 
)
inline

See breadth_first_traversal(const GT&, typename GT::Node*, bool (*)(...)).

Definition at line 461 of file tpl_graph_utils.H.

References breadth_first_traversal(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::get_first_node().

◆ bsearch() [1/3]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * Aleph::bsearch ( C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Search for a value in a sorted container returning a pointer.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container.
xValue to search for.
cmpComparison functor.
Returns
Pointer to the found element, or nullptr if not found.

Definition at line 4487 of file tpl_sort_utils.H.

References are_equals(), binary_search(), and cmp().

◆ bsearch() [2/3]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * Aleph::bsearch ( const C< T * > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Search for a value in a sorted container of pointers.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container of pointers.
xValue to search for.
cmpComparison functor.
Returns
The found pointer, or nullptr if not found.

Definition at line 4519 of file tpl_sort_utils.H.

References are_equals(), binary_search(), and cmp().

◆ bsearch() [3/3]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * Aleph::bsearch ( const C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 4498 of file tpl_sort_utils.H.

References are_equals(), binary_search(), and cmp().

◆ bsearch_dup() [1/3]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T * > Aleph::bsearch_dup ( C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Search for all occurrences of a value returning pointers.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container.
xValue to search for.
cmpComparison functor.
Returns
DynList of pointers to matching elements.

Definition at line 4540 of file tpl_sort_utils.H.

References Aleph::DynList< T >::append(), are_equals(), binary_search(), cmp(), and Aleph::DynList< T >::insert().

◆ bsearch_dup() [2/3]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T * > Aleph::bsearch_dup ( const C< T * > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Search for all occurrences of a value in a container of pointers.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container of pointers.
xValue to search for.
cmpComparison functor.
Returns
DynList of found pointers.

Definition at line 4584 of file tpl_sort_utils.H.

References Aleph::DynList< T >::append(), are_equals(), binary_search(), cmp(), Aleph::DynList< T >::insert(), and Aleph::DynList< T >::size().

◆ bsearch_dup() [3/3]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< const T * > Aleph::bsearch_dup ( const C< T > &  a,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Search for all occurrences of a value returning pointers (const version).

Performs binary search on a and collects pointers to all elements equal to x.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aSorted container.
xValue to search for.
cmpComparison functor.
Returns
DynList of pointers to matching elements.

Definition at line 4443 of file tpl_sort_utils.H.

References Aleph::DynList< T >::append(), are_equals(), binary_search(), cmp(), and Aleph::DynList< T >::insert().

◆ bubble_sort()

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::bubble_sort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Sort a dynamic array using bubble sort.

Bubble sort repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.

Characteristics

  • Time complexity: O(n²) always
  • Space complexity: O(1) - in-place
  • Stability: Stable
  • Adaptive: Can be made adaptive (not this implementation)

When to Use

  • Educational purposes (simple to understand)
  • Very small arrays where simplicity matters
  • Almost never in production code
Warning
This is one of the slowest sorting algorithms. Use insertion_sort() for simple cases or quicksort() for better performance.
Template Parameters
TElement type (must be swappable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
aThe dynamic array to sort.
cmpComparison functor.
See also
insertion_sort(), selection_sort()

Bubble the smaller element one position toward the front.

Definition at line 3549 of file tpl_sort_utils.H.

References cmp(), and Aleph::DynArray< T >::size().

Referenced by benchmark_array_algorithms().

◆ bucket_sort() [1/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void Aleph::bucket_sort ( Array< T > &  a,
const Compare &  cmp = Compare() 
)

Bucket sort for Array (floating-point convenience).

Template Parameters
TFloating-point type.
CompareComparison functor.
Parameters
[in,out]aArray to sort.
[in]cmpComparison functor.

Definition at line 6399 of file tpl_sort_utils.H.

References bucket_sort(), cmp(), and Aleph::Array< T >::size().

◆ bucket_sort() [2/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>, class BucketKey >
void Aleph::bucket_sort ( Array< T > &  a,
const size_t  num_buckets,
const BucketKey &  bucket_key,
const Compare &  cmp = Compare() 
)

Bucket sort for Array with user-supplied bucket mapping.

Template Parameters
TElement type.
CompareComparison functor.
BucketKeyCallable mapping T -> size_t.
Parameters
[in,out]aArray to sort.
[in]num_bucketsNumber of buckets.
[in]bucket_keyMapping function.
[in]cmpComparison functor.

Definition at line 6479 of file tpl_sort_utils.H.

References bucket_sort(), cmp(), and Aleph::Array< T >::size().

◆ bucket_sort() [3/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void Aleph::bucket_sort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)

Bucket sort for DynArray (floating-point convenience).

Template Parameters
TFloating-point type.
CompareComparison functor.
Parameters
[in,out]aDynArray to sort.
[in]cmpComparison functor.
Complexity
O(n) expected for uniformly distributed data.

Definition at line 6379 of file tpl_sort_utils.H.

References bucket_sort(), and cmp().

◆ bucket_sort() [4/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>, class BucketKey >
void Aleph::bucket_sort ( DynArray< T > &  a,
const size_t  num_buckets,
const BucketKey &  bucket_key,
const Compare &  cmp = Compare() 
)

Bucket sort for DynArray with user-supplied bucket mapping.

Template Parameters
TElement type.
CompareComparison functor.
BucketKeyCallable mapping T -> size_t.
Parameters
[in,out]aDynArray to sort.
[in]num_bucketsNumber of buckets.
[in]bucket_keyMapping function.
[in]cmpComparison functor.

Definition at line 6459 of file tpl_sort_utils.H.

References cmp().

◆ bucket_sort() [5/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void Aleph::bucket_sort ( DynList< T > &  list,
const Compare &  cmp = Compare() 
)

Bucket sort for DynList (floating-point convenience).

Copies elements to an Array, sorts with bucket sort, then writes sorted values back into the list nodes.

Template Parameters
TFloating-point type.
CompareComparison functor.
Parameters
[in,out]listDynList to sort.
[in]cmpComparison functor.

Definition at line 6437 of file tpl_sort_utils.H.

References bucket_sort(), and cmp().

◆ bucket_sort() [6/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void Aleph::bucket_sort ( T *  a,
const size_t  n,
const Compare &  cmp = Compare() 
)

Bucket sort convenience for floating-point arrays.

How Floating-Point Bucket Sort Works: This overload automatically handles the distribution logic for floating-point numbers without requiring a custom bucket_key.

  1. It first finds the minimum and maximum values to determine the exact range.
  2. It mathematically maps (interpolates) each number to one of n buckets based on its relative position in the [min, max] range.
  3. Elements are scattered, sorted inside their buckets, and concatenated.

This is highly efficient for uniformly distributed floats (e.g., random numbers in [0.0, 1.0)).

Template Parameters
TFloating-point type (float, double, long double).
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array to sort.
[in]nNumber of elements.
[in]cmpComparison functor.
Exceptions
std::invalid_argumentif a is null and n > 0.
Note
If any element is non-finite (NaN or Infinity), the routine will skip bucket interpolation and fall back to timsort.
Complexity
O(n) expected for uniformly distributed data, O(n^2) the worst case.
Stability
Stable.

Definition at line 6309 of file tpl_sort_utils.H.

References ah_invalid_argument_if, and, Aleph::bucket_sort_detail::bucket_sort_impl(), cmp(), range(), and timsort().

◆ bucket_sort() [7/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>, class BucketKey >
void Aleph::bucket_sort ( T *  a,
const size_t  n,
const size_t  num_buckets,
const BucketKey &  bucket_key,
const Compare &  cmp = Compare() 
)

Bucket sort with user-supplied bucket mapping.

How Bucket Sort Works: Instead of dealing with all elements at once, Bucket Sort divides the sorting workload into smaller, manageable chunks called "buckets". The core idea is:

  1. Create an array of empty buckets.
  2. Iterate over the original array and use a mathematical mapping (the bucket_key function) to scatter each element into its corresponding bucket. Elements that are mathematically close to each other will end up in the same bucket.
  3. Once all elements are distributed, sort each individual bucket. Because buckets usually contain very few elements (if the distribution is uniform), a simple and fast algorithm like Insertion Sort is typically used internally.
  4. Finally, visit the buckets in order and concatenate their sorted contents back into the original array.

This algorithm shines when elements are uniformly distributed across a known range. If elements cluster into a single bucket, performance degrades to that of the internal sorting algorithm (O(n^2) for Insertion Sort).

Template Parameters
TElement type.
CompareComparison functor (default: Aleph::less<T>).
BucketKeyCallable: bucket_key(element) -> size_t in [0, num_buckets).
Parameters
[in,out]aPointer to the array to sort.
[in]nNumber of elements.
[in]num_bucketsNumber of buckets to distribute into.
[in]bucket_keyMapping function from element to bucket index.
[in]cmpComparison functor.
Precondition
For all elements x,y, if cmp(x,y) is true then bucket_key(x) <= bucket_key(y) (i.e., bucket_key is monotonic with respect to cmp).
Postcondition
If the precondition holds, the output array is globally ordered according to cmp after sorting.
Exceptions
std::invalid_argumentif a is null and n > 0.
std::domain_errorif bucket_key returns an out-of-range index.
Complexity
O(n + k) expected time (uniform distribution), O(n^2) worst case. O(n + k) extra space.
Stability
Stable — equal elements preserve their original relative order.
See also
counting_sort, radix_sort

Delegate to the shared bucket-distribute-and-merge implementation.

Definition at line 6265 of file tpl_sort_utils.H.

References ah_invalid_argument_if, and, Aleph::bucket_sort_detail::bucket_sort_impl(), and cmp().

Referenced by bucket_sort(), bucket_sort(), bucket_sort(), bucket_sort(), bucket_sort(), and Aleph::bucket_sort_detail::bucket_sort_invoker_factory< BucketKey >::operator()().

◆ bucket_sort() [8/8]

template<typename T , size_t N, StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::floating_point<T>
void Aleph::bucket_sort ( T(&)  a[N],
const Compare &  cmp = Compare() 
)

Bucket sort for fixed-size C arrays (floating-point convenience).

Template Parameters
TFloating-point type.
NArray size.
CompareComparison functor.
Parameters
[in,out]aThe array to sort.
[in]cmpComparison functor.

Definition at line 6418 of file tpl_sort_utils.H.

References bucket_sort(), and cmp().

◆ build_array()

template<typename T , typename... Args>
Array< T > Aleph::build_array ( Args &&...  args)

Definition at line 723 of file tpl_array.H.

Referenced by TEST_F(), and TEST_F().

◆ build_combinations() [1/2]

template<typename T >
Array< Array< T > > Aleph::build_combinations ( const Array< T > &  values,
const size_t  k 
)
inline

Materialize all k-combinations of Array<T>.

Template Parameters
TElement type.
Parameters
[in]valuesSource values.
[in]kCombination size.
Returns
All combinations in lexicographic index order.

Definition at line 1035 of file ah-comb.H.

References Aleph::Array< T >::append(), for_each_combination(), and k.

Referenced by TEST().

◆ build_combinations() [2/2]

template<typename T >
Array< Array< T > > Aleph::build_combinations ( const DynArray< T > &  values,
const size_t  k 
)
inline

Overload of build_combinations for DynArray<T>.

Definition at line 1048 of file ah-comb.H.

References Aleph::Array< T >::append(), for_each_combination(), and k.

◆ build_combs()

template<typename T >
DynList< DynList< T > > Aleph::build_combs ( const DynList< DynList< T > > &  l)

Build the set of unique combinations from a list of lists.

Each permutation is sorted (to remove ordering) and inserted into a set, so duplicates are eliminated.

Template Parameters
TElement type. Must be sortable by sort() and comparable by CmpContainer.
Parameters
[in]lList of lists.
Returns
Unique sorted combinations.

Definition at line 535 of file ah-comb.H.

References for_each_perm(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), l, and sort().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ build_container()

template<class C , typename... Args>
C Aleph::build_container ( Args &&...  args)

Build a container with the given items.

Each item is passed to the append() of C, in argument order; an rvalue is moved. C::build(), when C has it, does the same and also converts each item to the item type first.

Definition at line 1944 of file ahFunctional.H.

References append_in_container().

◆ build_dynlist()

template<typename T , typename... Args>
DynList< T > Aleph::build_dynlist ( Args &&...  args)

Build a DynList with the given items; an rvalue is moved.

Definition at line 1964 of file ahFunctional.H.

Referenced by TEST(), and TEST_F().

◆ build_error_msg()

template<typename... Args>
std::string Aleph::build_error_msg ( Args &&...  args)
inline

Alias kept for backwards compatibility with historic API.

Definition at line 110 of file ah-msg.H.

Referenced by TEST().

◆ build_feasible_spanning_tree()

template<class Net >
Feasible_Tree< Net > Aleph::build_feasible_spanning_tree ( const Net &  net)
inline

Build feasible spanning tree classification.

Classifies all arcs into empty (flow=0), full (flow=cap), and partial.

Template Parameters
NetNetwork type.
Parameters
[in]netNetwork to classify.
Returns
Tuple of (empty, full, partial) arc lists.

Definition at line 1096 of file tpl_netcost.H.

References Aleph::DynList< T >::append().

◆ build_gray_code()

Array< uint32_t > Aleph::build_gray_code ( const size_t  n)
inline

Generate the sequence of n-bit Gray codes.

Returns an array containing all 2^n Gray codes in sequence, where each successive value differs by exactly one bit.

Parameters
nNumber of bits (must be <= 31 to fit in Array).
Returns
Array of 2^n Gray codes.
Exceptions
ah_domain_errorif n > 31 (exceeds Array size limits).

Definition at line 1107 of file ah-comb.H.

References ah_domain_error_if, Aleph::Array< T >::append(), bin_to_gray(), count(), and Aleph::Array< T >::reserve().

Referenced by main(), TEST(), and TEST().

◆ build_index()

template<class C , StrictWeakOrder< sort_utils_detail::Indexed_Value_Type< C > > Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > Aleph::build_index ( const C &  a,
const Compare &  cmp = Compare() 
)
inline

Build an index array for indirect sorting.

Creates an array of indices that represents the sorted order of the container's elements without actually moving them. This is useful for:

  • Sorting large objects by a small key
  • Maintaining multiple sort orders simultaneously
  • Non-destructive sorting

Example

DynArray<std::string> names = {"Charlie", "Alice", "Bob"};
auto idx = build_index(names);
// idx = {1, 2, 0} (indices for "Alice", "Bob", "Charlie")
// Iterate in sorted order without modifying 'names':
for (size_t i = 0; i < idx.size(); ++i)
std::cout << names(idx(i)) << " "; // Prints: Alice Bob Charlie
Array< size_t > build_index(const C &a, const Compare &cmp=Compare())
Build an index array for indirect sorting.

Time complexity: O(n log n) for the sort Space complexity: O(n) for the index array

The returned Array is created with its final logical size before the indices are initialized, so index construction does not grow or reallocate the result.

Note
This function is not stable; indices for equivalent elements may be returned in any relative order accepted by quicksort_op().
Template Parameters
CArray-like container type. Must provide size() and either operator()(size_t) or operator[](size_t).
CompareStrict weak ordering over the element type.
Parameters
aContainer whose elements will be indexed.
cmpComparison functor for element ordering.
Returns
Array<size_t> of indices such that accessing a through these indices yields elements in sorted order.
See also
argsort() High-level synonym in ahSort.H.
stable_build_index()
build_index_ptr()

Definition at line 4885 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create(), quicksort_op(), and Aleph::Array< T >::size().

Referenced by argsort(), and TEST().

◆ build_index_ptr() [1/2]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< T * > Aleph::build_index_ptr ( C< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Builds and returns an array of pointers to the elements of container a sorted according to the comparison functor.

This function does not move or copy the elements contained in a. Instead, it creates an Array of pointers to the elements in a and sorts those pointers using cmp(*ptr1, *ptr2) as the ordering criterion. The resulting array allows iteration over the elements of a in sorted order without modifying the original container.

The returned Array is created with its final logical size before the pointers are initialized, so index construction does not grow or reallocate the result (see build_index()).

Template Parameters
CTemplate parameter of the container type. The container must provide size() and operator() for random access.
TElement type stored in the container.
CompareComparison functor type, defaulting to Aleph::less<T>.
Parameters
aReference to the container whose elements are to be indirectly sorted.
cmpComparison functor that defines a strict weak ordering on elements of type T.
Returns
An Array<T *> where each entry is a pointer to an element of a such that *ret(0), *ret(1), ..., *ret(n-1) are in non-decreasing order according to cmp.
See also
stable_build_index_ptr() for a variant that preserves the relative order of equivalent elements.

Definition at line 4990 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create(), quicksort_op(), and Aleph::Array< T >::size().

◆ build_index_ptr() [2/2]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< const T * > Aleph::build_index_ptr ( const C< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Build an index array of pointers for indirect sorting (const version).

Creates an Array of constant pointers to the elements of container a, sorted according to cmp.

The returned Array is created with its final logical size before the pointers are initialized, so index construction does not grow or reallocate the result (see build_index()).

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aContainer to index.
cmpComparison functor.
Returns
Array<const T *> of sorted pointers.
See also
stable_build_index_ptr() for a variant that preserves the relative order of equivalent elements.

Definition at line 4413 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create(), quicksort_op(), and Aleph::Array< T >::size().

◆ build_level_graph()

template<class Net >
bool Aleph::build_level_graph ( Net &  net,
typename Net::Node *  source,
typename Net::Node *  sink 
)

Build level graph using BFS from source.

Assigns levels to nodes based on the shortest path distance from the source in the residual network. Only considers edges with positive residual capacity.

Template Parameters
NetNetwork type.
Parameters
netFlow network.
sourceSource node.
sinkSink node.
Returns
true if sink is reachable, false otherwise.
Exceptions
std::bad_allocif memory allocation for the queue fails.
Note
Complexity: O(E) where E is the number of edges.
Thread safety: Not thread-safe. Modifies node cookies.
Exception safety: Basic guarantee.

Definition at line 223 of file tpl_maxflow.H.

References Aleph::DynListQueue< T >::front(), Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_src_node(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::DynListQueue< T >::is_empty(), next(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), and Aleph::DynListQueue< T >::put().

Referenced by dinic_maximum_flow().

◆ build_pars_list() [1/5]

template<class C >
requires requires(const C &c) { c.is_empty(); c.get_last(); c.get_it(); }
std::string Aleph::build_pars_list ( const C &  c,
const std::string &  sep = "," 
)
inline

Definition at line 1333 of file ah-string-utils.H.

◆ build_pars_list() [2/5]

template<class First , class... Rest>
requires (not requires(const std::remove_reference_t<First> &c) { c.is_empty(); c.get_last(); c.get_it(); })
std::string Aleph::build_pars_list ( const First &  first,
const Rest &...  rest 
)
inline

Build a stringified parameters' list.

Definition at line 1313 of file ah-string-utils.H.

References build_pars_list().

◆ build_pars_list() [3/5]

template<typename T >
requires requires(std::ostream &out, const T &v) { out << v; }
void Aleph::build_pars_list ( std::string &  str,
const T &  item 
)
inline

Definition at line 1270 of file ah-string-utils.H.

◆ build_pars_list() [4/5]

template<class T , class... Args>
void Aleph::build_pars_list ( std::string &  str,
const T &  item,
Args...  args 
)
inline

Append multiple parameters to a comma-separated parameter list.

Template Parameters
TFirst value type.
ArgsRemaining value types.
Parameters
[in,out]strAccumulator.
[in]itemFirst value.
[in]argsRemaining values.

Definition at line 1288 of file ah-string-utils.H.

References build_pars_list().

◆ build_pars_list() [5/5]

void Aleph::build_pars_list ( std::string &  unused)
inline

Base case for build_pars_list(std::string&, ...).

Parameters
[in,out]unusedTerminates recursion (not used).

Definition at line 1256 of file ah-string-utils.H.

Referenced by build_pars_list(), build_pars_list(), demo_conversion(), TEST(), TEST(), and TEST().

◆ build_perms()

template<typename T >
DynList< DynList< T > > Aleph::build_perms ( const DynList< DynList< T > > &  l)

Materialize all permutations from a list of lists.

Template Parameters
TElement type.
Parameters
[in]lList of lists.
Returns
A list containing all permutations.
Note
The output size is the product of input list sizes.

Definition at line 511 of file ah-comb.H.

References Aleph::DynList< T >::append(), for_each_perm(), and l.

Referenced by demo_build(), TEST(), TEST(), and TEST().

◆ build_postorder()

template<template< class > class Node, typename Key >
Node< Key > * Aleph::build_postorder ( const DynArray< Key > &  post,
long  lp,
long  rp,
const DynArray< Key > &  in,
long  li,
long  ri 
)
inline

Definition at line 1095 of file tpl_binNodeUtils.H.

References ah_domain_error_if, LLINK, RLINK, and root().

◆ build_residual_net()

template<class Net >
Residual_Net< typenameNet::Flow_Type >::Node * Aleph::build_residual_net ( const Net &  net,
Residual_Net< typename Net::Flow_Type > &  rnet,
DynMapTree< void *, void * > &  arcs 
)

Build a residual network from a flow network.

Creates a residual network with forward and backward arcs for each arc in the original network. Also builds a mapping from original arcs to residual arcs.

Template Parameters
NetOriginal network type.
Parameters
[in]netThe original flow network.
[out]rnetThe residual network to populate.
[out]arcsMapping from original arcs to residual arcs.
Returns
Pointer to the source node in the residual network.
Exceptions
domain_errorIf network is not single source and single sink.

Definition at line 627 of file tpl_netcost.H.

References ah_domain_error_if, and, arcs, check_residual_net(), create_residual_arc(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), and NODE_COOKIE.

Referenced by max_flow_min_cost_by_cycle_canceling(), and TYPED_TEST().

◆ build_string()

template<typename... Args>
std::string Aleph::build_string ( Args &&...  args)
inline

Concatenate arbitrary streamable arguments into a string.

This helper is primarily used for building exception messages and logging strings without incurring temporary string allocations for each component.

Template Parameters
ArgsVariadic pack of objects insertable into std::ostream.
Parameters
argsValues to append in order.
Returns
The concatenated string.

Definition at line 99 of file ah-msg.H.

Referenced by TEST(), and TEST().

◆ c_is_to_left_()

bool Aleph::c_is_to_left_ ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Definition at line 70 of file point_utils.H.

References area_of_parallelogram(), and c_is_to_left_().

Referenced by c_is_to_left_().

◆ callKeyDestructorsRec()

template<BinNodeLike Node>
void Aleph::callKeyDestructorsRec ( Node *&  root)
inlinenoexcept

Traverses the tree and calls key's destructors.

The keys are destroyed in postorder and the links of every node are left as Node::NullPtr, as in destroyRec(). The depth of the recursion is bounded and nothing is allocated.

@param[in,out] root of tree whose keys are destroyed; it is left as
`Node::NullPtr`
@ingroup Trees

@Warning This function does not free the memory occupied
by the nodes. It only calls the key destructors. Be careful
about double frees if Node calls key destructor in its own
destructor. The function is useful when nodes are allocated
in a memory pool, and you want to free only the keys or an arena
allocator is used for nodes.

Definition at line 835 of file tpl_binNodeUtils.H.

References assert_valid_tree_root(), dispose_tree_nodes(), and root().

Referenced by Aleph::DynSetTree< Key, Tree, Compare >::empty(), TEST(), and TEST().

◆ cancel_cycle()

template<class Res_Net >
void Aleph::cancel_cycle ( const Res_Net &  ,
const Path< Res_Net > &  path 
)

Cancel a negative cycle by augmenting flow.

Finds the minimum slack (residual capacity) along the cycle and augments flow by that amount, which cancels the negative cycle.

Template Parameters
Res_NetResidual network type.
Parameters
[in]pathThe cycle path to cancel.
Precondition
path must be a non-empty cycle with positive residual capacity on all arcs.
Exceptions
domain_errorIf the path is empty or not a cycle, or if it has no bound: each of its arcs goes forward, through an arc without capacity (infinite or max()).

Definition at line 699 of file tpl_netcost.H.

References ah_domain_error_if, Aleph::Path< GT >::for_each_arc(), Aleph::Path< GT >::is_cycle(), Aleph::Path< GT >::is_empty(), Aleph::net_detail::residual_room(), and Aleph::net_detail::without_capacity().

Referenced by max_flow_min_cost_by_cycle_canceling().

◆ capacity_scaling_maximum_flow()

template<FlowNetwork Net>
Net::Flow_Type Aleph::capacity_scaling_maximum_flow ( Net &  net)

Compute maximum flow using capacity scaling.

Capacity scaling improves augmenting path algorithms by only considering edges with "significant" residual capacity in each phase. This reduces the number of augmenting paths found.

With a floating flow, the residues of rounding that the paths leave go back at the end (see net_detail::return_dust()): every node keeps its flow within the tolerance of check_node(), so that the network simplex takes the flow. An infinite capacity gives no scale, and Δ starts from the largest finite one, or from 1 if there is none; the arc takes flow in every phase, and a path from the source to the sink of arcs of infinite capacity makes the maximum flow infinite, which the function returns, as the augmenting paths and the preflows do.

Algorithm

  1. Start with Δ = largest power of 2 ≤ max finite capacity
  2. While Δ ≥ 1: a. Find augmenting paths using only edges with residual ≥ Δ b. Augment flow along these paths c. Δ = Δ / 2

Complexity

O(E² log U) where U is the maximum capacity.

Template Parameters
NetNetwork type.
Parameters
netFlow network.
Returns
Maximum flow value.
Exceptions
domain_errorIf network is not single source/sink.
std::bad_allocIf memory allocation fails during algorithm execution.
Note
Complexity: O(E² log U) where U is the maximum capacity.
Thread safety: Not thread-safe. Modifies network flow values.
Exception safety: Basic guarantee. Network may be partially modified.
Example
// ... build network with large capacities ...
auto max_flow = capacity_scaling_maximum_flow(net);
Net::Flow_Type capacity_scaling_maximum_flow(Net &net)
Compute maximum flow using capacity scaling.
Flow network implemented with adjacency lists.
Definition tpl_net.H:311

Definition at line 573 of file tpl_maxflow.H.

References Aleph::net_detail::add_flow(), ah_domain_error_if, and, Aleph::Net_Graph< NodeT, ArcT >::flow_value(), Aleph::DynListQueue< T >::front(), Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_connected_node(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_src_node(), Aleph::DynMapTree< Key, Data, Tree, Compare >::has(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::DynListQueue< T >::is_empty(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), next(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::DynListQueue< T >::put(), Aleph::net_detail::return_dust(), and Aleph::net_detail::subtract_flow().

Referenced by main(), Aleph::Capacity_Scaling_Maximum_Flow< Net >::operator()(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ char_to_nibble()

int Aleph::char_to_nibble ( const char  c)
inline

Convert a hex character in 0..9A..F to its 4-bit nibble value.

Definition at line 141 of file ahUtils.H.

References and.

Referenced by TEST(), and unhexadecimalize().

◆ check_baseball_elimination()

BaseballEliminationResult Aleph::check_baseball_elimination ( const std::vector< Team > &  teams,
size_t  team_idx 
)
inline

Check if a team is mathematically eliminated from winning.

A team x is eliminated if there is no possible outcome of remaining games where x finishes first (or tied for first).

Algorithm

Construct a flow network:

  • For each game between teams i and j (i≠x, j≠x), create game node
  • Source connects to game nodes with capacity = games remaining
  • Game nodes connect to both team nodes with infinite capacity
  • Team nodes connect to sink with capacity = max_wins_x - current_wins_i

Team x is eliminated iff max-flow < total remaining games among others.

Parameters
teamsVector of team information.
team_idxIndex of team to check.
Returns
BaseballEliminationResult.
Example
std::vector<Team> teams = {
{"Atlanta", 83, 71, 8, {0, 1, 6, 1}},
{"Philly", 80, 79, 3, {1, 0, 0, 2}},
// ...
};
auto result = check_baseball_elimination(teams, 3); // Check team 3
if (result.eliminated)
std::cout << "Team is eliminated!\n";
BaseballEliminationResult check_baseball_elimination(const std::vector< Team > &teams, size_t team_idx)
Check if a team is mathematically eliminated from winning.
Definition net_apps.H:562

Definition at line 562 of file net_apps.H.

References and, Aleph::BaseballEliminationResult::certificate, Aleph::DynSetTree< Key, Tree, Compare >::contains(), dinic_maximum_flow(), Aleph::BaseballEliminationResult::eliminated, Aleph::DynListQueue< T >::front(), Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_connected_node(), Aleph::Net_Graph< NodeT, ArcT >::get_in_degree(), GraphCommon< GT, Node, Arc >::get_src_node(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::DynListQueue< T >::is_empty(), Aleph::BaseballEliminationResult::max_possible_wins, Aleph::DynListQueue< T >::put(), Aleph::Team::remaining, and Aleph::Team::wins.

Referenced by demo_baseball_elimination(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ check_bst_range()

template<BinNodeLike Node, class Compare >
bool Aleph::check_bst_range ( Node *  p,
const typename Node::key_type *  min_key,
const typename Node::key_type *  max_key,
const Compare &  cmp 
)
inline

Definition at line 1645 of file tpl_binNodeUtils.H.

References and, cmp(), KEY, less_or_equal_than(), LLINK, and RLINK.

◆ check_residual_net()

template<class Res_Net >
bool Aleph::check_residual_net ( const Res_Net &  net)

Verify residual network consistency.

Checks that each arc's mirror pointer forms a valid bidirectional link.

Template Parameters
Res_NetResidual network type.
Parameters
[in]netThe residual network to check.
Returns
true if all mirror pointers are consistent.

Definition at line 674 of file tpl_netcost.H.

References and.

Referenced by build_residual_net(), and TYPED_TEST().

◆ checked_avl_height_rk()

template<class Node >
int Aleph::checked_avl_height_rk ( Node *  p)
noexcept

Height of a ranked AVL subtree, checking all its nodes.

In one traversal, checks at every node of the subtree rooted at p that the heights of its two subtrees differ by at most one, that its stored balance factor is that difference, and that its counter is the size of its subtree.

Parameters
proot of subtree to validate
Returns
the height of the subtree, or -1 if a node violates a property
Note
O(n).

Definition at line 95 of file avlNodeRk.H.

References checked_avl_height_rk(), diff(), DIFF, LLINK, and RLINK.

Referenced by checked_avl_height_rk(), and is_avl_rk().

◆ classify_compiler_keyword()

Compiler_Token_Kind Aleph::classify_compiler_keyword ( std::string_view  lexeme)
inlinenoexcept

Classifies a lexeme as a keyword or Identifier.

Classifies one identifier lexeme as a keyword when applicable.

The lexer uses this function to decide if "if" is a Kw_If or an Identifier.

Parameters
lexemeRaw lexeme text.
Returns
The corresponding keyword kind or Identifier if no match.
Note
Thread-safety: Thread-safe.
Complexity: O(1) (fixed number of keywords).

Definition at line 473 of file Compiler_Token.H.

References Identifier, Kw_Break, Kw_Catch, Kw_Class, Kw_Const, Kw_Continue, Kw_Else, Kw_Enum, Kw_Export, Kw_False, Kw_Fn, Kw_For, Kw_If, Kw_Import, Kw_Let, Kw_Namespace, Kw_Return, Kw_Struct, Kw_Throw, Kw_True, Kw_Try, Kw_Type, Kw_Var, and Kw_While.

Referenced by Aleph::Compiler_Lexer::lex_identifier_or_keyword(), and TEST().

◆ close_gap()

template<typename T >
void Aleph::close_gap ( T *  ptr,
size_t  n,
size_t  pos,
size_t  num_entries = 1 
)
inline

Close a gap in an array by shifting elements left.

Removes num_entries elements starting at pos by shifting subsequent elements left.

Template Parameters
TElement type
Parameters
ptrPointer to array
nNumber of elements
posPosition of gap to close
num_entriesNumber of positions to close (default 1)
Exceptions
std::out_of_rangeif pos >= n or num_entries > remaining elements
Note
Uses move semantics for efficiency

Definition at line 125 of file array_utils.H.

References ah_out_of_range_error_if.

Referenced by Aleph::MemArray< T >::close_gap(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::erase_at(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::erase_at(), main(), Aleph::CA::Stationary_Detector::push(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ close_token_scanning()

void Aleph::close_token_scanning ( const char *  buffer,
char *&  start_addr,
const char *  end_addr 
)
inline

Finalize token scanning by null-terminating and saving the token.

Call this after reading all characters of a token. It adds a null terminator to the buffer and saves the token string for error reporting.

Parameters
bufferStart of the buffer containing the token
start_addrReference to current write position; used to add null terminator
end_addrPointer to one past the end of the buffer
See also
init_token_scanning()

Definition at line 250 of file parse_utils.H.

References close_token_scanning(), put_char_in_buffer(), and token_instance.

Referenced by close_token_scanning(), get_token(), load_binary_number(), load_double(), load_escaped_string(), load_hex_number(), load_identifier(), load_number(), load_octal_number(), load_string(), TEST(), and TEST().

◆ code()

◆ coefficient_of_variation()

template<typename Container >
auto Aleph::coefficient_of_variation ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute coefficient of variation (CV = stddev / mean).

Useful for comparing variability of datasets with different means.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Coefficient of variation
Exceptions
std::invalid_argumentif mean is zero

Definition at line 605 of file stat_utils.H.

References ah_invalid_argument_if, coefficient_of_variation(), m, mean(), and stddev().

Referenced by coefficient_of_variation(), TEST(), TEST(), and TEST().

◆ color() [1/2]

template<AlephGraph GT>
static long & Aleph::color ( typename GT::Arc *  a)
static

Definition at line 77 of file tpl_bipartite.H.

References ARC_COUNTER.

◆ color() [2/2]

◆ combination_count()

size_t Aleph::combination_count ( size_t  n,
size_t  k 
)
inline

Compute n choose k with overflow checks.

Parameters
[in]nUniverse size.
[in]kSelection size.
Returns
The exact binomial coefficient C(n, k), or 0 when k > n.
Exceptions
ah_runtime_errorif the exact result does not fit in size_t.

Definition at line 824 of file ah-comb.H.

References ah_runtime_error_if, and k.

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ command_line_to_string()

std::string Aleph::command_line_to_string ( int  argc,
char *  argv[] 
)
inline

Convert command line arguments to a single string.

Concatenates all command line arguments into a single space-separated string. Useful for logging or displaying the command that was invoked.

Parameters
argcArgument count (from main())
argvArgument vector (from main())
Returns
Space-separated string of all arguments
Example
// Program invoked as: ./myapp --input file.txt --verbose
int main(int argc, char* argv[]) {
std::string cmd = command_line_to_string(argc, argv);
// cmd == " ./myapp --input file.txt --verbose"
}
int main()
std::string command_line_to_string(int argc, char *argv[])
Convert command line arguments to a single string.
CmdLine cmd
Definition testHash.C:48
Note
The result has a leading space before the first argument.

Definition at line 556 of file parse_utils.H.

References command_line, and command_line_to_string().

Referenced by command_line_to_string(), main(), TEST(), TEST(), and TEST().

◆ compiler_binary_associativity()

Compiler_Associativity Aleph::compiler_binary_associativity ( Compiler_Token_Kind  kind)
inlinenoexcept

Returns binary associativity for an operator.

Returns associativity metadata for binary operators.

Parameters
kindToken kind.
Returns
Associativity (Left/Right/None).
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 656 of file Compiler_Token.H.

References AndAnd, Assign, EqEq, Greater, GreaterEq, Left, Less, LessEq, Minus, MinusEq, None, NotEq, OrOr, Percent, PercentEq, Plus, PlusEq, Right, Slash, SlashEq, Star, and StarEq.

Referenced by Aleph::Compiler_Parser::parse_expression(), and TEST().

◆ compiler_binary_precedence()

int Aleph::compiler_binary_precedence ( Compiler_Token_Kind  kind)
inlinenoexcept

Returns binary precedence for an operator.

Returns the precedence used by the precedence-climbing parser.

Higher values indicate tighter binding (e.g., * has more precedence than +). Returns 0 if the token is not a valid binary operator.

Parameters
kindToken kind.
Returns
Precedence level (>= 1).
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 620 of file Compiler_Token.H.

References AndAnd, Assign, EqEq, Greater, GreaterEq, Less, LessEq, Minus, MinusEq, NotEq, OrOr, Percent, PercentEq, Plus, PlusEq, Slash, SlashEq, Star, and StarEq.

Referenced by Aleph::Compiler_Parser::parse_expression(), and TEST().

◆ compiler_bind_module_surfaces()

Compiler_Module_Binding_Result Aleph::compiler_bind_module_surfaces ( const Compiler_Module_Link_Result &  linkage)
inline

◆ compiler_build_module_name_table()

◆ compiler_build_module_semantic_environment()

Compiler_Module_Semantic_Environment Aleph::compiler_build_module_semantic_environment ( const Compiler_Module_Name_Table &  table)
inline

Builds one namespace-separated semantic environment from a name table.

Parameters
tablePer-module name table.
Returns
Semantic environment with split value/type namespaces.

Definition at line 85 of file Compiler_Module_Semantic_Environment.H.

References Aleph::Compiler_Module_Semantic_Environment_Detail::append_unique_name(), Aleph::Compiler_Module_Name_Table::modules, Aleph::Compiler_Module_Semantic_Environment::modules, and Type.

Referenced by Aleph::Compiler_Line_Frontend::analyze(), main(), and Aleph::Compiler_Generic_Driver::record_module_semantic_environment_artifact().

◆ compiler_builtin_type_name()

const char * Aleph::compiler_builtin_type_name ( const Compiler_Builtin_Type  builtin)
inlinenoexcept

Returns a stable debug name for a built-in type.

Definition at line 111 of file Compiler_Types.H.

References Bool, Character, Integer, Invalid, String, and Unit.

Referenced by Aleph::Compiler_Type_Context::append_type_text().

◆ compiler_bytecode_completion_kind_name()

const char * Aleph::compiler_bytecode_completion_kind_name ( const Compiler_Bytecode_Completion_Kind  kind)
inlinenoexcept

Stable debug name for one execution completion kind.

Definition at line 107 of file Bytecode_Interpreter.H.

References Halted, Returned, and Runtime_Error.

◆ compiler_bytecode_constant_kind_name()

const char * Aleph::compiler_bytecode_constant_kind_name ( const Compiler_Bytecode_Constant_Kind  kind)
inlinenoexcept

Stable debug name for one constant kind.

Definition at line 121 of file Bytecode.H.

References Boolean, Character, Integer, Raw_Text, String, and Unit.

◆ compiler_bytecode_invalid_id()

constexpr size_t Aleph::compiler_bytecode_invalid_id ( )
inlineconstexprnoexcept

Returns the sentinel invalid bytecode id.

Definition at line 84 of file Bytecode.H.

Referenced by Aleph::Compiler_Bytecode_VM::execute_entry(), Aleph::Compiler_Bytecode_Lowering::lower_function(), and TEST().

◆ compiler_bytecode_opcode_name()

const char * Aleph::compiler_bytecode_opcode_name ( const Compiler_Bytecode_Opcode  opcode)
inlinenoexcept

Stable debug name for one bytecode opcode.

Definition at line 144 of file Bytecode.H.

References Binary, Branch, Call, Halt, Jump, Load_Constant, Load_Function, Load_Global, Load_Local, Return, Store_Global, Store_Local, Trap, and Unary.

Referenced by compiler_dump_bytecode_function().

◆ compiler_bytecode_value_kind_name()

const char * Aleph::compiler_bytecode_value_kind_name ( const Compiler_Bytecode_Value_Kind  kind)
inlinenoexcept

Stable debug name for one bytecode runtime value kind.

Definition at line 90 of file Bytecode_Interpreter.H.

References Function_Ref, Invalid, and Value.

◆ compiler_bytecode_value_to_string()

std::string Aleph::compiler_bytecode_value_to_string ( const Compiler_Bytecode_Value &  value,
const Compiler_Bytecode_Module *  module = nullptr 
)
inline

Renders one bytecode value deterministically.

Parameters
valueValue to render.
moduleOptional module used to enrich bytecode function references with function names.
Returns
Stable human-readable rendering.

Definition at line 347 of file Bytecode_Interpreter.H.

References and, Function_Ref, interpreter_value_to_string(), Invalid, out, Value, and value.

Referenced by compiler_dump_bytecode_globals(), Aleph::Compiler_Bytecode_VM::execute_loop(), Aleph::Compiler_Bytecode_VM::require_bool(), and Aleph::Compiler_Bytecode_VM::require_integer().

◆ compiler_bytecode_values_equal()

bool Aleph::compiler_bytecode_values_equal ( const Compiler_Bytecode_Value &  lhs,
const Compiler_Bytecode_Value &  rhs 
)
inline

Returns whether two bytecode values compare equal.

Equality is structural for wrapped Interpreter_Value payloads and exact by function id for bytecode function references.

Definition at line 320 of file Bytecode_Interpreter.H.

References Aleph::Compiler_Bytecode_Value::function_id, Function_Ref, interpreter_values_equal(), Invalid, Aleph::Compiler_Bytecode_Value::kind, Aleph::Compiler_Bytecode_Value::runtime_value, and Value.

Referenced by Aleph::Compiler_Bytecode_VM::execute_loop().

◆ compiler_cfg_invalid_block_id()

constexpr Compiler_CFG_Block_Id Aleph::compiler_cfg_invalid_block_id ( )
inlineconstexprnoexcept

Returns the sentinel value for an invalid block ID.

Returns
Maximum possible value for Compiler_CFG_Block_Id.

Definition at line 77 of file Compiler_CFG.H.

Referenced by Aleph::Compiler_CFG_Lowering::ensure_current_block(), Aleph::Compiler_CFG_Lowering::lower_statement_sequence(), and Aleph::Compiler_CFG_Lowering::lower_stmt().

◆ compiler_cfg_terminator_kind_name()

const char * Aleph::compiler_cfg_terminator_kind_name ( const Compiler_CFG_Terminator_Kind  kind)
inlinenoexcept

Returns a stable string name for a CFG terminator kind.

Parameters
kindTerminator kind to convert.
Returns
String literal name.

Definition at line 102 of file Compiler_CFG.H.

References Branch, Exit, Jump, None, Return, and Unreachable.

Referenced by compiler_dump_cfg_function().

◆ compiler_dataflow_constant_kind_name()

const char * Aleph::compiler_dataflow_constant_kind_name ( const Compiler_Dataflow_Constant_Kind  kind)
inlinenoexcept

Returns a stable debug name for one constant-lattice kind.

Definition at line 146 of file Compiler_Dataflow.H.

References Boolean, Integer, Undefined, Unit, and Unknown.

◆ compiler_driver_action_name()

const char * Aleph::compiler_driver_action_name ( const Compiler_Driver_Action  action)
inlinenoexcept

Returns the canonical external spelling for one driver action.

Definition at line 67 of file Compiler_Driver_Contracts.H.

References Emit_Bytecode, Emit_C, HIR, IR, Parse_Only, Run, and Sema_Only.

Referenced by TEST().

◆ compiler_dump_bytecode_function()

std::string Aleph::compiler_dump_bytecode_function ( const Compiler_Bytecode_Function *  function,
const Compiler_Bytecode_Module *  module = nullptr,
const Compiler_Type_Context *  types = nullptr 
)
inline

◆ compiler_dump_bytecode_globals()

std::string Aleph::compiler_dump_bytecode_globals ( const Compiler_Bytecode_Module *  module,
const DynArray< Compiler_Bytecode_Value > &  globals 
)
inline

Dumps the current global state associated with one bytecode module.

Parameters
moduleBytecode module that owns the slot layout.
globalsRuntime values stored in each global slot.
Returns
Deterministic plain-text dump.

Definition at line 379 of file Bytecode_Interpreter.H.

References Aleph::DynArray< T >::access(), compiler_bytecode_value_to_string(), Aleph::Compiler_Bytecode_Module::global_slots, out, and Aleph::DynArray< T >::size().

Referenced by Aleph::Compiler_Bytecode_VM::dump_globals().

◆ compiler_dump_bytecode_module()

◆ compiler_dump_cfg_function()

◆ compiler_dump_cfg_module()

std::string Aleph::compiler_dump_cfg_module ( const Compiler_CFG_Module *  module,
const Compiler_Type_Context *  types = nullptr 
)
inline

Dumps a complete CFG module in text format for debugging.

Parameters
moduleModule to dump.
typesOptional type context.
Returns
Multiline string representation.

Definition at line 955 of file Compiler_CFG.H.

References Aleph::Compiler_CFG_Detail::append_indented_text(), compiler_dump_cfg_function(), Aleph::Compiler_CFG_Module::functions, out, and Aleph::Compiler_CFG_Module::top_level.

Referenced by main(), and TEST().

◆ compiler_dump_dataflow_analysis()

std::string Aleph::compiler_dump_dataflow_analysis ( const Compiler_IR_Function *  function,
const Compiler_Dataflow_Function_Analysis &  analysis,
const Compiler_Type_Context *  types = nullptr 
)
inline

Produces a deterministic, human-readable dump of a dataflow result.

Parameters
functionPointer to the IR function; may be nullptr (function name is omitted from the output in that case).
analysisDataflow result to render.
typesOptional type context used to render type names; nullptr causes types to be rendered as numeric IDs.
Returns
A multi-line string containing reachability, liveness, definite assignment, constant lattice values, and uninitialized reads.
Note
Complexity: O(B·S). Not thread-safe.

Definition at line 1294 of file Compiler_Dataflow.H.

References Aleph::DynArray< T >::access(), and, Aleph::Compiler_Dataflow_Function_Analysis::assigned_in_slots, Aleph::Compiler_Dataflow_Function_Analysis::assigned_out_slots, Aleph::Compiler_IR_Detail::block_name(), Aleph::Compiler_IR_Function::blocks, compiler_ir_slot_kind_name(), Aleph::Compiler_Dataflow_Function_Analysis::constant_in_slots, Aleph::Compiler_Dataflow_Function_Analysis::constant_out_slots, Aleph::Compiler_Dataflow_Function_Analysis::foldable_branch_count, Aleph::Compiler_Dataflow_Detail::format_slot_constants(), Aleph::Compiler_Dataflow_Detail::format_slot_set(), Aleph::Compiler_SSA_Block::label, Aleph::Compiler_Dataflow_Function_Analysis::live_in_slots, Aleph::Compiler_Dataflow_Function_Analysis::live_out_slots, Aleph::Compiler_IR_Detail::local_slot_name(), Aleph::Compiler_IR_Function::local_slots, Aleph::Compiler_IR_Function::name, out, Aleph::Compiler_Dataflow_Function_Analysis::reachable_blocks, Aleph::DynArray< T >::size(), and Aleph::Compiler_Dataflow_Function_Analysis::uninitialized_reads.

Referenced by main(), and TEST().

◆ compiler_dump_expr()

std::string Aleph::compiler_dump_expr ( const Compiler_Expr *  expr)
inline

Dumps an expression subtree in a deterministic text format.

Parameters
exprRoot of the expression tree.
Returns
Multiline string representation.
Note
Thread-safety: Safe for concurrent readers.
Complexity: O(N) where N is number of nodes.

Definition at line 1457 of file Compiler_AST.H.

References Aleph::Compiler_Ast_Detail::dump_expr(), and out.

Referenced by TEST().

◆ compiler_dump_function()

std::string Aleph::compiler_dump_function ( const Compiler_Function_Decl *  fn)
inline

Dumps a function declaration in a deterministic text format.

Parameters
fnFunction declaration node.
Returns
Multiline string representation.
Note
Thread-safety: Safe for concurrent readers.
Complexity: O(N) where N is number of nodes.

Definition at line 1513 of file Compiler_AST.H.

References Aleph::Compiler_Function_Decl::body, Aleph::Compiler_Ast_Detail::dump_stmt(), Aleph::Compiler_Ast_Detail::dump_type_expr(), Aleph::Compiler_Function_Decl::name, out, Aleph::Compiler_Function_Decl::parameters, and Aleph::Compiler_Function_Decl::return_annotation.

Referenced by TEST().

◆ compiler_dump_hir_expr()

std::string Aleph::compiler_dump_hir_expr ( const Compiler_HIR_Expr *  expr,
const Compiler_Type_Context &  types 
)
inline

Dumps one HIR expression in a deterministic text format.

Definition at line 777 of file Compiler_HIR_Model.H.

References Aleph::Compiler_HIR_Detail::dump_expr(), and out.

Referenced by Aleph::Compiler_CFG_Detail::append_hir_expr_dump().

◆ compiler_dump_hir_function()

std::string Aleph::compiler_dump_hir_function ( const Compiler_HIR_Function *  function,
const Compiler_Type_Context &  types 
)
inline

◆ compiler_dump_hir_module()

◆ compiler_dump_hir_stmt()

std::string Aleph::compiler_dump_hir_stmt ( const Compiler_HIR_Stmt *  stmt,
const Compiler_Type_Context &  types 
)
inline

Dumps one HIR statement in a deterministic text format.

Definition at line 786 of file Compiler_HIR_Model.H.

References Aleph::Compiler_HIR_Detail::dump_stmt(), and out.

Referenced by Aleph::Compiler_CFG_Detail::append_hir_stmt_dump().

◆ compiler_dump_import_decl()

std::string Aleph::compiler_dump_import_decl ( const Compiler_Import_Decl *  decl)
inline

Dumps an import declaration subtree in a deterministic text format.

Parameters
declRoot of the import declaration subtree.
Returns
Multiline string representation.
Note
Thread-safety: Safe for concurrent readers.
Complexity: O(N) where N is number of contained nodes.

Definition at line 1485 of file Compiler_AST.H.

References Aleph::Compiler_Ast_Detail::dump_import_decl(), and out.

◆ compiler_dump_ir_function()

◆ compiler_dump_ir_module()

◆ compiler_dump_module()

std::string Aleph::compiler_dump_module ( const Compiler_Module *  module)
inline

◆ compiler_dump_ssa_function()

std::string Aleph::compiler_dump_ssa_function ( const Compiler_SSA_Function *  function,
const Compiler_SSA_Module *  module = nullptr,
const Compiler_Type_Context *  types = nullptr 
)
inline

Dumps one SSA function deterministically.

Definition at line 1254 of file SSA.H.

References Aleph::DynArray< T >::access(), and, Aleph::Compiler_IR_Detail::block_name(), Aleph::Compiler_SSA_Detail::block_name(), Aleph::Compiler_SSA_Function::blocks, compiler_ir_terminator_kind_name(), compiler_ssa_instruction_kind_name(), compiler_ssa_invalid_id(), Aleph::Compiler_SSA_Terminator::condition_value, Aleph::Compiler_SSA_Function::dominance, Aleph::Compiler_SSA_Dominance_Info::dominance_frontiers, Aleph::Compiler_SSA_Function::entry_block, Aleph::Compiler_SSA_Function::exit_block, Aleph::Compiler_SSA_Detail::function_name(), Aleph::Compiler_SSA_Detail::global_slot_name(), Aleph::Compiler_SSA_Dominance_Info::immediate_dominators, Aleph::Compiler_SSA_Block::instructions, Aleph::DynArray< T >::is_empty(), Aleph::Compiler_SSA_Terminator::kind, Aleph::Compiler_SSA_Block::label, Aleph::Compiler_SSA_Detail::local_slot_name(), Aleph::Compiler_SSA_Parameter::name, Aleph::Compiler_SSA_Function::name, out, Aleph::Compiler_SSA_Function::parameters, Aleph::Compiler_SSA_Block::phis, Aleph::Compiler_SSA_Block::predecessors, Aleph::Compiler_SSA_Terminator::return_value, Aleph::DynArray< T >::size(), size(), Aleph::Compiler_SSA_Parameter::slot_id, Aleph::Compiler_SSA_Block::source_block_id, Aleph::Compiler_SSA_Terminator::successors, Aleph::Compiler_SSA_Block::terminator, Aleph::Compiler_SSA_Detail::token_name(), Aleph::Compiler_SSA_Parameter::type_id, Aleph::Compiler_SSA_Function::type_id, Aleph::Compiler_SSA_Parameter::value_id, and Aleph::Compiler_SSA_Detail::value_name().

Referenced by compiler_dump_ssa_module(), and TEST().

◆ compiler_dump_ssa_module()

std::string Aleph::compiler_dump_ssa_module ( const Compiler_SSA_Module *  module,
const Compiler_Type_Context *  types = nullptr 
)
inline

◆ compiler_dump_stmt()

std::string Aleph::compiler_dump_stmt ( const Compiler_Stmt *  stmt)
inline

Dumps a statement subtree in a deterministic text format.

Parameters
stmtRoot of the statement tree.
Returns
Multiline string representation.
Note
Thread-safety: Safe for concurrent readers.
Complexity: O(N) where N is number of nodes.

Definition at line 1471 of file Compiler_AST.H.

References Aleph::Compiler_Ast_Detail::dump_stmt(), and out.

◆ compiler_dump_type_decl()

std::string Aleph::compiler_dump_type_decl ( const Compiler_Type_Decl *  decl)
inline

Dumps a type declaration subtree in a deterministic text format.

Parameters
declRoot of the type declaration subtree.
Returns
Multiline string representation.
Note
Thread-safety: Safe for concurrent readers.
Complexity: O(N) where N is number of contained nodes.

Definition at line 1499 of file Compiler_AST.H.

References Aleph::Compiler_Ast_Detail::dump_type_decl(), and out.

◆ compiler_emit_c_module()

Compiler_C_Backend_Emission Aleph::compiler_emit_c_module ( const Compiler_IR_Module *  module,
const Compiler_C_Backend_Options &  options = {},
const Compiler_Type_Context *  types = nullptr 
)
inline

Convenience wrapper that emits one IR module to portable C.

Definition at line 1375 of file Compiler_Backend_C.H.

Referenced by Aleph::Compiler_Driver::emit_c(), Aleph::Compiler_Generic_Driver::emit_c(), main(), TEST(), TEST(), TEST(), and TEST().

◆ compiler_emit_module_name_resolution_diagnostic()

size_t Aleph::compiler_emit_module_name_resolution_diagnostic ( Diagnostic_Engine &  diagnostics,
const Source_Span &  span,
const Compiler_Module_Name_Resolution &  resolution,
const std::string &  code,
const std::string &  subject 
)
inline

Emits one structured diagnostic for a module-name resolution failure.

When resolution.ok() is true, this helper emits nothing and returns 0.

Parameters
diagnosticsDiagnostic engine receiving the error.
spanSource span of the failed use site.
resolutionStructured module-name resolution result.
codeStable frontend-specific diagnostic code.
subjectUser-facing noun phrase such as "line-frontend callee".
Returns
Diagnostic index, or 0 if no diagnostic was emitted.

Definition at line 63 of file Compiler_Module_Name_Diagnostics.H.

References Ambiguous_Name, Aleph::Diagnostic_Builder::code(), code(), compiler_module_export_kind_name(), Aleph::Diagnostic_Builder::emit(), Aleph::Diagnostic_Engine::error(), Aleph::Diagnostic_Builder::help(), Missing_Module, Missing_Name, Aleph::Diagnostic_Builder::note(), resolution, Resolved, and Wrong_Kind.

Referenced by main(), TEST(), TEST(), and Aleph::Compiler_Line_Frontend::validate_top_level_calls().

◆ compiler_expr_kind_name()

const char * Aleph::compiler_expr_kind_name ( const Compiler_Expr_Kind  kind)
inlinenoexcept

Returns a stable debug name for an expression kind.

Parameters
kindExpression kind to convert to string.
Returns
String literal name suitable for logging.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 192 of file Compiler_AST.H.

References Binary, Bool_Literal, Call, Char_Literal, Grouping, Identifier, Integer_Literal, Invalid, String_Literal, and Unary.

◆ compiler_find_module_semantic_environment()

const Compiler_Module_Semantic_Module * Aleph::compiler_find_module_semantic_environment ( const Compiler_Module_Semantic_Environment &  env,
const std::string_view  module_name 
)
inlinenoexcept

Finds one semantic environment by module name.

Definition at line 125 of file Compiler_Module_Semantic_Environment.H.

Referenced by main(), and TEST().

◆ compiler_hir_constant_kind_name()

const char * Aleph::compiler_hir_constant_kind_name ( const Compiler_HIR_Constant_Kind  kind)
inlinenoexcept

Returns a stable debug name for an HIR constant kind.

Definition at line 158 of file Compiler_HIR_Model.H.

References Bool, Character, Integer, String, and Unit.

Referenced by Aleph::Compiler_HIR_Detail::dump_expr().

◆ compiler_hir_expr_kind_name()

const char * Aleph::compiler_hir_expr_kind_name ( const Compiler_HIR_Expr_Kind  kind)
inlinenoexcept

Returns a stable debug name for an HIR expression kind.

Definition at line 108 of file Compiler_HIR_Model.H.

References Binary, Call, Constant, Invalid, Unary, and Variable.

◆ compiler_hir_merge_spans()

Source_Span Aleph::compiler_hir_merge_spans ( const Source_Span &  lhs,
const Source_Span &  rhs 
)
inlinenoexcept

◆ compiler_hir_stmt_kind_name()

const char * Aleph::compiler_hir_stmt_kind_name ( const Compiler_HIR_Stmt_Kind  kind)
inlinenoexcept

Returns a stable debug name for an HIR statement kind.

Definition at line 130 of file Compiler_HIR_Model.H.

References Block, Break, Continue, Eval, If, Invalid, Let, Return, and While.

◆ compiler_integer_binary()

Compiler_Integer_Result Aleph::compiler_integer_binary ( const Compiler_Operator_Kind  op,
const long long  lhs,
const long long  rhs 
)
inlinenoexcept

Applies one integer operator of the language to two values.

Integers are signed 64-bit values. An operation whose result does not fit is an error, not a wrap-around: the HIR interpreter, the bytecode VM and the generated C report it at run time, and the optimizer leaves it unfolded. LLONG_MIN / -1 overflows; LLONG_MIN % -1 is 0, which fits.

Parameters
opPlus, Minus, Star, Slash, Percent, Amp, Pipe or Caret.
lhsleft operand.
rhsright operand.
Returns
the result, or the reason why there is none.

Definition at line 345 of file Compiler_Operator.H.

References Amp, and, Caret, max(), min(), Minus, Percent, Pipe, Plus, Slash, and Star.

Referenced by Aleph::Interpreter_Runtime::evaluate_expr(), and Aleph::Compiler_Bytecode_VM::execute_loop().

◆ compiler_integer_negate()

Compiler_Integer_Result Aleph::compiler_integer_negate ( const long long  operand)
inlinenoexcept

Negates one integer of the language.

Parameters
operandthe value to negate.
Returns
-operand, or Overflow if operand is LLONG_MIN.

Definition at line 408 of file Compiler_Operator.H.

References Ok, and Overflow.

Referenced by Aleph::Interpreter_Runtime::evaluate_expr(), and Aleph::Compiler_Bytecode_VM::execute_loop().

◆ compiler_ir_instruction_kind_name()

const char * Aleph::compiler_ir_instruction_kind_name ( const Compiler_IR_Instruction_Kind  kind)
inlinenoexcept

Stable debug name for one instruction kind.

Definition at line 124 of file Compiler_IR_Model.H.

References Binary, Call, Constant, Function_Ref, Load, Store, and Unary.

Referenced by compiler_dump_ir_function(), and Aleph::Compiler_C_Backend::Emitter::emit_instruction_comment().

◆ compiler_ir_invalid_id()

◆ compiler_ir_slot_kind_name()

const char * Aleph::compiler_ir_slot_kind_name ( const Compiler_IR_Slot_Kind  kind)
inlinenoexcept

◆ compiler_ir_terminator_kind_name()

const char * Aleph::compiler_ir_terminator_kind_name ( const Compiler_IR_Terminator_Kind  kind)
inlinenoexcept

Stable debug name for one terminator kind.

Definition at line 147 of file Compiler_IR_Model.H.

References Branch, Exit, Jump, None, Return, and Unreachable.

Referenced by compiler_dump_ir_function(), compiler_dump_ssa_function(), Aleph::Compiler_C_Backend::Emitter::emit_terminator(), and main().

◆ compiler_is_expression_start()

bool Aleph::compiler_is_expression_start ( const Compiler_Token_Kind  kind)
inlinenoexcept

Returns whether a token kind can start an expression in the MVP grammar.

Frontends may reuse this predicate directly or use it as a reference when defining a custom expression-entry policy.

Definition at line 57 of file Compiler_Parser_Utils.H.

References Bang, Char_Literal, Identifier, Integer_Literal, Kw_False, Kw_True, LParen, Minus, Plus, String_Literal, and Tilde.

Referenced by compiler_is_statement_start(), Aleph::Compiler_Parser::parse_statement(), and TEST().

◆ compiler_is_statement_start()

bool Aleph::compiler_is_statement_start ( const Compiler_Token_Kind  kind)
inlinenoexcept

Returns whether a token kind can start a statement in the MVP grammar.

Definition at line 79 of file Compiler_Parser_Utils.H.

References compiler_is_expression_start(), Kw_Break, Kw_Continue, Kw_If, Kw_Let, Kw_Return, Kw_While, and LBrace.

Referenced by Aleph::Compiler_Parser::parse_statement_terminator(), and TEST().

◆ compiler_is_top_level_declaration_start()

bool Aleph::compiler_is_top_level_declaration_start ( const Compiler_Token_Kind  kind)
inlinenoexcept

Returns whether a token kind starts one top-level declaration.

Definition at line 97 of file Compiler_Parser_Utils.H.

References Kw_Enum, Kw_Fn, Kw_Import, Kw_Struct, and Kw_Type.

Referenced by Aleph::Compiler_Parser_Stream::synchronize_statement(), and TEST().

◆ compiler_link_module_surfaces()

◆ compiler_lookup_module_type()

const Compiler_Module_Bound_Name * Aleph::compiler_lookup_module_type ( const Compiler_Module_Semantic_Environment &  env,
const std::string_view  module_name,
const std::string_view  symbol_name 
)
inlinenoexcept

Looks up one visible type-namespace binding in a module environment.

Definition at line 151 of file Compiler_Module_Semantic_Environment.H.

Referenced by TEST().

◆ compiler_lookup_module_value()

const Compiler_Module_Bound_Name * Aleph::compiler_lookup_module_value ( const Compiler_Module_Semantic_Environment &  env,
const std::string_view  module_name,
const std::string_view  symbol_name 
)
inlinenoexcept

Looks up one visible value-namespace binding in a module environment.

Definition at line 135 of file Compiler_Module_Semantic_Environment.H.

Referenced by TEST(), and Aleph::Compiler_Line_Frontend::validate_top_level_calls().

◆ compiler_merge_spans()

Source_Span Aleph::compiler_merge_spans ( const Source_Span &  lhs,
const Source_Span &  rhs 
)
inlinenoexcept

Merges two spans from the same source file.

Calculates a span that encompasses both input spans. If either span is invalid, the other is returned unchanged.

Parameters
lhsLeft-hand side span.
rhsRight-hand side span.
Returns
A span covering the range from the minimum begin to the maximum end.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 83 of file Compiler_AST.H.

References Aleph::Source_Span::file_id.

Referenced by Aleph::Compiler_Driver::merge_modules_from_order(), Aleph::Compiler_MVP_Frontend::merge_modules_from_order(), Aleph::Compiler_Parser::parse_block_statement(), Aleph::Compiler_Parser::parse_call_suffix(), Aleph::Compiler_Parser::parse_enum_declaration(), Aleph::Compiler_Parser::parse_function(), Aleph::Compiler_Parser::parse_function_type(), Aleph::Compiler_Parser::parse_import_declaration(), Aleph::Compiler_Parser::parse_parenthesized_type(), and Aleph::Compiler_Parser::parse_struct_declaration().

◆ compiler_module_binding_issue_name()

const char * Aleph::compiler_module_binding_issue_name ( const Compiler_Module_Binding_Issue_Kind  kind)
inlinenoexcept

Returns the stable debug name for one module-binding issue kind.

Definition at line 103 of file Compiler_Module_Binder.H.

References Ambiguous_Type_Name, Ambiguous_Value_Name, and Missing_Metadata.

Referenced by compiler_render_module_bindings().

◆ compiler_module_export_kind_name()

const char * Aleph::compiler_module_export_kind_name ( const Compiler_Module_Export_Kind  kind)
inlinenoexcept

◆ compiler_module_linkage_issue_name()

const char * Aleph::compiler_module_linkage_issue_name ( const Compiler_Module_Linkage_Issue_Kind  kind)
inlinenoexcept

Returns the stable debug name for one linkage issue kind.

Definition at line 103 of file Compiler_Module_Linker.H.

References Duplicate_Type_Export, Duplicate_Value_Export, and Missing_Metadata.

Referenced by compiler_render_module_linkage().

◆ compiler_module_name_filter_name()

const char * Aleph::compiler_module_name_filter_name ( const Compiler_Module_Name_Filter  filter)
inlinenoexcept

Returns the stable debug name for one module-name filter.

Definition at line 90 of file Compiler_Module_Name_Resolver.H.

References Any, filter(), Function, Global, Type, and Value.

◆ compiler_module_name_resolution_status_name()

const char * Aleph::compiler_module_name_resolution_status_name ( const Compiler_Module_Name_Resolution_Status  status)
inlinenoexcept

Returns the stable debug name for one module-name resolution status.

Definition at line 110 of file Compiler_Module_Name_Resolver.H.

References Ambiguous_Name, Missing_Module, Missing_Name, Resolved, and Wrong_Kind.

Referenced by main().

◆ compiler_module_resolution_issue_name()

const char * Aleph::compiler_module_resolution_issue_name ( const Compiler_Module_Resolution_Issue_Kind  kind)
inlinenoexcept

Returns the stable debug name of one module-resolution issue kind.

Definition at line 94 of file Compiler_Module_Resolver.H.

References Cyclic_Dependency, and Missing_Dependency.

◆ compiler_operator_compound_base()

Compiler_Operator_Kind Aleph::compiler_operator_compound_base ( const Compiler_Operator_Kind  kind)
inlinenoexcept

Returns the arithmetic operator underlying one compound assignment.

Definition at line 294 of file Compiler_Operator.H.

References Invalid, Minus, MinusEq, Percent, PercentEq, Plus, PlusEq, Slash, SlashEq, Star, and StarEq.

Referenced by Aleph::Interpreter_Runtime::evaluate_expr(), and Aleph::Compiler_IR_Lowering::Module_Builder::lower_expr().

◆ compiler_operator_from_token_kind()

Compiler_Operator_Kind Aleph::compiler_operator_from_token_kind ( const Compiler_Token_Kind  kind)
inlinenoexcept

Maps one reference-frontend token kind into a reusable operator kind.

Definition at line 148 of file Compiler_Operator.H.

References Amp, AndAnd, Assign, Bang, Caret, EqEq, Greater, GreaterEq, Invalid, Less, LessEq, Minus, MinusEq, MinusMinus, NotEq, OrOr, Percent, PercentEq, Pipe, Plus, PlusEq, PlusPlus, Slash, SlashEq, Star, StarEq, and Tilde.

Referenced by Aleph::Compiler_HIR_Lowering::lower_expr().

◆ compiler_operator_is_compound_assignment()

bool Aleph::compiler_operator_is_compound_assignment ( const Compiler_Operator_Kind  kind)
inlinenoexcept

Returns whether kind is one compound-assignment operator.

Definition at line 276 of file Compiler_Operator.H.

References MinusEq, PercentEq, PlusEq, SlashEq, and StarEq.

Referenced by Aleph::Interpreter_Runtime::evaluate_expr(), and Aleph::Compiler_IR_Lowering::Module_Builder::lower_expr().

◆ compiler_operator_name()

◆ compiler_operator_to_token_kind()

Compiler_Token_Kind Aleph::compiler_operator_to_token_kind ( const Compiler_Operator_Kind  kind)
inlinenoexcept

Maps one reusable operator kind back into the MVP token kind.

Definition at line 212 of file Compiler_Operator.H.

References Amp, AndAnd, Assign, Bang, Caret, EqEq, Greater, GreaterEq, Invalid, Less, LessEq, Minus, MinusEq, MinusMinus, NotEq, OrOr, Percent, PercentEq, Pipe, Plus, PlusEq, PlusPlus, Slash, SlashEq, Star, StarEq, and Tilde.

◆ compiler_parse_driver_action()

bool Aleph::compiler_parse_driver_action ( std::string_view  text,
Compiler_Driver_Action &  action 
)
inlinenoexcept

Parses one canonical driver action spelling.

Accepted spellings include parse-only, sema-only, hir, ir, run, emit-c, and emit-bytecode. Short aliases such as parse, sema, c, and bytecode are accepted as convenience spellings.

Parameters
textUser-facing action spelling.
actionOutput action updated on success.
Returns
true if text is recognized.

Definition at line 100 of file Compiler_Driver_Contracts.H.

References Emit_Bytecode, Emit_C, HIR, IR, Parse_Only, Run, and Sema_Only.

Referenced by TEST().

◆ compiler_render_module_bindings()

std::string Aleph::compiler_render_module_bindings ( const Compiler_Module_Binding_Result &  result)
inline

Renders one deterministic text artifact for bound module names.

Parameters
resultBinding result to render.
Returns
Stable plain-text representation of the bound name view.

Definition at line 235 of file Compiler_Module_Binder.H.

References compiler_module_binding_issue_name(), compiler_module_export_kind_name(), Aleph::Compiler_Module_Binding_Result::issues, Aleph::Compiler_Module_Binding_Result::modules, and out.

Referenced by main(), and Aleph::Compiler_Generic_Driver::record_module_bindings_artifact().

◆ compiler_render_module_linkage()

std::string Aleph::compiler_render_module_linkage ( const Compiler_Module_Link_Result &  result)
inline

◆ compiler_render_module_metadata()

std::string Aleph::compiler_render_module_metadata ( const DynArray< Compiler_Module_Metadata > &  modules)
inline

Renders one deterministic text artifact for module metadata.

Definition at line 92 of file Compiler_Module_Metadata.H.

References compiler_module_export_kind_name(), out, and Aleph::DynArray< T >::size().

Referenced by Aleph::Compiler_Generic_Driver::record_module_metadata_artifact(), and TEST().

◆ compiler_render_module_name_table()

std::string Aleph::compiler_render_module_name_table ( const Compiler_Module_Name_Table &  table)
inline

Renders one deterministic text artifact for cached module names.

Parameters
tableCached table to render.
Returns
Stable plain-text representation of the per-module name cache.

Definition at line 143 of file Compiler_Module_Name_Table.H.

References compiler_module_export_kind_name(), Aleph::Compiler_Module_Name_Table::modules, and out.

Referenced by main(), and Aleph::Compiler_Generic_Driver::record_module_name_table_artifact().

◆ compiler_render_module_order()

std::string Aleph::compiler_render_module_order ( const DynArray< size_t > &  order,
const DynArray< Compiler_Module_Descriptor > &  modules 
)
inline

◆ compiler_render_module_semantic_environment()

std::string Aleph::compiler_render_module_semantic_environment ( const Compiler_Module_Semantic_Environment &  env)
inline

◆ compiler_resolve_module_name() [1/2]

Compiler_Module_Name_Resolution Aleph::compiler_resolve_module_name ( const Compiler_Module_Binding_Result &  bindings,
const std::string_view  module_name,
const std::string_view  symbol_name,
const Compiler_Module_Name_Filter  filter = Compiler_Module_Name_Filter::Any 
)
inline

◆ compiler_resolve_module_name() [2/2]

Compiler_Module_Name_Resolution Aleph::compiler_resolve_module_name ( const Compiler_Module_Name_Table &  table,
const std::string_view  module_name,
const std::string_view  symbol_name,
const Compiler_Module_Name_Filter  filter = Compiler_Module_Name_Filter::Any 
)
inline

Resolves one top-level name through a cached per-module name table.

Parameters
tableCached name table built by compiler_build_module_name_table.
module_nameQuery module.
symbol_nameQuery symbol.
filterOptional kind filter for values/functions/globals/types.
Returns
Structured resolution result for the requested symbol.

Definition at line 242 of file Compiler_Module_Name_Resolver.H.

References Ambiguous_Name, Aleph::Compiler_Module_Name_Table_Entry::ambiguous_names, and, Any, Aleph::Compiler_Module_Name_Resolution::binding, filter(), Aleph::Compiler_Module_Name_Resolution::filter, Function, Global, Aleph::Compiler_Module_Name_Resolver_Detail::matches_filter(), Missing_Module, Missing_Name, Aleph::Compiler_Module_Name_Resolution::module_name, Aleph::Compiler_Module_Name_Table::modules, Aleph::Compiler_Module_Name_Table_Entry::names, Resolved, Aleph::Compiler_Module_Name_Resolution::status, Aleph::Compiler_Module_Name_Resolution::symbol_name, Type, Value, and Wrong_Kind.

◆ compiler_resolve_module_order()

Compiler_Module_Resolution_Result Aleph::compiler_resolve_module_order ( const DynArray< Compiler_Module_Descriptor > &  modules)
inline

Resolves one dependency-first order for exact-name module imports.

Missing dependencies are reported and skipped so the caller can still get a best-effort order. Cycles stop DFS along the offending path because no valid dependency-first ordering exists for that strongly connected region.

Definition at line 206 of file Compiler_Module_Resolver.H.

References Aleph::DynArray< T >::access(), Aleph::DynArray< T >::append(), Aleph::Compiler_Module_Resolver_Detail::resolve_visit(), and Aleph::DynArray< T >::size().

Referenced by main(), Aleph::Compiler_Driver::resolve_import_order(), Aleph::Compiler_Line_Frontend::resolve_import_order(), Aleph::Compiler_MVP_Frontend::resolve_import_order(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ compiler_ssa_instruction_kind_name()

const char * Aleph::compiler_ssa_instruction_kind_name ( const Compiler_SSA_Instruction_Kind  kind)
inlinenoexcept

Returns a stable debug name for an SSA instruction kind.

Definition at line 92 of file SSA.H.

References Binary, Call, Constant, Function_Ref, Load_Global, Store_Global, and Unary.

Referenced by compiler_dump_ssa_function().

◆ compiler_ssa_invalid_id()

constexpr size_t Aleph::compiler_ssa_invalid_id ( )
inlineconstexprnoexcept

◆ compiler_stmt_kind_name()

const char * Aleph::compiler_stmt_kind_name ( const Compiler_Stmt_Kind  kind)
inlinenoexcept

Returns a stable debug name for a statement kind.

Parameters
kindStatement kind to convert to string.
Returns
String literal name suitable for logging.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 228 of file Compiler_AST.H.

References Block, Break, Continue, Expr, If, Invalid, Let, Return, and While.

◆ compiler_symbol_kind_name()

const char * Aleph::compiler_symbol_kind_name ( const Compiler_Symbol_Kind  kind)
inlinenoexcept

Returns a stable debug name for a symbol kind.

Definition at line 65 of file Compiler_Symbol_Bindings.H.

References Function, Global, Local, Parameter, and Type.

Referenced by Aleph::Compiler_Symbol_Bindings::dump_symbols().

◆ compiler_token_is_comment()

bool Aleph::compiler_token_is_comment ( Compiler_Token_Kind  kind)
inlinenoexcept

Predicate: Is the kind a comment?

Returns whether kind denotes comment trivia.

Parameters
kindToken kind.
Returns
true if it is a comment (line or block).
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 576 of file Compiler_Token.H.

References Block_Comment, and Line_Comment.

Referenced by TEST().

◆ compiler_token_is_keyword()

bool Aleph::compiler_token_is_keyword ( Compiler_Token_Kind  kind)
inlinenoexcept

Predicate: Is the kind a reserved keyword?

Returns whether kind is one reserved keyword.

Parameters
kindToken kind.
Returns
true if it is a keyword.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 526 of file Compiler_Token.H.

References Kw_Break, Kw_Catch, Kw_Class, Kw_Const, Kw_Continue, Kw_Else, Kw_Enum, Kw_Export, Kw_False, Kw_Fn, Kw_For, Kw_If, Kw_Import, Kw_Let, Kw_Namespace, Kw_Return, Kw_Struct, Kw_Throw, Kw_True, Kw_Try, Kw_Type, Kw_Var, and Kw_While.

Referenced by TEST().

◆ compiler_token_is_literal()

bool Aleph::compiler_token_is_literal ( Compiler_Token_Kind  kind)
inlinenoexcept

Predicate: Is the kind a literal (number, string, bool, etc.)?

Returns whether kind is one literal token.

Parameters
kindToken kind.
Returns
true if it is a literal.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 560 of file Compiler_Token.H.

References Char_Literal, Integer_Literal, Kw_False, Kw_True, and String_Literal.

Referenced by TEST().

◆ compiler_token_is_operator()

bool Aleph::compiler_token_is_operator ( Compiler_Token_Kind  kind)
inlinenoexcept

Predicate: Is the kind an operator (arithmetic, logical, etc.)?

Returns whether kind participates in the operator surface syntax.

Parameters
kindToken kind.
Returns
true if it is a recognized operator.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 582 of file Compiler_Token.H.

References Amp, AndAnd, Arrow, Assign, Bang, Caret, EqEq, Greater, GreaterEq, Less, LessEq, Minus, MinusEq, MinusMinus, NotEq, OrOr, Percent, PercentEq, Pipe, Plus, PlusEq, PlusPlus, Slash, SlashEq, Star, StarEq, and Tilde.

Referenced by TEST().

◆ compiler_token_kind_name()

const char * Aleph::compiler_token_kind_name ( Compiler_Token_Kind  kind)
inline

Returns a human-readable name for a token kind.

Returns a stable debug name for one token kind.

Useful for error messages and debugging (e.g., "expected RParen, found Semicolon").

Parameters
kindToken kind to format.
Returns
String literal containing the kind name.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 323 of file Compiler_Token.H.

References Amp, AndAnd, Arrow, Assign, Bang, Block_Comment, Caret, Char_Literal, Colon, Comma, Dot, Double_Colon, End_Of_File, EqEq, Greater, GreaterEq, Identifier, Integer_Literal, Invalid, Kw_Break, Kw_Catch, Kw_Class, Kw_Const, Kw_Continue, Kw_Else, Kw_Enum, Kw_Export, Kw_False, Kw_Fn, Kw_For, Kw_If, Kw_Import, Kw_Let, Kw_Namespace, Kw_Return, Kw_Struct, Kw_Throw, Kw_True, Kw_Try, Kw_Type, Kw_Var, Kw_While, LBrace, LBracket, Less, LessEq, Line_Comment, LParen, Minus, MinusEq, MinusMinus, NotEq, OrOr, Percent, PercentEq, Pipe, Plus, PlusEq, PlusPlus, Question, RBrace, RBracket, RParen, Semicolon, Slash, SlashEq, Star, StarEq, String_Literal, and Tilde.

Referenced by Aleph::Compiler_Typed_Semantic_Analyzer::analyze_expr(), Aleph::Compiler_Ast_Detail::dump_expr(), and Aleph::Compiler_Token::to_string().

◆ compiler_type_decl_kind_name()

const char * Aleph::compiler_type_decl_kind_name ( const Compiler_Type_Decl_Kind  kind)
inlinenoexcept

Returns a stable debug name for a type-declaration kind.

Parameters
kindType-declaration kind.
Returns
String literal suitable for dumps and logs.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 286 of file Compiler_AST.H.

References Alias, Enum, Invalid, and Struct.

◆ compiler_type_expr_kind_name()

const char * Aleph::compiler_type_expr_kind_name ( const Compiler_Type_Expr_Kind  kind)
inlinenoexcept

Returns a stable debug name for a type-expression kind.

Parameters
kindType-expression kind.
Returns
String literal suitable for dumps and logs.
Note
Thread-safety: Thread-safe.
Complexity: O(1).

Definition at line 262 of file Compiler_AST.H.

References Function, Invalid, Named, and Tuple.

◆ compiler_type_kind_name()

const char * Aleph::compiler_type_kind_name ( const Compiler_Type_Kind  kind)
inlinenoexcept

Returns a stable debug name for a type kind.

Definition at line 89 of file Compiler_Types.H.

References Builtin, Enum, Function, Struct, Tuple, and Type_Variable.

Referenced by Aleph::Compiler_Type_Context::dump_types().

◆ compiler_unify_result_kind_name()

const char * Aleph::compiler_unify_result_kind_name ( const Compiler_Unify_Result_Kind  kind)
inlinenoexcept

Returns a stable debug name for one unification result kind.

Definition at line 158 of file tpl_constraints.H.

References Arity_Mismatch, Invalid_Type, Kind_Mismatch, Occurs_Check_Failed, Rigid_Variable, and Success.

Referenced by main().

◆ compiler_unquote_string_token()

std::string Aleph::compiler_unquote_string_token ( const Compiler_Token &  token)
inline

Removes surrounding double quotes from one string-literal token.

Definition at line 113 of file Compiler_Parser_Utils.H.

References and, Aleph::Compiler_Token::kind, Aleph::Compiler_Token::lexeme, and String_Literal.

Referenced by Aleph::Compiler_Parser::parse_import_declaration(), and TEST().

◆ complete_rows()

template<typename T >
DynList< DynList< T > > Aleph::complete_rows ( DynList< DynList< T > > &  m)
inline

Pad all rows of a matrix to the maximum row length.

Each row is extended with default-constructed T() until all rows have equal size.

Template Parameters
TCell type.
Parameters
[in,out]mMatrix to normalize.
Returns
New matrix with completed rows.

Definition at line 907 of file ah-string-utils.H.

References Aleph::DynList< T >::append(), l, m, Aleph::DynList< T >::size(), and zip_it().

Referenced by TEST().

◆ completed()

bool Aleph::completed ( ) const
noexcept

Return true if all underlying iterators are finished.

This can be used to detect length mismatches after traversing with has_curr().

Definition at line 183 of file ah-zip.H.

References and.

Referenced by Aleph::Compiler_Bytecode_VM::complete_current_frame(), example_structured_concurrency(), Aleph::Compiler_Bytecode_VM::execute_loop(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ compute_all_stats()

template<typename Container >
auto Aleph::compute_all_stats ( const Container &  data) -> Stats<std::decay_t<decltype(*std::begin(data))>>

Compute all statistics for a dataset.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Stats struct with all computed values

Definition at line 769 of file stat_utils.H.

References compute_all_stats(), kurtosis(), min_max(), percentile(), skewness(), Aleph::Stats< T >::sum, and variance().

Referenced by compute_all_stats(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ compute_cut_nodes()

template<AlephGraph GT>
DynList< typename GT::Node * > Aleph::compute_cut_nodes ( const GT &  g)

See compute_cut_nodes(const GT & g, typename GT::Node * start).

Definition at line 1761 of file tpl_graph_utils.H.

References compute_cut_nodes(), and GraphCommon< GT, Node, Arc >::get_node().

◆ compute_flow_statistics()

template<class Net >
FlowStatistics< typename Net::Flow_Type > Aleph::compute_flow_statistics ( const Net &  net)

Compute statistics about the current flow in a network.

Template Parameters
NetNetwork type.
Parameters
netNetwork with flow values.
Returns
FlowStatistics structure.
Exceptions
none
Note
Complexity: O(E) where E is the number of arcs.
Thread safety: Thread-safe for read-only access.
Exception safety: Basic guarantee.

Definition at line 1623 of file tpl_maxflow.H.

References Aleph::Net_Graph< NodeT, ArcT >::flow_value(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::FlowStatistics< Flow_Type >::num_empty_arcs, Aleph::FlowStatistics< Flow_Type >::num_partial_arcs, Aleph::FlowStatistics< Flow_Type >::num_saturated_arcs, Aleph::FlowStatistics< Flow_Type >::total_capacity, Aleph::FlowStatistics< Flow_Type >::total_flow, and Aleph::FlowStatistics< Flow_Type >::utilization.

Referenced by TEST(), TEST(), TEST(), and TYPED_TEST().

◆ compute_nodes_in_level_helper()

template<BinNodeLike Node>
void Aleph::compute_nodes_in_level_helper ( Node *  root,
long  level,
const long  current_level,
DynDlist< Node * > &  level_list 
)
inline

◆ compute_optimal_costs()

static void Aleph::compute_optimal_costs ( DynArray< double > &  cost,
double  p[],
const size_t  n,
DynArray< int > &  tree 
)
inlinestatic

Compute optimal costs and tree structure using dynamic programming.

Fills the cost and tree matrices using the recurrence: cost[i,j] = min over k in [i,j] of (cost[i,k-1] + cost[k+1,j]) + sum(p[i..j])

Uses two key optimizations:

  1. Prefix sums for O(1) probability range queries
  2. Knuth's optimization: root[i,j-1] ≤ root[i,j] ≤ root[i+1,j] This reduces the inner loop from O(n) to amortized O(1), giving O(n²) total.
Parameters
[out]costMatrix storing optimal costs for subproblems.
[in]pArray of access probabilities (0-indexed, size n).
[in]nNumber of keys.
[out]treeMatrix storing optimal root indices for subproblems.

Definition at line 86 of file opBinTree.H.

References COST, COST_OF, prefix(), r, ROOT_OF, and TREE.

Referenced by build_optimal_tree().

◆ compute_shortest_path_funnel_trace()

◆ compute_stats() [1/2]

template<typename Container >
void Aleph::compute_stats ( const Container &  data,
std::decay_t< decltype(*std::begin(data))> &  avg,
std::decay_t< decltype(*std::begin(data))> &  var,
std::decay_t< decltype(*std::begin(data))> &  med,
std::decay_t< decltype(*std::begin(data))> &  _min,
std::decay_t< decltype(*std::begin(data))> &  _max 
)

Compute basic descriptive statistics for a container.

Non-destructive version that copies data before sorting.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
avgOutput: arithmetic mean
varOutput: sample variance
medOutput: median value
_minOutput: minimum value
_maxOutput: maximum value

Definition at line 899 of file stat_utils.H.

References Aleph::Array< T >::append(), compute_stats(), in_place_sort(), k, and m.

◆ compute_stats() [2/2]

template<class T >
void Aleph::compute_stats ( T *  data,
int  l,
int  r,
T &  avg,
T &  var,
T &  med,
T &  _min,
T &  _max 
)

Compute basic descriptive statistics for an array range.

Deprecated:
Use compute_all_stats() instead.

Calculates average, variance, median, minimum, and maximum for the elements in data[l..r].

Template Parameters
TNumeric type supporting arithmetic operations
Parameters
dataArray of values (will be sorted)
lLeft index (inclusive)
rRight index (inclusive)
avgOutput: arithmetic mean
varOutput: sample variance
medOutput: median value
_minOutput: minimum value
_maxOutput: maximum value
Note
The array data[l..r] is sorted as a side effect.
Uses Welford's algorithm for numerically stable variance.
Warning
Requires at least 2 elements for valid variance calculation.

Definition at line 847 of file stat_utils.H.

References compute_stats(), introsort(), k, l, m, and r.

Referenced by compute_stats(), compute_stats(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ compute_tree()

template<class Node , typename Key >
static Node * Aleph::compute_tree ( Key  keys[],
DynArray< int > &  tree,
const size_t  n,
const size_t  i,
const size_t  j 
)
inlinestatic

Recursively construct the optimal BST from the tree matrix.

Template Parameters
NodeBinary tree node type (must have NullPtr, LLINK, RLINK).
KeyKey type stored in nodes.
Parameters
[in]keysArray of keys (0-indexed).
[in]treeMatrix of optimal root indices.
[in]nTotal number of keys.
[in]iStart index of current subproblem.
[in]jEnd index of current subproblem.
Returns
Root of the constructed subtree.

Definition at line 155 of file opBinTree.H.

References keys, LLINK, RLINK, root(), and ROOT_OF.

◆ concat() [1/2]

template<class... Args>
std::string Aleph::concat ( const Args &...  args)
inline

Concatenate multiple arguments into a single std::string.

When all arguments are string-like (std::string, std::string_view, const char *, char), the result is pre-sized with a single heap allocation, and pieces are appended directly — no locale overhead.

For mixed arguments (numeric, streamable types), each piece is converted individually via std::to_string (arithmetic) or a single-shot ostringstream (exotic types), then the total size is computed and the result is assembled in one allocation.

Template Parameters
ArgsTypes that are either string-like or streamable to std::ostream.
Parameters
[in]argsValues to concatenate.
Returns
Concatenated std::string.

Definition at line 213 of file ah-string-utils.H.

References and, Aleph::concat_detail::append_to(), Aleph::concat_detail::piece_size(), and Aleph::concat_detail::stringify().

Referenced by demo_folding(), demo_joining(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ concat() [2/2]

template<class C1 , class C2 >
DynList< typename C1::Item_Type > Aleph::concat ( const C1 &  c1,
const C2 &  c2 
)
inline

Concatenate two containers into a new DynList.

Parameters
c1First container.
c2Second container.
Returns
DynList with elements of c1 followed by elements of c2.

Definition at line 2403 of file ahFunctional.H.

References Aleph::DynList< T >::append().

◆ const_view()

template<AlephGraph GT>
void Aleph::const_view ( const GT &&  )
delete

A view of a temporary graph would dangle.

◆ containers_eq()

template<class C1 , class C2 , class Eq >
bool Aleph::containers_eq ( const C1 &  c1,
const C2 &  c2,
Eq  e 
)
inline

See eq.

Definition at line 1250 of file ahFunctional.H.

References eq().

Referenced by TEST_F().

◆ contains() [1/2]

template<class Container >
bool Aleph::contains ( const Container &  container,
const typename Container::Item_Type &  value 
)
inline

Check if container contains a specific value.

Parameters
containerSource container.
valueValue to search for.
Returns
true if value is found.

Definition at line 2742 of file ahFunctional.H.

References value.

◆ contains() [2/2]

bool Aleph::contains ( const std::string_view &  str,
const std::string_view &  substr 
)
inline

Check if substr appears inside str.

Parameters
[in]strHaystack.
[in]substrNeedle.
Returns
true if substr is a substring of str.

Definition at line 270 of file ah-string-utils.H.

Referenced by demo_predicates(), demo_validation(), Aleph::SweepLineSegmentIntersection::operator()(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_DynSet(), and test_DynSetLinHash().

◆ contiguous_range()

template<typename T = int, template< typename > class Container = DynList>
Container< T > Aleph::contiguous_range ( T  start,
const size_t  n 
)
inline

Generate n contiguous values starting from start.

Creates a sequence of consecutive values: start, start+1, start+2, ..., start+n-1.

Template Parameters
TNumeric type (must support increment operator).
ContainerContainer type (defaults to DynList).
Parameters
startStarting value.
nNumber of values to generate.
Returns
Container with n consecutive values.
Example:
auto seq = contiguous_range(5, 4); // {5, 6, 7, 8}
auto zeros = contiguous_range(0, 3); // {0, 1, 2}
Container< T > contiguous_range(T start, const size_t n)
Generate n contiguous values starting from start.
See also
range() for generating ranges with custom step.

Definition at line 382 of file ahFunctional.H.

Referenced by demo_ranges(), and TEST().

◆ copy()

template<class Itor1 , class Itor2 >
Itor2 Aleph::copy ( Itor1  sourceBeg,
const Itor1 &  sourceEnd,
Itor2  destBeg 
)
inline

Copy elements from one range to another.

Copies elements from [sourceBeg, sourceEnd) to the range starting at destBeg.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
Returns
Iterator past the last copied element in destination.

Definition at line 584 of file ahAlgo.H.

Referenced by Aleph::Johnson< GT, Distance, Ait, NAit, SA >::Johnson(), Aleph::DynList< T >::append(), Aleph::PersistentVector< T >::clear_rec(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::clone_node(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::clone_node(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::clone_node(), Aleph::Euclidian_Graph< __Euclidian_Node, __Euclidian_Arc >::copy_from(), Moved_From_Case< F::ISTFTProcessor >::fingerprint(), Moved_From_Case< F::LFilter >::fingerprint(), Moved_From_Case< F::SOSFilter >::fingerprint(), Moved_From_Case< F::STFTProcessor >::fingerprint(), Aleph::interval_tree_detail::Pending_Max< T, false >::give(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::insert(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_nonfull(), main(), Aleph::Compute_Cut_Nodes< GT, SA >::map_subgraph(), merge(), merge(), adaptive_huffman_demo::next_code(), Aleph::ArrayQueue< T >::operator=(), Aleph::DynArray< T >::operator=(), Aleph::DynSetTree< Key, Tree, Compare >::operator=(), Aleph::Euclidian_Graph< __Euclidian_Node, __Euclidian_Arc >::operator=(), Aleph::MemArray< T >::operator=(), rotate_copy(), Aleph::interval_tree_detail::Pending_Max< T, false >::set(), Aleph::PersistentVector< T >::set_rec(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_copy_constructor(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Cuckoo_Filter_Case< Filter >::use(), Quotient_Filter_Case< Filter >::use(), Aleph::Johnson< GT, Distance, Ait, NAit, SA >::write_info(), and Aleph::Johnson< GT, Distance, Ait, NAit, SA >::write_info().

◆ copy_backward()

template<class Itor1 , class Itor2 >
Itor2 Aleph::copy_backward ( const Itor1 &  sourceBeg,
Itor1  sourceEnd,
Itor2  destEnd 
)
inline

Copy elements backward from one range to another.

Copies elements from [sourceBeg, sourceEnd) to the range ending at destEnd, copying from back to front.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destEndIterator past the last destination position.
Returns
Iterator to the first copied element in destination.

Definition at line 607 of file ahAlgo.H.

Referenced by TEST().

◆ correlation()

template<typename Container1 , typename Container2 >
auto Aleph::correlation ( const Container1 &  x,
const Container2 &  y 
) -> std::decay_t<decltype(*std::begin(x))>

Compute Pearson correlation coefficient.

Returns a value in [-1, 1]:

  • +1: Perfect positive correlation
  • 0: No correlation
  • -1: Perfect negative correlation
Template Parameters
Container1First container type
Container2Second container type
Parameters
xFirst dataset
ySecond dataset
Returns
Correlation coefficient
Exceptions
std::invalid_argumentif containers have different sizes or constant values

Definition at line 688 of file stat_utils.H.

References ah_invalid_argument_if, correlation(), covariance(), stddev(), and y.

Referenced by correlation(), TEST(), TEST(), TEST(), and TEST().

◆ cosinus()

Geom_Number Aleph::cosinus ( const Geom_Number &  x)
inline

Cosine of x (wrapper over mpfr).

Definition at line 191 of file point.H.

References cos().

Referenced by Aleph::Point::rotate(), Aleph::Ellipse::sample(), Aleph::RotatedEllipse::sample(), and TEST().

◆ count()

template<class Itor , class T >
Itor::difference_type Aleph::count ( const Itor &  beg,
const Itor &  end,
const T &  value 
)
inline

Count elements equal to a value.

Counts the number of elements in the range [beg, end) that are equal to the specified value.

Template Parameters
ItorIterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to compare against.
Returns
The number of elements equal to value.

Definition at line 127 of file ahAlgo.H.

References bind2nd(), count_if(), and value.

Referenced by __depth_first_traversal(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::_count_active_vars(), Aleph::SmallVector< T, N >::append_range(), Aleph::Assign_Sum_Policy< T >::apply(), Aleph::Add_Sum_Policy< T >::apply(), HashAvalancheTest::bitDifference(), HashStats< HashTbl >::bucket_length(), Aleph::Bounded_Cycle_Index< GT >::build(), build_gray_code(), build_subgraph(), check(), Aleph::FunctionalMixin< Derived, Type >::chunk(), Aleph::OLhashTable< Key, Cmp >::cleanup_deleted_chain(), TimeoutQueue::clear_all(), Aleph::Unconnected_Components< GT, SA >::compute_blocks(), Aleph::Unconnected_Components< GT, SA >::compute_lists(), Aleph::DynArray< T >::const_traverse(), Aleph::detail::copy_file_contents(), count_active_trapezoids(), Aleph::Const_Graph_View< GT >::count_arcs(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::count_demand_nodes(), count_elements(), count_if(), Aleph::FunctionalMixin< Derived, Type >::count_if(), Aleph::Const_Graph_View< GT >::count_nodes(), RandomTreeTest::count_nodes(), Aleph::FFT< Real >::count_non_empty_real_batch(), Aleph::Network_Simplex< Net >::count_non_tree_partial_arcs(), Aleph::Compiler_Bytecode_Interpreter_Detail::count_parameters(), Aleph::Compiler_Backend_C_Detail::count_parameters(), count_ready(), Aleph::Gen_Polynomial< Coefficient >::count_real_roots(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::count_supply_nodes(), count_total_nodes(), Aleph::PersistentVector< T >::count_values_rec(), Aleph::sort_utils_detail::counting_sort_impl(), Aleph::sort_utils_detail::counting_sort_impl(), Aleph::sort_utils_detail::counting_sort_impl(), Aleph::sort_utils_detail::counting_sort_impl(), counting_sort_indices(), csv_count_empty(), csv_count_if(), demo_log_buffer(), demo_permutations(), demo_practical(), demo_statistics(), demo_structured_data(), demo_survey_design(), demo_text_processor(), Aleph::in_arcs_detail::digraph_in_degree(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::dirty_page_count(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::dirty_page_count(), Aleph::FFT< Real >::drop_prefix(), Aleph::TestVisual::emit_case_svg(), Aleph::Adaptive_Huffman_Encoder::encode(), Aleph::subset_sum_detail::enumerate_sums(), Aleph::CA::Hashlife_Engine::evolve_level_2(), example_channels_and_shared_state(), example_variadic_zip(), Graph_Traverse< GT, Itor, Q, Show_Arc >::exec(), Aleph::NTT< MOD, ROOT >::Plan::for_each_index(), graph_harness::for_each_simple_graph(), graph_harness::for_each_spec(), QueueTheadsPool< T >::ConsumerQueueEvent::get_count(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::has_cycle(), in_degree(), in_degree(), inconnected_components(), QueueTheadsPool< T >::ConsumerQueueEvent::increment_count(), Aleph::Compiler_Backend_C_Detail::indent(), Aleph::Segment::intersection_with(), is_multimodal(), is_simple_graph(), Aleph::detail::PersistentTreapNodeOps< Node, Key, Compare >::is_valid_under(), least_nanoseconds(), Aleph::FunctionalMixin< Derived, Type >::length(), LLVMFuzzerTestOneInput(), main(), main(), Aleph::Compiler_Dataflow_Detail::make_bit_set(), Aleph::Compiler_Dataflow_Detail::make_constant_vector(), Aleph::NTT< MOD, ROOT >::make_product_tree_storage(), Aleph::CA::ca_checkpoint_detail::make_tmp_path(), max_flow_min_cost_by_cycle_canceling(), Aleph::CA::Bench::measure(), Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::minimum_cut_phase(), mode(), Aleph::DynArray< T >::mutable_traverse(), Aleph::FFT< Real >::ISTFTProcessor::normalize_prefix(), Graph_Traverse< GT, Itor, Q, Show_Arc >::operator()(), operator<<(), out_degree(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), path_edge_count(), perm_count(), Aleph::FFT< Real >::pole_zero_pairs_impl(), Aleph::FixedStack< T >::popn(), DlinkListOperationsTest::populateList(), pzip_count_if_n(), Aleph::sort_utils_detail::radix_sort_impl(), Aleph::sort_utils_detail::radix_sort_impl(), Aleph::detail::ranges_count_if(), Aleph::Compiler_Bytecode_Interpreter_Detail::reset_values(), Aleph::Compiler_Dataflow_Bit_Set::resize(), Aleph::HTList::reverse(), sample_tree(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::scc_by_len(), Aleph::ODhashTable< Key, Cmp >::search(), search(), search_n(), sequential_groups(), Aleph::StlZipView< Containers >::size(), Aleph::UniZipView< Containers >::size(), Aleph::HTList::size(), adaptive_huffman_demo::snapshot(), Aleph::HTList::split_list(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_pos(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::split_pos(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos_inorder(), Aleph::ODhashTable< Key, Cmp >::stats(), Aleph::OLhashTable< Key, Cmp >::stats(), stl_count(), stl_count_value(), stl_drop(), stl_take(), stl_take_last(), stl_zip_count(), stl_zip_length(), stl_zip_take(), subset_sum_count(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), test_hash_table(), Aleph::FFT< Real >::transform_stft_frames(), Aleph::Graph_Traverse_Generator< GT, Itor, Q, Show_Arc >::traverse(), Aleph::Gen_Link_Cut_Tree< T, Monoid, LazyTag >::tree_size(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Aleph::OLhashTable< Key, Cmp >::undo_allocate_bucket(), uni_count(), uni_drop(), uni_length(), uni_take(), uni_zip_count(), uni_zip_length(), uni_zip_take(), unique_sequential(), Aleph::Count_Min_Sketch< T, CounterT >::update(), Moved_From_Case< DynArrayHeap< int > >::use(), Moved_From_Case< DynSkipList< int > >::use(), Moved_From_Case< Random_Set< int > >::use(), Aleph::FFT< Real >::LFilterBank::validate_channel_count(), Aleph::FFT< Real >::SOSFilterBank::validate_channel_count(), Aleph::FFT< Real >::OverlapAddBank::validate_channel_count(), verify(), Aleph::PersistentHashMap< Key, T, Cmp >::verify(), Aleph::PersistentTreapSet< Key, Compare >::verify(), Aleph::PersistentTreapMap< Key, T, Compare >::verify(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::verify(), Aleph::PersistentVector< T >::verify(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::verify_rec(), Aleph::detail::PersistentTreapNodeOps< Node, Key, Compare >::verify_rec(), Aleph::PersistentHashMap< Key, T, Cmp >::verify_rec(), write_avl(), write_bin(), Aleph::CA::Reproductions::write_histogram_csv(), write_rb(), write_splay(), write_treap(), zip_count(), zip_length(), and zip_take().

◆ count_if() [1/2]

template<class Container , class Pred >
requires PredicateWith<Pred &, functional_detail::get_curr_t<Container>>
size_t Aleph::count_if ( const Container &  container,
Pred  pred 
)
inline

Count elements satisfying a predicate.

Parameters
containerSource container.
predPredicate to test.
Returns
Number of elements satisfying pred.

Definition at line 2624 of file ahFunctional.H.

References count(), and pred.

◆ count_if() [2/2]

template<class Itor , class Operation >
Itor::difference_type Aleph::count_if ( Itor  beg,
const Itor &  end,
Operation  op 
)
inline

Count elements satisfying a predicate.

Counts the number of elements in the range [beg, end) for which the predicate op returns true.

Template Parameters
ItorIterator type.
OperationPredicate type.
Parameters
begIterator to the first element.
endIterator past the last element.
opUnary predicate to test elements.
Returns
The number of elements satisfying the predicate.

Definition at line 100 of file ahAlgo.H.

Referenced by count(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST_P().

◆ count_ready()

template<typename T >
size_t Aleph::count_ready ( DynList< std::future< T > > &  future_list)
inline

Count how many futures are ready.

Non-blocking count of futures that have completed.

Template Parameters
TThe result type of the futures.
Parameters
[in,out]future_listList of futures to check.
Returns
Number of futures that are ready.

Definition at line 194 of file future_utils.H.

References count().

Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ counting_sort() [1/6]

template<typename T >
requires CountingSortable<T>
void Aleph::counting_sort ( Array< T > &  a)

Stable counting sort for integral Array values.

Sorts in ascending order by counting frequencies of each distinct integer value in the observed key range [min(a), max(a)].

Template Parameters
TValue type.
Parameters
[in,out]aThe Array to sort.
Exceptions
std::domain_errorif max(a) < min(a).
std::runtime_errorif the key range is too large to fit in size_t.
Complexity
O(n + k) time and O(n + k) extra space, where k = max(a) - min(a) + 1.

Delegate to the shared count-then-place implementation.

Definition at line 5835 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::counting_sort_impl().

◆ counting_sort() [2/6]

template<typename T >
requires CountingSortable<T>
void Aleph::counting_sort ( DynArray< T > &  a)

Stable counting sort for integral DynArray values.

How Counting Sort Works: Instead of comparing elements against each other (like QuickSort or MergeSort), Counting Sort works by counting the exact occurrences of each distinct value. The core idea is:

  1. Find the minimum and maximum values to determine the exact key range.
  2. Allocate a "count" array (buckets) covering this entire range.
  3. Tally the frequencies of each value in the input array.
  4. Perform a prefix sum (cumulative addition) on the counts to determine the exact final starting index for each value.
  5. Iterate the original array backwards, placing each element into its calculated final position. Iterating backwards ensures the sort remains stable (elements with equal keys retain their original relative order).

This algorithm is extremely fast (linear time) when the difference between the maximum and minimum values (the range k) is not excessively large.

Template Parameters
TValue type.
Parameters
[in,out]aThe DynArray to sort.
Exceptions
std::domain_errorif max(a) < min(a).
std::runtime_errorif the key range is too large to fit in size_t.
Complexity
O(n + k) time and O(n + k) extra space, where k = max(a) - min(a) + 1.

Delegate to the shared count-then-place implementation.

Definition at line 5812 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::counting_sort_impl().

Referenced by counting_sort().

◆ counting_sort() [3/6]

template<typename T >
requires CountingSortable<T>
void Aleph::counting_sort ( DynDlist< T > &  list)

Stable counting sort for integral DynDlist values.

This overload performs an in-place value-replacement pass directly into existing list nodes. It preserves stability for plain integral types or when simple value equality semantics suffice. However, user-defined types wrapping keys may not observe true stability (preservation of original object identity and memory locations) because list nodes are not rearranged; only their data is updated.

Template Parameters
TValue type (must satisfy CountingSortable).
Parameters
[in,out]listThe DynDlist to sort.
Exceptions
std::domain_errorif max(list) < min(list).
std::runtime_errorif the key range is too large to fit in size_t.
Note
Internally implemented by counting_sort_impl. If true node-reordering stability for wrapped types is required, use a stable algorithm that rearranges links, such as mergesort.

Delegate to the shared count-then-place implementation.

Definition at line 5889 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::counting_sort_impl().

◆ counting_sort() [4/6]

template<typename T >
requires CountingSortable<T>
void Aleph::counting_sort ( DynList< T > &  list)

Stable counting sort for integral DynList values.

This overload performs an in-place value-replacement pass directly into existing list nodes. It preserves stability for plain integral types or when simple value equality semantics suffice. However, user-defined types wrapping keys may not observe true stability (preservation of original object identity and memory locations) because list nodes are not rearranged; only their data is updated.

Template Parameters
TValue type (must satisfy CountingSortable).
Parameters
[in,out]listThe DynList to sort.
Exceptions
std::domain_errorif max(list) < min(list).
std::runtime_errorif the key range is too large to fit in size_t.
Note
Internally implemented by counting_sort_impl. If true node-reordering stability for wrapped types is required, use a stable algorithm that rearranges links, such as mergesort.

Delegate to the shared count-then-place implementation.

Definition at line 5862 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::counting_sort_impl().

◆ counting_sort() [5/6]

template<typename T >
requires CountingSortable<T>
void Aleph::counting_sort ( T *  a,
const size_t  n 
)

Stable counting sort for raw integral arrays.

Template Parameters
TValue type.
Parameters
[in,out]aPointer to the first element.
[in]nNumber of elements.
Exceptions
std::domain_errorif max(a) < min(a).
std::runtime_errorif the key range is too large to fit in size_t.
std::invalid_argumentif a is null and n > 0.
Complexity
O(n + k) time and O(n + k) extra space, where k = max(a) - min(a) + 1.

Delegate to the shared count-then-place implementation.

Definition at line 5911 of file tpl_sort_utils.H.

References ah_invalid_argument_if, and, and Aleph::sort_utils_detail::counting_sort_impl().

◆ counting_sort() [6/6]

template<typename T , size_t N>
requires CountingSortable<T>
void Aleph::counting_sort ( T(&)  a[N])

Stable counting sort for fixed-size integral C arrays.

Template Parameters
TValue type.
NArray size.
Parameters
[in,out]aThe fixed-size array to sort.
Exceptions
std::domain_errorif max(a) < min(a).
std::runtime_errorif the key range is too large to fit in size_t.

Definition at line 5930 of file tpl_sort_utils.H.

References counting_sort().

◆ counting_sort_indices()

template<typename KeyFn >
requires std::invocable<const KeyFn &, size_t>
and std::convertible_to< std::invoke_result_t< const KeyFn &, size_t >, int > void Aleph::counting_sort_indices ( Array< size_t > &  sa,
Array< size_t > &  tmp,
const size_t  n,
const int  min_key,
const int  max_key,
const KeyFn &  key_of 
)

Stable counting sort on an index array by integer keys.

Reorders sa[0..n-1] so that the elements appear sorted by key_of(sa[i]). Keys must lie in [min_key, max_key].

Template Parameters
KeyFnCallable (size_t) -> int returning the sort key.
Parameters
[in,out]saIndex array to reorder.
[out]tmpScratch array (same size as sa).
[in]nNumber of elements to sort.
[in]min_keyMinimum key value (inclusive).
[in]max_keyMaximum key value (inclusive).
[in]key_ofMaps sa[i] to its integer sort key.
Exceptions
std::domain_errorif max_key < min_key.
std::out_of_rangeif sa.size() < n or tmp.size() < n.
std::runtime_errorif the key range is too large to fit in size_t.
std::out_of_rangeif a computed key is outside [min_key, max_key].
Precondition
sa.size() >= n, tmp.size() >= n.
For all i < n: min_key <= key_of(sa[i]) <= max_key.
Postcondition
sa is stably sorted by key_of.
Note
O(n + k) time and O(k) extra space, where k = max_key - min_key + 1.

Largest range representable without overflowing a size_t index count.

Definition at line 5248 of file tpl_sort_utils.H.

References ah_domain_error_if, ah_out_of_range_error_if, ah_runtime_error_unless, count(), Aleph::Array< T >::create(), k, and Aleph::Array< T >::size().

Referenced by suffix_array().

◆ covariance()

template<typename Container1 , typename Container2 >
auto Aleph::covariance ( const Container1 &  x,
const Container2 &  y,
bool  population = false 
) -> std::decay_t<decltype(*std::begin(x))>

Compute covariance between two datasets.

Template Parameters
Container1First container type
Container2Second container type
Parameters
xFirst dataset
ySecond dataset
populationIf true, population covariance; if false (default), sample covariance
Returns
Covariance
Exceptions
std::invalid_argumentif containers have different sizes or fewer than 2 elements

Definition at line 630 of file stat_utils.H.

References ah_invalid_argument_if, and, covariance(), and y.

Referenced by correlation(), covariance(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ create_residual_arc() [1/2]

template<class Net >
void Aleph::create_residual_arc ( const Net &  net,
PP_Res_Net< Net > &  rnet,
typename Net::Arc *  a 
)
inline

Create residual arcs for a in the residual network.

Definition at line 2152 of file tpl_net.H.

References and, GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), and NODE_COOKIE.

Referenced by build_residual_net(), and preflow_create_residual_net().

◆ create_residual_arc() [2/2]

template<class Res_Net >
Res_Net::Arc * Aleph::create_residual_arc ( Res_Net &  residual_net,
typename Res_Net::Node *  src,
typename Res_Net::Node *  tgt,
const typename Res_Net::Flow_Type  cap,
const typename Res_Net::Flow_Type  flow,
const typename Res_Net::Flow_Type  cost 
)

Create a pair of residual arcs in the residual network.

For each arc in the original network, creates two arcs in the residual network: a forward arc with the same cost and a backward (residual) arc with negative cost.

Template Parameters
Res_NetResidual network type.
Parameters
[in,out]residual_netThe residual network to insert arcs into.
[in]srcSource node in residual network.
[in]tgtTarget node in residual network.
[in]capCapacity of the arc.
[in]flowCurrent flow on the arc.
[in]costCost per unit of flow.
Returns
Pointer to the forward arc.
Precondition
flow <= cap; the cost may be negative

Definition at line 583 of file tpl_netcost.H.

References and.

◆ crt()

uint64_t Aleph::crt ( const Array< uint64_t > &  rem,
const Array< uint64_t > &  mod 
)
inline

Chinese Remainder Theorem (CRT).

Finds a number x such that x = rem[i] (mod mod[i]) for all i. Assumes all moduli are pairwise coprime.

Parameters
remArray of remainders.
modArray of moduli (must be pairwise coprime).
Returns
The solution modulo the product of all moduli.
Exceptions
std::invalid_argumentif input arrays have different sizes.
std::overflow_errorif the product of moduli overflows uint64_t.

Definition at line 478 of file modular_arithmetic.H.

References ah_invalid_argument_if, ah_overflow_error_if, mod_inv(), mod_mul(), and Aleph::Array< T >::size().

Referenced by demo_modular_arithmetic(), and TEST().

◆ csv_add_column()

template<typename Func >
Array< Array< std::string > > Aleph::csv_add_column ( const Array< Array< std::string > > &  rows,
Func  func 
)
inline

Add a new column with computed values.

Template Parameters
FuncFunction type (takes row, returns string).
Parameters
rowsThe CSV data.
funcFunction to compute new column value.
Returns
Data with new column appended.
// Add a "total" column that sums columns 1 and 2
auto with_total = csv_add_column(data, [](const auto& row) {
if (row.size() < 3) return std::string("0");
int a = std::stoi(row(1));
int b = std::stoi(row(2));
return std::to_string(a + b);
});
size_t row
Definition ca-c-api.h:115
Array< Array< std::string > > csv_add_column(const Array< Array< std::string > > &rows, Func func)
Add a new column with computed values.
Definition parse-csv.H:1516

Definition at line 1516 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_add_column(), and rows.

Referenced by csv_add_column(), and TEST_F().

◆ csv_count_empty()

size_t Aleph::csv_count_empty ( const Array< Array< std::string > > &  rows)
inline

Count empty fields in CSV data.

Definition at line 1028 of file parse-csv.H.

References count(), csv_count_empty(), and rows.

Referenced by csv_count_empty(), and TEST_F().

◆ csv_count_if()

template<typename Pred >
size_t Aleph::csv_count_if ( const Array< Array< std::string > > &  rows,
Pred  predicate 
)
inline

Count rows matching a predicate.

Definition at line 1042 of file parse-csv.H.

References count(), csv_count_if(), and rows.

Referenced by csv_count_if(), and TEST_F().

◆ csv_count_rows()

size_t Aleph::csv_count_rows ( const Array< Array< std::string > > &  rows)
inline

Count total number of rows.

Definition at line 1020 of file parse-csv.H.

References csv_count_rows(), and rows.

Referenced by csv_count_rows(), and TEST_F().

◆ csv_distinct()

Array< std::string > Aleph::csv_distinct ( const Array< Array< std::string > > &  rows,
size_t  col_index 
)
inline

Get distinct values in a column.

Definition at line 1083 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_distinct(), rows, Aleph::Array< T >::size(), and size().

Referenced by csv_distinct(), csv_group_by(), and TEST_F().

◆ csv_escape()

std::string Aleph::csv_escape ( const std::string &  field,
char  delimiter = ',' 
)
inline

Escape a string for CSV output.

If the input string contains the delimiter, double quotes, or newlines, the string is enclosed in double quotes and internal quotes are escaped by doubling them.

Parameters
fieldThe string to escape.
delimiterThe field delimiter character (default: comma).
Returns
The escaped string, ready for CSV output.
csv_escape("hello") // "hello" (no change)
csv_escape("hello, world") // "\"hello, world\"" (quoted due to comma)
csv_escape("say \"hi\"") // "\"say \"\"hi\"\"\"" (quotes escaped)
csv_escape("line1\nline2") // "\"line1\nline2\"" (quoted due to newline)
static auto hello
Definition btreepic.C:2148
std::string csv_escape(const std::string &field, char delimiter=',')
Escape a string for CSV output.
Definition parse-csv.H:321
See also
csv_write_row()

Definition at line 321 of file parse-csv.H.

References csv_escape().

Referenced by csv_escape(), csv_write_row(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_fill_empty()

Array< Array< std::string > > Aleph::csv_fill_empty ( const Array< Array< std::string > > &  rows,
const std::string &  default_value 
)
inline

Replace empty fields with a default value.

Parameters
rowsThe CSV data.
default_valueValue to use for empty fields.
Returns
Data with empty fields replaced.

Definition at line 1352 of file parse-csv.H.

References csv_fill_empty(), csv_transform(), and rows.

Referenced by csv_fill_empty(), and TEST_F().

◆ csv_filter()

template<typename Pred >
Array< Array< std::string > > Aleph::csv_filter ( const Array< Array< std::string > > &  rows,
Pred  predicate 
)
inline

Filter CSV rows by a predicate.

Returns only rows for which the predicate returns true.

Template Parameters
PredPredicate type (callable taking const Array<std::string>&).
Parameters
rowsThe CSV data.
predicateFunction returning true for rows to keep.
Returns
Filtered rows.
auto data = csv_read_file("data.csv");
// Keep only rows where column 1 == "active"
auto active = csv_filter(data, [](const auto& row) {
return row.size() > 1 && row(1) == "active";
});
Array< Array< std::string > > csv_read_file(const std::string &filename, char delimiter=',')
Read all rows from a CSV file.
Definition parse-csv.H:291
Array< Array< std::string > > csv_filter(const Array< Array< std::string > > &rows, Pred predicate)
Filter CSV rows by a predicate.
Definition parse-csv.H:906

Definition at line 906 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_filter(), and rows.

Referenced by csv_filter(), csv_filter_by_value(), main(), and TEST_F().

◆ csv_filter_by_value()

Array< Array< std::string > > Aleph::csv_filter_by_value ( const Array< Array< std::string > > &  rows,
size_t  col_index,
const std::string &  value 
)
inline

Filter CSV rows by column value.

Returns rows where the specified column equals the given value.

Parameters
rowsThe CSV data.
col_indexColumn index to check.
valueValue to match.
Returns
Filtered rows.

Definition at line 927 of file parse-csv.H.

References and, csv_filter(), csv_filter_by_value(), row, rows, and value.

Referenced by csv_filter_by_value(), and TEST_F().

◆ csv_find_by_value()

size_t Aleph::csv_find_by_value ( const Array< Array< std::string > > &  rows,
size_t  col_index,
const std::string &  value 
)
inline

Find row where column equals value.

Returns
Index of first matching row, or rows.size() if not found.

Definition at line 1070 of file parse-csv.H.

References and, csv_find_by_value(), csv_find_row(), row, rows, and value.

Referenced by csv_find_by_value(), TEST_F(), and TEST_F().

◆ csv_find_row()

template<typename Pred >
size_t Aleph::csv_find_row ( const Array< Array< std::string > > &  rows,
Pred  predicate 
)
inline

Find first row matching a predicate.

Returns
Index of first matching row, or rows.size() if not found.

Definition at line 1057 of file parse-csv.H.

References csv_find_row(), and rows.

Referenced by csv_find_by_value(), csv_find_row(), and TEST_F().

◆ csv_get_column()

Array< std::string > Aleph::csv_get_column ( const Array< Array< std::string > > &  rows,
size_t  col_index 
)
inline

Get a column from CSV data.

Extracts all values from a specific column across all rows.

Parameters
rowsAn Array of row Arrays.
col_indexThe column index (0-based).
Returns
An Array containing the values of the specified column.
Exceptions
std::out_of_rangeIf col_index is out of bounds for any row.
// CSV: "name,age\nAlice,30\nBob,25"
// names = ["name", "Alice", "Bob"]
Array< std::string > csv_get_column(const Array< Array< std::string > > &rows, size_t col_index)
Get a column from CSV data.
Definition parse-csv.H:498
Array< Array< std::string > > csv_read_all(std::istream &in, char delimiter=',')
Read all rows from a CSV input stream.
Definition parse-csv.H:254

Definition at line 498 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_get_column(), rows, and size().

Referenced by csv_get_column(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_group_by()

Array< Array< Array< std::string > > > Aleph::csv_group_by ( const Array< Array< std::string > > &  rows,
size_t  col_index 
)
inline

Group rows by a column value.

Parameters
rowsThe CSV data.
col_indexColumn to group by.
Returns
Array of groups, each containing rows with the same value.

Definition at line 1477 of file parse-csv.H.

References and, Aleph::Array< T >::append(), csv_distinct(), csv_group_by(), k, keys, rows, and size().

Referenced by csv_group_by(), and TEST_F().

◆ csv_inner_join()

Array< Array< std::string > > Aleph::csv_inner_join ( const Array< Array< std::string > > &  left,
size_t  left_key_col,
const Array< Array< std::string > > &  right,
size_t  right_key_col 
)
inline

Inner join two CSV datasets by a key column.

Parameters
leftFirst dataset.
left_key_colKey column index in left dataset.
rightSecond dataset.
right_key_colKey column index in right dataset.
Returns
Joined dataset (only matching rows).

Definition at line 1432 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_inner_join(), k, and size().

Referenced by csv_inner_join(), and TEST_F().

◆ csv_is_rectangular()

bool Aleph::csv_is_rectangular ( const Array< Array< std::string > > &  rows)
inline

Check if all rows have the same number of columns.

Validates that a CSV dataset is rectangular (all rows have the same number of columns).

Parameters
rowsAn Array of row Arrays.
Returns
True if all rows have the same number of columns, or if the array is empty.
if (not csv_is_rectangular(data))
std::cerr << "Warning: CSV has inconsistent row lengths\n";
bool csv_is_rectangular(const Array< Array< std::string > > &rows)
Check if all rows have the same number of columns.
Definition parse-csv.H:467

Definition at line 467 of file parse-csv.H.

References csv_is_rectangular(), rows, and size().

Referenced by csv_is_rectangular(), csv_transpose(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_join_horizontal()

Array< Array< std::string > > Aleph::csv_join_horizontal ( const Array< Array< std::string > > &  left,
const Array< Array< std::string > > &  right 
)
inline

Join two CSV datasets horizontally (add columns).

Parameters
leftFirst dataset.
rightSecond dataset.
Returns
Combined dataset with columns from both.
Note
Rows are matched by index. If datasets have different numbers of rows, the result has the maximum number of rows.

Definition at line 1372 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_join_horizontal(), and Aleph::Array< T >::size().

Referenced by csv_join_horizontal(), and TEST_F().

◆ csv_join_vertical()

Array< Array< std::string > > Aleph::csv_join_vertical ( const Array< Array< std::string > > &  top,
const Array< Array< std::string > > &  bottom 
)
inline

Join two CSV datasets vertically (add rows).

Parameters
topFirst dataset.
bottomSecond dataset.
Returns
Combined dataset with rows from both.

Definition at line 1407 of file parse-csv.H.

References Aleph::Array< T >::append(), and csv_join_vertical().

Referenced by csv_join_vertical(), and TEST_F().

◆ csv_num_columns()

size_t Aleph::csv_num_columns ( const Array< std::string > &  row)
inline

Get the number of columns in a CSV row.

Returns the number of fields in the given row.

Parameters
rowA CSV row.
Returns
Number of fields.

Definition at line 445 of file parse-csv.H.

References csv_num_columns(), and row.

Referenced by csv_num_columns(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_read_all()

Array< Array< std::string > > Aleph::csv_read_all ( std::istream &  in,
char  delimiter = ',' 
)
inline

Read all rows from a CSV input stream.

Reads all remaining rows from the input stream and returns them as an array of arrays.

Parameters
inThe input stream to read from.
delimiterThe field delimiter character (default: comma).
Returns
An Array of row Arrays, where each inner Array contains the fields of one row.
std::istringstream ss("a,b,c\n1,2,3\n4,5,6");
// data.size() == 3
// data(0) = ["a", "b", "c"]
// data(1) = ["1", "2", "3"]
// data(2) = ["4", "5", "6"]
See also
csv_read_row()

Definition at line 254 of file parse-csv.H.

References and, Aleph::Array< T >::append(), csv_read_all(), csv_read_row(), and row.

Referenced by csv_read_all(), csv_read_file(), main(), CsvFilterTest::SetUp(), CsvStatisticsTest::SetUp(), CsvTransformationTest::SetUp(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_read_file()

Array< Array< std::string > > Aleph::csv_read_file ( const std::string &  filename,
char  delimiter = ',' 
)
inline

Read all rows from a CSV file.

Opens the specified file and reads all CSV rows from it.

Parameters
filenamePath to the CSV file.
delimiterThe field delimiter character (default: comma).
Returns
An Array of row Arrays.
Exceptions
std::runtime_errorIf the file cannot be opened.
for (size_t i = 0; i < data.size(); ++i)
{
const Array<std::string> & row = data(i);
// Process row...
}
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
Definition tpl_array.H:450
See also
csv_read_all()

Definition at line 291 of file parse-csv.H.

References csv_read_all(), csv_read_file(), and file.

Referenced by csv_read_file(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_read_row() [1/2]

Array< std::string > Aleph::csv_read_row ( const std::string &  line,
char  delimiter = ',' 
)
inline

Read a single CSV row from a string.

Convenience overload that parses a CSV row from a string instead of a stream.

Parameters
lineThe string containing the CSV row.
delimiterThe field delimiter character.
Returns
An Array of strings, one for each field in the row.
std::string line = "apple,banana,\"cherry, fresh\"";
Array<std::string> fields = csv_read_row(line, ',');
// fields = ["apple", "banana", "cherry, fresh"]
Array< std::string > csv_read_row(std::istream &in, char delimiter=',')
Read a single CSV row from an input stream.
Definition parse-csv.H:159
See also
csv_read_row(std::istream &, char)

Definition at line 225 of file parse-csv.H.

References csv_read_row().

◆ csv_read_row() [2/2]

Array< std::string > Aleph::csv_read_row ( std::istream &  in,
char  delimiter = ',' 
)
inline

Read a single CSV row from an input stream.

Parses one row of CSV data from the given input stream. The function handles:

  • Quoted fields (enclosed in double quotes).
  • Escaped quotes (double double-quotes: "" becomes ").
  • Fields containing the delimiter character.
  • Both CRLF and LF line endings.
Parameters
inThe input stream to read from.
delimiterThe field delimiter character (default: comma).
Returns
An Array of strings, one for each field in the row. Returns an empty array if the stream is at EOF.
Note
The function advances the stream position past the end of the row (including the newline character).

Example: reading two CSV rows from a stream.

See also
csv_read_row(std::string &, char)
csv_read_all()

Definition at line 159 of file parse-csv.H.

References and, Aleph::Array< T >::append(), csv_read_row(), and row.

Referenced by csv_read_all(), csv_read_row(), csv_read_row(), LLVMFuzzerTestOneInput(), Aleph::CsvReader::next(), Aleph::CsvReader::next_row(), Aleph::CsvReader::read_header(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_rename_column()

Array< Array< std::string > > Aleph::csv_rename_column ( const Array< Array< std::string > > &  rows,
const std::string &  old_name,
const std::string &  new_name 
)
inline

Rename a column (in the header row).

Parameters
rowsThe CSV data (first row is header).
old_nameCurrent column name.
new_nameNew column name.
Returns
Data with renamed column.

Definition at line 1543 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_rename_column(), and rows.

Referenced by csv_rename_column(), and TEST_F().

◆ csv_select_columns()

Array< Array< std::string > > Aleph::csv_select_columns ( const Array< Array< std::string > > &  rows,
const Array< size_t > &  col_indices 
)
inline

Select specific columns from CSV data.

Parameters
rowsThe CSV data.
col_indicesIndices of columns to select.
Returns
Data with only the selected columns.
auto data = csv_read_file("data.csv");
cols.append(0); // First column
cols.append(2); // Third column
auto selected = csv_select_columns(data, cols);
size_t cols
Definition ca-c-api.h:105
T & append(const T &data)
Append a copy of data
Definition tpl_array.H:331
Array< Array< std::string > > csv_select_columns(const Array< Array< std::string > > &rows, const Array< size_t > &col_indices)
Select specific columns from CSV data.
Definition parse-csv.H:953

Definition at line 953 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_select_columns(), rows, Aleph::Array< T >::size(), and size().

Referenced by csv_select_columns(), and TEST_F().

◆ csv_skip_bom()

bool Aleph::csv_skip_bom ( std::istream &  in)
inline

Skip UTF-8 BOM if present.

Checks for and skips the UTF-8 Byte Order Mark (EF BB BF) at the beginning of a stream. A stream that does not start with it keeps all its bytes, however short it is.

Parameters
inThe input stream.
Returns
True if BOM was found and skipped.

Definition at line 1298 of file parse-csv.H.

References and, and csv_skip_bom().

Referenced by csv_skip_bom(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_skip_rows()

Array< Array< std::string > > Aleph::csv_skip_rows ( const Array< Array< std::string > > &  rows,
size_t  n 
)
inline

Skip the first N rows of CSV data.

Parameters
rowsThe CSV data.
nNumber of rows to skip.
Returns
Data without the first N rows.

Definition at line 984 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_skip_rows(), and rows.

Referenced by csv_skip_rows(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_sort_by_column()

Array< Array< std::string > > Aleph::csv_sort_by_column ( const Array< Array< std::string > > &  rows,
size_t  col_index,
bool  ascending = true 
)
inline

Sort CSV data by a column.

Parameters
rowsThe CSV data.
col_indexColumn to sort by.
ascendingSort in ascending order (default true).
Returns
Sorted data.

Definition at line 1147 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_sort_by_column(), rows, and Aleph::Array< T >::size().

Referenced by csv_sort_by_column(), and TEST_F().

◆ csv_sort_by_column_numeric()

template<typename T >
Array< Array< std::string > > Aleph::csv_sort_by_column_numeric ( const Array< Array< std::string > > &  rows,
size_t  col_index,
bool  ascending = true 
)
inline

Sort CSV data by a column with numeric comparison.

Template Parameters
TNumeric type for comparison.
Parameters
rowsThe CSV data.
col_indexColumn to sort by.
ascendingSort in ascending order (default true).
Returns
Sorted data.

Definition at line 1190 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_sort_by_column_numeric(), rows, and Aleph::Array< T >::size().

Referenced by csv_sort_by_column_numeric().

◆ csv_take_rows()

Array< Array< std::string > > Aleph::csv_take_rows ( const Array< Array< std::string > > &  rows,
size_t  n 
)
inline

Take only the first N rows of CSV data.

Parameters
rowsThe CSV data.
nNumber of rows to take.
Returns
The first N rows.

Definition at line 1002 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_take_rows(), and rows.

Referenced by csv_take_rows(), and TEST_F().

◆ csv_to_number()

template<typename T >
T Aleph::csv_to_number ( const std::string &  field)
inline

Convert a CSV field to a numeric type.

Parses a string field as a numeric value.

Template Parameters
TThe numeric type (int, long, double, etc.).
Parameters
fieldThe string to convert.
Returns
The parsed numeric value.
Exceptions
std::invalid_argumentIf the string cannot be parsed.
std::out_of_rangeIf the value is out of range for the type.
std::string s = "42";
int value = csv_to_number<int>(s); // 42
std::string d = "3.14159";
double pi = csv_to_number<double>(d); // 3.14159
size_t size_t int32_t value
Definition ca-c-api.h:116
int csv_to_number< int >(const std::string &field)
Definition parse-csv.H:549
double csv_to_number< double >(const std::string &field)
Definition parse-csv.H:563

Definition at line 535 of file parse-csv.H.

References csv_to_number(), and value.

Referenced by csv_to_number().

◆ csv_to_number< double >()

template<>
double Aleph::csv_to_number< double > ( const std::string &  field)
inline

Definition at line 563 of file parse-csv.H.

Referenced by TEST(), TEST_F(), and TEST_F().

◆ csv_to_number< float >()

template<>
float Aleph::csv_to_number< float > ( const std::string &  field)
inline

Definition at line 570 of file parse-csv.H.

Referenced by TEST_F().

◆ csv_to_number< int >()

template<>
int Aleph::csv_to_number< int > ( const std::string &  field)
inline

Definition at line 549 of file parse-csv.H.

Referenced by TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_to_number< long >()

template<>
long Aleph::csv_to_number< long > ( const std::string &  field)
inline

Definition at line 556 of file parse-csv.H.

Referenced by TEST_F().

◆ csv_transform()

template<typename Func >
Array< Array< std::string > > Aleph::csv_transform ( const Array< Array< std::string > > &  rows,
Func  func 
)
inline

Apply a transformation to each field.

Template Parameters
FuncTransformation function type.
Parameters
rowsThe CSV data.
funcFunction taking string and returning string.
Returns
Transformed data.

Definition at line 1266 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_transform(), and rows.

Referenced by csv_fill_empty(), csv_transform(), csv_trim_fields(), and TEST_F().

◆ csv_transpose()

Array< Array< std::string > > Aleph::csv_transpose ( const Array< Array< std::string > > &  rows)
inline

Transpose CSV data (swap rows and columns).

Parameters
rowsThe CSV data (must be rectangular).
Returns
Transposed data.
Exceptions
std::runtime_errorIf data is not rectangular.

Definition at line 1114 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_is_rectangular(), csv_transpose(), rows, and Aleph::Array< T >::size().

Referenced by csv_transpose(), and TEST_F().

◆ csv_trim_fields()

Array< Array< std::string > > Aleph::csv_trim_fields ( const Array< Array< std::string > > &  rows)
inline

Trim whitespace from all fields.

Parameters
rowsThe CSV data.
Returns
Data with trimmed fields.

Definition at line 1326 of file parse-csv.H.

References and, csv_transform(), csv_trim_fields(), rows, and trim().

Referenced by csv_trim_fields(), and TEST_F().

◆ csv_unique()

Array< Array< std::string > > Aleph::csv_unique ( const Array< Array< std::string > > &  rows)
inline

Remove duplicate rows.

Parameters
rowsThe CSV data.
Returns
Data with duplicates removed.

Definition at line 1230 of file parse-csv.H.

References Aleph::Array< T >::append(), csv_unique(), equal(), k, rows, Aleph::Array< T >::size(), and size().

Referenced by csv_unique(), and TEST_F().

◆ csv_write_all()

void Aleph::csv_write_all ( std::ostream &  out,
const Array< Array< std::string > > &  rows,
char  delimiter = ',',
const std::string &  line_ending = "\n" 
)
inline

Write multiple CSV rows to an output stream.

Writes all given rows to the output stream.

Parameters
outThe output stream to write to.
rowsAn Array of row Arrays.
delimiterThe field delimiter character (default: comma).
line_endingThe line ending string (default: "\n").
See also
csv_write_row()

Definition at line 403 of file parse-csv.H.

References csv_write_all(), csv_write_row(), out, and rows.

Referenced by csv_write_all(), csv_write_file(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_write_file()

void Aleph::csv_write_file ( const std::string &  filename,
const Array< Array< std::string > > &  rows,
char  delimiter = ',',
const std::string &  line_ending = "\n" 
)
inline

Write CSV data to a file.

Opens the specified file and writes all rows to it.

Parameters
filenamePath to the output file.
rowsAn Array of row Arrays.
delimiterThe field delimiter character (default: comma).
line_endingThe line ending string (default: "\n").
Exceptions
std::runtime_errorIf the file cannot be opened.
See also
csv_write_all()

Definition at line 425 of file parse-csv.H.

References csv_write_all(), csv_write_file(), file, and rows.

Referenced by csv_write_file(), TEST_F(), TEST_F(), and TEST_F().

◆ csv_write_row()

void Aleph::csv_write_row ( std::ostream &  out,
const Array< std::string > &  row,
char  delimiter = ',',
const std::string &  line_ending = "\n" 
)
inline

Write a CSV row to an output stream.

Writes a row of fields to the output stream, properly escaping fields that need quoting.

Parameters
outThe output stream to write to.
rowAn Array of strings representing the fields.
delimiterThe field delimiter character (default: comma).
line_endingThe line ending string (default: "\n").
row.append("Name");
row.append("Description");
row.append("Price");
std::ostringstream out;
// Output: "Name,Description,Price\n"
size_t size_t int32_t * out
Definition ca-c-api.h:120
void csv_write_row(std::ostream &out, const Array< std::string > &row, char delimiter=',', const std::string &line_ending="\n")
Write a CSV row to an output stream.
Definition parse-csv.H:377
See also
csv_escape()
csv_write_all()

Definition at line 377 of file parse-csv.H.

References csv_escape(), csv_write_row(), out, and row.

Referenced by csv_write_all(), csv_write_row(), LLVMFuzzerTestOneInput(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ damerau_levenshtein_distance()

size_t Aleph::damerau_levenshtein_distance ( const std::string_view  a,
const std::string_view  b 
)
inline

Damerau-Levenshtein distance with adjacent transpositions.

This implementation follows the "full" dynamic-programming model using last-seen positions and supports multiple transpositions.

Parameters
[in]aFirst string.
[in]bSecond string.
Returns
Damerau-Levenshtein distance.
Exceptions
None.
Complexity
O(nm) time and O(nm) space.

Definition at line 167 of file String_DP.H.

References j1(), m, Aleph::string_dp_detail::make_zero_matrix(), and OhashCommon< HashTbl, Key >::size().

Referenced by main(), TEST(), TEST(), TEST(), and TEST().

◆ data_to_pair() [1/2]

template<typename Key , typename Data >
const std::pair< Key, Data > * Aleph::data_to_pair ( const Data *  ptr)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 297 of file ahDry.H.

◆ data_to_pair() [2/2]

template<typename Key , typename Data >
std::pair< Key, Data > * Aleph::data_to_pair ( Data *  ptr)

Converts a pointer to Data to a pointer to the containing pair.

Parameters
ptrPointer to the data within a pair
Returns
Pointer to the containing pair

Definition at line 288 of file ahDry.H.

◆ dealloc()

template<class T >
void Aleph::dealloc ( AhArenaAllocator &  arena,
T *  ptr 
)
noexcept

Alias for deallocate (backward compatibility).

Definition at line 501 of file ah-arena.H.

Referenced by TEST().

◆ deallocate() [1/2]

template<class T >
void Aleph::deallocate ( AhArenaAllocator &  arena,
T *  ptr 
)
noexcept

Destruct and deallocate an object from an arena.

Calls the destructor and attempts to reclaim memory (LIFO pattern only).

Template Parameters
TType of object.
Parameters
[in]arenaArena that owns the object.
[in]ptrPointer to object.

Definition at line 494 of file ah-arena.H.

References Aleph::AhArenaAllocator::TEMPLATE.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ deallocate() [2/2]

void Aleph::deallocate ( void *  ptr)
inlinenoexcept

Release memory previously obtained through Aleph allocation helpers.

Parameters
ptrPointer obtained from allocate or allocate_zeroed. Passing nullptr is a no-op (mirrors std::free semantics).

Definition at line 107 of file ahMem.H.

◆ decompose_flow()

template<FlowNetwork Net>
FlowDecomposition< Net > Aleph::decompose_flow ( const Net &  net)

Decompose network flow into paths and cycles.

Given a network with a feasible flow, this function decomposes the flow into a set of source-to-sink paths (and possibly cycles). Each unit of the flow is assigned to exactly one path.

Algorithm

  1. While there exists an arc from source with positive flow: a. Follow arcs with positive flow until reaching sink b. Find minimum flow on the path c. Subtract this flow from all arcs on the path d. Record the path

Properties

  • Number of paths ≤ number of arcs with positive flow
  • Sum of path flows = total flow value
  • Each arc's flow = sum of flows on paths using that arc
Template Parameters
NetNetwork type.
Parameters
netNetwork with a feasible flow. Creates a working copy of flow values for decomposition; the original network flow values remain unchanged.
Returns
FlowDecomposition containing all paths and cycles.
Exceptions
domain_errorIf network is not single source/sink, or if the flow is not conserved at a node between the source and the sink beyond the tolerance of check_node(): a node that receives more than it sends. What a floating flow keeps within that tolerance is a residue of rounding and is left out of the paths.
Example
// ... compute max flow ...
auto decomp = decompose_flow(net);
std::cout << "Flow decomposed into " << decomp.num_paths() << " paths\n";
for (const auto& path : decomp.paths)
std::cout << " Path with flow " << path.flow
<< " using " << path.length() << " arcs\n";
FlowDecomposition< Net > decompose_flow(const Net &net)
Decompose network flow into paths and cycles.
STL namespace.
See also
dinic_maximum_flow

Definition at line 902 of file tpl_maxflow.H.

References ah_domain_error_if, and, Aleph::DynList< T >::append(), Aleph::FlowPath< Net >::arcs, Aleph::FlowCycle< Net >::arcs, Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::FlowDecomposition< Net >::cycles, Aleph::FlowPath< Net >::flow, Aleph::FlowCycle< Net >::flow, Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), LocateFunctions< Container, Type >::get_it(), Aleph::DynList< T >::get_last(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::Net_Graph< NodeT, ArcT >::node_tolerance(), Aleph::FlowPath< Net >::nodes, Aleph::FlowCycle< Net >::nodes, out, Aleph::FlowDecomposition< Net >::paths, remaining_flow(), and Aleph::DynList< T >::size().

Referenced by demonstrate_flow_decomposition(), Aleph::Decompose_Flow< Net >::operator()(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), and TYPED_TEST().

◆ decrease_flow()

template<class Net >
void Aleph::decrease_flow ( Net &  net,
const DynList< Parc< Net > > &  semi_path,
const typename Net::Flow_Type  slack 
)

Decrease flow along a semi-path by a given slack.

This reverses the effect of increase_flow by negating forward/residual arc directions. With a floating type of flow, a flow that rounding leaves next to the capacity of its arc, or next to zero, is set to it.

Parameters
[in,out]netFlow network to update.
[in]semi_pathSemi-path arc list.
[in]slackSlack to apply (not validated).

Definition at line 1796 of file tpl_net.H.

References Aleph::net_detail::add_flow(), and Aleph::net_detail::subtract_flow().

Referenced by TYPED_TEST().

◆ default_pool()

ThreadPool & Aleph::default_pool ( )
inline

Return the default shared thread pool instance.

Global default thread pool.

Returns
A reference to the global thread pool.

A lazily-initialized global thread pool for convenience. Uses hardware concurrency for the number of threads.

Example

auto future = Aleph::default_pool().enqueue(compute_something);
auto enqueue(F &&f, Args &&... args) -> std::future< std::invoke_result_t< F, Args... > >
Submit a task for execution and get a future for the result.
ThreadPool & default_pool()
Return the default shared thread pool instance.
Returns
Reference to the global thread pool.

Definition at line 2524 of file thread_pool.H.

References default_pool().

Referenced by Aleph::TaskGroup::TaskGroup(), default_pool(), main(), parallel_default_pool(), Aleph::parallel_detail::select_pool(), Aleph::parallel_detail::selected_parallel_pool(), Aleph::CA::Parallel_Synchronous_Engine< Lattice, Rule, Neighborhood, Order >::step(), TEST_F(), TEST_F(), and TEST_F().

◆ demangle()

std::string Aleph::demangle ( const char *  name)
inline

Given a linker symbol name generated by a c++ compiler, this functions decodes it into a user level name.

Definition at line 263 of file ahUtils.H.

Referenced by TEST().

◆ depth_first_traversal()

template<AlephGraph GT>
size_t Aleph::depth_first_traversal ( const GT &  g,
bool(*)(const GT &, typename GT::Node *, typename GT::Arc *)  visit 
)
inline

See depth_first_traversal(const GT&, typename GT::Node*, bool (*)(...)).

Definition at line 129 of file tpl_graph_utils.H.

References depth_first_traversal(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::get_first_node().

◆ deque_to_Array()

template<class T >
Array< T > Aleph::deque_to_Array ( const std::deque< T > &  d)

Convert a std::deque to an Array.

Creates a new Array containing copies of all elements from the given std::deque.

Template Parameters
TThe element type.
Parameters
dThe source std::deque.
Returns
An Array containing copies of all elements from d.

Definition at line 366 of file ah-convert.H.

References Aleph::Array< T >::append(), and Aleph::Array< T >::reserve().

Referenced by TEST(), TEST(), and TEST().

◆ deque_to_DynArray()

template<class T >
DynArray< T > Aleph::deque_to_DynArray ( const std::deque< T > &  d)

Convert a std::deque to a DynArray.

Creates a new DynArray containing copies of all elements from the given std::deque.

Template Parameters
TThe element type.
Parameters
dThe source std::deque.
Returns
A DynArray containing copies of all elements from d.

Definition at line 387 of file ah-convert.H.

References Aleph::DynArray< T >::append().

Referenced by TEST(), and TEST().

◆ deque_to_DynList()

template<class T >
DynList< T > Aleph::deque_to_DynList ( const std::deque< T > &  d)

Convert a std::deque to a DynList.

Creates a new DynList containing copies of all elements from the given std::deque.

Template Parameters
TThe element type.
Parameters
dThe source std::deque.
Returns
A DynList containing copies of all elements from d.

Definition at line 346 of file ah-convert.H.

References Aleph::DynList< T >::append().

Referenced by TEST(), and TEST().

◆ design_survey()

SurveyDesignResult Aleph::design_survey ( const std::vector< SurveyQuestion > &  questions,
const std::vector< SurveyRespondent > &  respondents 
)
inline

Design survey assignment using network flow.

Assign respondents to questions such that:

  • Each question gets [min, max] responses
  • Each respondent answers [min, max] questions
  • Respondents only answer eligible questions

The minimums are the lower bounds of a circulation, which solve_circulation() finds. There is none if a minimum is negative or above its maximum.

Parameters
questionsVector of questions with constraints.
respondentsVector of respondents with constraints and eligibility.
Returns
SurveyDesignResult with feasibility and assignments.

Definition at line 890 of file net_apps.H.

References Aleph::SurveyDesignResult::assignments, Aleph::SurveyDesignResult::feasible, Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), r, Aleph::DynMapTree< Key, Data, Tree, Compare >::search(), and solve_circulation().

Referenced by demo_survey_design(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ df()

template<AlephGraph GT>
static long & Aleph::df ( typename GT::Node *  p)
inlinestatic

◆ dft_hash_fct() [1/8]

size_t Aleph::dft_hash_fct ( const char *  key)
inlinenoexcept

Definition at line 1042 of file hash-fct.H.

References wyhash_hash().

◆ dft_hash_fct() [2/8]

size_t Aleph::dft_hash_fct ( const char *  key,
std::uint32_t  seed 
)
inlinenoexcept

Definition at line 1071 of file hash-fct.H.

References seed, and wyhash_hash().

◆ dft_hash_fct() [3/8]

template<typename Key >
requires (not std::is_pointer_v<Key> and not std::is_array_v<Key> and not std::is_same_v<std::remove_cvref_t<Key>, std::string>)
size_t Aleph::dft_hash_fct ( const Key &  key)
inlinenoexcept

Primary default hash: best speed/quality trade-off.

Routes through Aleph_Hash<Key>:

  • ADL path for user types (semantic, O(T::hash))
  • wyhash_hash for trivially-copyable types and strings (64-bit, ~1045 MiB/s)
  • SuperFastHash(&key, sizeof(key)) for pointer keys
  • Compile-time error for unknown non-trivial types
Warning
This dispatch is operationally delicate. Changing the backend for pointers, changing the seeded/secondary path, or changing pair combiners can silently break OLhashTable / ODhashTable / Map*Hash users that depend on stable probe sequences or on consistent hashing across wrapper call paths (dft_hash_fct, dft_hash_ptr_fct, pair_dft_hash_fct, etc.). If you touch this policy, rerun at least: hash_fct_test, hash_statistical_test, hash-it, tree_dp_test, tree_decomposition_test, and cuckoo-filter tests.

Definition at line 1030 of file hash-fct.H.

Referenced by Aleph::Count_Min_Sketch< T, CounterT >::Count_Min_Sketch(), Aleph::MinHash< T >::MinHash(), aleph_hash_value(), UserTypeNS::aleph_hash_value(), dft_hash_ptr_fct(), dft_seed_hash_ptr_fct(), AhHashDispatcher< Key, Operation >::fst_hash(), fst_hast(), Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::get_fingerprint(), Aleph::Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::get_fingerprint(), Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::index_hash(), Aleph::Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::index_hash(), my_hash(), pair_dft_hash_fct(), pair_snd_hash_fct(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ dft_hash_fct() [4/8]

template<typename Key >
requires std::is_pointer_v<Key>
size_t Aleph::dft_hash_fct ( const Key &  key)
inlinenoexcept

Definition at line 1037 of file hash-fct.H.

References SuperFastHash().

◆ dft_hash_fct() [5/8]

template<typename Key >
requires (not std::is_pointer_v<Key> and not std::is_array_v<Key> and not std::is_same_v<std::remove_cvref_t<Key>, std::string>)
size_t Aleph::dft_hash_fct ( const Key &  key,
std::uint32_t  seed 
)
inlinenoexcept

Primary default hash with explicit seed.

Definition at line 1059 of file hash-fct.H.

References seed.

◆ dft_hash_fct() [6/8]

template<typename Key >
requires std::is_pointer_v<Key>
size_t Aleph::dft_hash_fct ( const Key &  key,
std::uint32_t  seed 
)
inlinenoexcept

Definition at line 1066 of file hash-fct.H.

References seed, and SuperFastHash().

◆ dft_hash_fct() [7/8]

size_t Aleph::dft_hash_fct ( const std::string &  key)
inlinenoexcept

Definition at line 1047 of file hash-fct.H.

References wyhash_hash().

◆ dft_hash_fct() [8/8]

size_t Aleph::dft_hash_fct ( const std::string &  key,
std::uint32_t  seed 
)
inlinenoexcept

Definition at line 1076 of file hash-fct.H.

References seed, and wyhash_hash().

◆ dft_hash_ptr_fct()

template<typename Key >
size_t Aleph::dft_hash_ptr_fct ( const Key &  key)
inlinenoexcept

Definition at line 1082 of file hash-fct.H.

References dft_hash_fct().

Referenced by TEST().

◆ dft_seed_hash_ptr_fct()

template<typename Key >
size_t Aleph::dft_seed_hash_ptr_fct ( const Key &  key,
const unsigned long  seed 
)
inlinenoexcept

Definition at line 1088 of file hash-fct.H.

References dft_hash_fct(), and seed.

◆ diff()

template<class C1 , class C2 , class Eq = std::equal_to<typename C1::Item_Type>>
bool Aleph::diff ( const C1 &  c1,
const C2 &  c2,
Eq  e = Eq() 
)
inline

Check if two containers differ.

Complement of eq(). Returns true if containers have different lengths or any corresponding elements differ.

Template Parameters
C1Type of the first container.
C2Type of the second container.
EqEquality predicate type.
Parameters
c1First container.
c2Second container.
eEquality predicate.
Returns
true if containers are not equal.
See also
eq() for equality check.

Definition at line 1364 of file ahFunctional.H.

References eq().

Referenced by Aleph::Test_Eulerian< GT, SN, SA >::analyze_digraph(), Aleph::CA::apply_delta_checkpoint(), HashAvalancheTest::bitDifference(), Aleph::k_shortest_paths_detail::build_suffix_index_digraph(), Aleph::k_shortest_paths_detail::build_suffix_index_with_itor(), Aleph::CA::cell_diff_count(), checked_avl_height(), checked_avl_height_rk(), demo_comparison(), demo_matrix_arithmetic(), demo_vector_arithmetic(), Aleph::LineEq::distance_to(), Aleph::CA::Block_Partition_2D::factor_partitions(), Aleph::patricia_trie_detail::Bitwise_Trie_Utils< UInt >::first_differing_bit(), kurtosis(), Aleph::Gen_Mo_On_Trees< GT, Policy >::lca(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::lca(), main(), Aleph::detail::pollard_rho_step(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::quadratic_split(), quicksort(), Aleph::Net_Graph< NodeT, ArcT >::same_totals(), skewness(), sparse_polynomials(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ dinic_blocked()

template<class Net >
bool & Aleph::dinic_blocked ( typename Net::Node *  p)
inlinenoexcept

Check if a node is blocked in Dinic's algorithm.

Retrieves a reference to the blocked flag stored in the node's cookie.

Template Parameters
NetNetwork type.
Parameters
pPointer to network node.
Returns
Reference to a blocked flag.
Exceptions
none
Note
Complexity: O(1)
Thread safety: Not thread-safe if multiple threads access the same node's cookie.
Exception safety: noexcept

Definition at line 159 of file tpl_maxflow.H.

References NODE_COOKIE.

◆ dinic_blocking_flow()

template<class Net >
Net::Flow_Type Aleph::dinic_blocking_flow ( Net &  net,
typename Net::Node *  source,
typename Net::Node *  sink 
)

Find all blocking flows using iterative DFS with current-arc optimization.

Uses an explicit stack and per-node current-arc indices to find all augmenting paths in the level graph without re-examining dead arcs. After each augmentation, retreats to the node before the bottleneck arc and continues scanning from its current-arc position.

Template Parameters
NetNetwork type.
Parameters
netFlow network.
sourceSource node.
sinkSink node.
Returns
Total blocking flow pushed.
Note
Complexity: O(VE) per blocking flow phase.
Thread safety: Not thread-safe. Modifies arc flows and node cookies.

Definition at line 296 of file tpl_maxflow.H.

References Aleph::net_detail::add_flow(), Aleph::Array< T >::create(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_src_node(), next(), Aleph::net_detail::subtract_flow(), and GraphCommon< GT, Node, Arc >::vsize().

Referenced by dinic_maximum_flow().

◆ dinic_current_arc()

template<class Net >
size_t & Aleph::dinic_current_arc ( typename Net::Node *  p)
inlinenoexcept

Access the current arc index in Dinic's algorithm.

Retrieves a reference to the current_arc field stored in the node's cookie. Used for the current-arc optimization in the iterative blocking flow.

Template Parameters
NetNetwork type.
Parameters
pPointer to network node.
Returns
Reference to the current arc index.
Note
Complexity: O(1)

Definition at line 178 of file tpl_maxflow.H.

References NODE_COOKIE.

◆ dinic_level()

template<class Net >
long & Aleph::dinic_level ( typename Net::Node *  p)
inlinenoexcept

Access the node level in Dinic's algorithm.

Retrieves a reference to the level field stored in the node's cookie.

Template Parameters
NetNetwork type.
Parameters
pPointer to network node.
Returns
Reference to the level value.
Exceptions
none
Note
Complexity: O(1)
Thread safety: Not thread-safe if multiple threads access the same node's cookie.
Exception safety: noexcept

Definition at line 138 of file tpl_maxflow.H.

References NODE_COOKIE.

◆ dinic_maximum_flow()

template<FlowNetwork Net>
Net::Flow_Type Aleph::dinic_maximum_flow ( Net &  net)

Compute maximum flow using Dinic's algorithm.

Dinic's algorithm computes maximum flow by repeatedly:

  1. Building a level graph using BFS
  2. Finding blocking flows using iterative DFS with current-arc optimization

This is more efficient than Ford-Fulkerson for dense graphs.

With a floating flow, the residues of rounding that the blocking flows leave go back at the end, as those of the augmenting paths (see net_detail::return_dust()): every node keeps its flow within the tolerance of check_node(), so that the network simplex takes the flow. An arc of infinite capacity takes flow as any other; a path from the source to the sink of arcs of infinite capacity makes the maximum flow infinite, and the function returns it, as the augmenting paths and the preflows do.

Complexity

  • General graphs: O(V²E)
  • Unit capacity graphs: O(E√V)
  • Bipartite matching: O(E√V)

Algorithm Steps

  1. Build level graph from source using BFS
  2. While sink is reachable in level graph: a. Find blocking flow using DFS b. Augment flow along blocking paths c. Rebuild level graph
Template Parameters
NetNetwork type (must be Net_Graph or compatible).
Parameters
netFlow network with source and sink.
Returns
Maximum flow value.
Exceptions
domain_errorIf network is not single source/sink.
std::bad_allocIf memory allocation fails during algorithm execution.
Note
Complexity: O(V²E) for general graphs, O(E√V) for unit capacity graphs.
Thread safety: Not thread-safe. Modifies network state and node cookies.
Exception safety: Basic guarantee. Network may be partially modified.
Example
// ... build network ...
auto max_flow = dinic_maximum_flow(net);
Net::Flow_Type dinic_maximum_flow(Net &net)
Compute maximum flow using Dinic's algorithm.
See also
ford_fulkerson_maximum_flow
edmonds_karp_maximum_flow

Definition at line 462 of file tpl_maxflow.H.

References ah_domain_error_if, and, build_level_graph(), dinic_blocking_flow(), Aleph::Net_Graph< NodeT, ArcT >::flow_value(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, Aleph::net_detail::return_dust(), and GraphCommon< GT, Node, Arc >::vsize().

Referenced by check_baseball_elimination(), demo_benchmarking(), demo_dot_export(), demo_grid_networks(), demo_json_export(), demo_layered_networks(), demo_random_networks(), main(), Aleph::Dinic_Maximum_Flow< Net >::operator()(), segment_image(), solve_project_selection(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TYPED_TEST().

◆ divide_and_conquer_partition_dp()

template<typename Cost , class Transition_Cost_Fn >
Divide_Conquer_DP_Result< Cost > Aleph::divide_and_conquer_partition_dp ( const size_t  groups,
const size_t  n,
Transition_Cost_Fn  transition_cost,
const Cost  inf = dp_optimization_detail::default_inf<Cost>() 
)
inline

Optimize partition DP using divide-and-conquer optimization.

Computes DP of the form:

dp[g][i] = min_{k < i} (dp[g-1][k] + transition_cost(k, i))
static int * k

for g = 1..groups, i = 0..n, where each partition is non-empty.

Correctness and complexity rely on the monotonicity of argmins: opt[g][i] <= opt[g][i+1].

Template Parameters
CostNumeric DP cost type.
Transition_Cost_FnCallable returning Cost given (k, i).
Parameters
[in]groupsNumber of groups/segments.
[in]nNumber of elements/states in prefix space.
[in]transition_costCost for segment [k, i).
[in]infSentinel for unreachable states.
Returns
Divide_Conquer_DP_Result<Cost> with final optimum, last row, and split table.
Note
Base state is dp[0][0] = 0, dp[0][i>0] = inf.
Complexity: typically O(groups * n * log n) with O(1) transition.

Definition at line 137 of file DP_Optimizations.H.

References Aleph::Array< T >::create(), k, row, split(), and Aleph::Array< T >::swap().

◆ djb_hash() [1/3]

size_t Aleph::djb_hash ( const char *  key)
inlinenoexcept

Definition at line 680 of file hash-fct.H.

References h.

◆ djb_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::djb_hash ( const Key &  key)
inlinenoexcept

Definition at line 565 of file hash-fct.H.

References djb_hash().

◆ djb_hash() [3/3]

size_t Aleph::djb_hash ( const std::string &  key)
inlinenoexcept

Definition at line 801 of file hash-fct.H.

References djb_hash().

◆ dlink_random_search()

template<typename T , class Compare >
Dnode< T > * Aleph::dlink_random_search ( Dlink &  list,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Random search for an element in a dlink list.

dlink_random_search(list,x) uses the algorithm quicksort partition to find element x in the list.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.

The procedure has an expected complexity of \(O(n \; \lg n)\), which is greater than mere search sequential, but with the addition that after the search the list is partially ordered.

Parameters
[in,out]listlist in which the search is performed; is partially modified after the search.
[in]xelement to search for.
cmpcomparison object.
Returns
pointer to the node containing the value x if it is is found within the list; nullptr otherwise.
See also
random_search(Dlink&list,const T&x)

Wraps x in a node so it can be compared via cmp the same way as the list's own nodes.

Definition at line 2803 of file tpl_sort_utils.H.

References Aleph::Dlink::append(), cmp(), Aleph::Dlink::concat_list(), Aleph::Dlink::is_empty(), Aleph::Dlink::remove_next(), and Aleph::Dlink::swap().

◆ dlink_random_select()

template<class Compare >
Dlink * Aleph::dlink_random_select ( Dlink &  list,
const size_t  i,
const Compare &  cmp = Compare() 
)

Random selection of the ith element from a list based on Dlink.

random_select(list,i) returns the ith smallest element content in the list according to order criteria determined by the Compare class.

The routine uses the quicksort partition to search for position i in time \(O(n \; \lg n)\), which It is a substantially better time than the search sequential ( \(O(n^2)\)).

Parameters
[in,out]listthe list to select from (will be partially reordered). The list is left semi-ordered through successive partitions that have been made.
[in]iposition to be accessed (0-based).
cmpComparison functor defining "less than" relationship.
Returns
pointer to Dlink corresponding to position i inside of the list;

Definition at line 3365 of file tpl_sort_utils.H.

References ah_out_of_range_error, Aleph::Dlink::append(), cmp(), Aleph::Dlink::concat_list(), Aleph::Dlink::is_empty(), and Aleph::Dlink::remove_next().

◆ drop_while()

template<class Container , class Pred >
requires PredicateWith<Pred &, functional_detail::get_curr_cref_t<Container>>
DynList< typename Container::Item_Type > Aleph::drop_while ( const Container &  c,
Pred  pred 
)
inline

Skip elements while predicate is true (drop_while).

Parameters
cSource container.
predPredicate to test.
Returns
DynList with remaining elements after predicate becomes false.

Definition at line 2444 of file ahFunctional.H.

References and, Aleph::DynList< T >::append(), and pred.

Referenced by demo_grouping(), TEST(), and TEST().

◆ duration_to_days()

double Aleph::duration_to_days ( const std::chrono::duration< double > &  d)
inline

Definition at line 91 of file ah-chronos-utils.H.

Referenced by TEST().

◆ duration_to_hours()

double Aleph::duration_to_hours ( const std::chrono::duration< double > &  d)
inline

Definition at line 85 of file ah-chronos-utils.H.

Referenced by TEST().

◆ duration_to_microseconds()

double Aleph::duration_to_microseconds ( const std::chrono::duration< double > &  d)
inline

Definition at line 67 of file ah-chronos-utils.H.

Referenced by TEST().

◆ duration_to_milliseconds()

double Aleph::duration_to_milliseconds ( const std::chrono::duration< double > &  d)
inline

Definition at line 61 of file ah-chronos-utils.H.

Referenced by TEST().

◆ duration_to_minutes()

double Aleph::duration_to_minutes ( const std::chrono::duration< double > &  d)
inline

Definition at line 79 of file ah-chronos-utils.H.

Referenced by TEST().

◆ duration_to_nanoseconds()

double Aleph::duration_to_nanoseconds ( const std::chrono::duration< double > &  d)
inline

Definition at line 73 of file ah-chronos-utils.H.

Referenced by TEST().

◆ duration_to_seconds()

double Aleph::duration_to_seconds ( const std::chrono::duration< double > &  d)
inline

Definition at line 55 of file ah-chronos-utils.H.

Referenced by TEST().

◆ dynarray_to_Array()

template<class T >
Array< T > Aleph::dynarray_to_Array ( const DynArray< T > &  a)

Convert a DynArray to an Array.

Creates a new Array containing copies of all elements from the given DynArray.

Template Parameters
TThe element type.
Parameters
aThe source DynArray.
Returns
An Array containing copies of all elements from a.

Definition at line 305 of file ah-convert.H.

References Aleph::Array< T >::append(), and Aleph::DynArray< T >::size().

Referenced by TEST(), and TEST().

◆ dynarray_to_DynDlist()

template<class T >
DynDlist< T > Aleph::dynarray_to_DynDlist ( const DynArray< T > &  a)

Convert a DynArray to a DynDlist.

Creates a new DynDlist containing copies of all elements from the given DynArray.

Template Parameters
TThe element type.
Parameters
aThe source DynArray.
Returns
A DynDlist containing copies of all elements from a.

Definition at line 466 of file ah-convert.H.

References Aleph::DynDlist< T >::append(), and Aleph::DynArray< T >::size().

Referenced by TEST(), TEST(), and TEST().

◆ dynarray_to_DynList()

template<class T >
DynList< T > Aleph::dynarray_to_DynList ( const DynArray< T > &  a)

Convert a DynArray to a DynList.

Creates a new DynList containing copies of all elements from the given DynArray.

Template Parameters
TThe element type.
Parameters
aThe source DynArray.
Returns
A DynList containing copies of all elements from a.

Definition at line 198 of file ah-convert.H.

References Aleph::DynList< T >::append(), and Aleph::DynArray< T >::size().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ DynArray_to_vector()

template<typename T >
std::vector< T > Aleph::DynArray_to_vector ( const DynArray< T > &  arr)
inline

Convert a DynArray to a std::vector.

Uses the operator[] which safely returns the default value for unallocated entries.

Template Parameters
TElement type.
Parameters
arrSource DynArray.
Returns
std::vector containing copies of all elements.

Definition at line 422 of file ah-stl-utils.H.

References Aleph::DynArray< T >::size().

Referenced by demo_vector_dynarray(), TEST(), TEST(), and TEST().

◆ dyndlist_to_DynArray()

template<class T >
DynArray< T > Aleph::dyndlist_to_DynArray ( const DynDlist< T > &  l)

Convert a DynDlist to a DynArray.

Creates a new DynArray containing copies of all elements from the given DynDlist.

Template Parameters
TThe element type.
Parameters
lThe source DynDlist.
Returns
A DynArray containing copies of all elements from l.

Definition at line 447 of file ah-convert.H.

References Aleph::DynArray< T >::append(), FunctionalMethods< Container, T >::for_each(), and l.

Referenced by TEST(), TEST(), and TEST().

◆ dyndlist_to_DynList()

template<class T >
DynList< T > Aleph::dyndlist_to_DynList ( const DynDlist< T > &  l)

Convert a DynDlist to a DynList.

Creates a new DynList containing copies of all elements from the given DynDlist.

Template Parameters
TThe element type.
Parameters
lThe source DynDlist.
Returns
A DynList containing copies of all elements from l.

Definition at line 409 of file ah-convert.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::for_each(), and l.

Referenced by TEST(), and TEST().

◆ dynlist_to_DynArray()

template<class T >
DynArray< T > Aleph::dynlist_to_DynArray ( const DynList< T > &  l)

Convert a DynList to a DynArray.

Creates a new DynArray containing copies of all elements from the given DynList.

Template Parameters
TThe element type.
Parameters
lThe source DynList.
Returns
A DynArray containing copies of all elements from l.

Definition at line 218 of file ah-convert.H.

References Aleph::DynArray< T >::append(), LocateFunctions< Container, Type >::get_it(), and l.

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ dynlist_to_DynDlist()

template<class T >
DynDlist< T > Aleph::dynlist_to_DynDlist ( const DynList< T > &  l)

Convert a DynList to a DynDlist.

Creates a new DynDlist containing copies of all elements from the given DynList.

Template Parameters
TThe element type.
Parameters
lThe source DynList.
Returns
A DynDlist containing copies of all elements from l.

Definition at line 428 of file ah-convert.H.

References Aleph::DynDlist< T >::append(), FunctionalMethods< Container, T >::for_each(), and l.

Referenced by TEST(), and TEST().

◆ DynList_to_list()

template<typename T >
std::list< T > Aleph::DynList_to_list ( const DynList< T > &  l)
inline

Convert a DynList to a std::list.

Template Parameters
TElement type.
Parameters
lSource DynList.
Returns
std::list containing copies of all elements.

Definition at line 402 of file ah-stl-utils.H.

References l.

Referenced by demo_list_dynlist(), TEST(), TEST(), and TEST().

◆ each() [1/4]

template<class Op >
requires CallableWith<Op &>
void Aleph::each ( const size_t  n,
Op &  op 
)

Overload of each.

Definition at line 626 of file ahFunctional.H.

References each().

◆ each() [2/4]

template<class Op >
requires CallableWith<Op &>
void Aleph::each ( const size_t  start,
const size_t  end,
Op &  op 
)

Execute an operation repeatedly over a range of indices.

Calls op() for each index from start to end (inclusive). The operation receives no arguments; this is purely for side effects.

Template Parameters
OpCallable type with signature void().
Parameters
startStarting index (inclusive).
endEnding index (inclusive).
opOperation to execute at each iteration.
Example:
int count = 0;
each(1, 5, [&count]() { ++count; }); // count = 5
void each(const size_t start, const size_t end, Op &op)
Execute an operation repeatedly over a range of indices.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
Definition ahAlgo.H:127

Definition at line 609 of file ahFunctional.H.

Referenced by each(), each(), each(), sublist(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ each() [3/4]

template<class Op >
requires CallableWith<Op &>
void Aleph::each ( size_t  n,
Op &&  op 
)

Overload of each.

Definition at line 636 of file ahFunctional.H.

References each().

◆ each() [4/4]

template<class Op >
requires CallableWith<Op &>
void Aleph::each ( size_t  start,
size_t  end,
Op &&  op 
)

Overload of each.

Definition at line 618 of file ahFunctional.H.

References each().

◆ edit_distance()

size_t Aleph::edit_distance ( const std::string_view  a,
const std::string_view  b 
)
inline

Alias for Levenshtein distance.

Parameters
[in]aFirst string.
[in]bSecond string.
Returns
Edit distance.
Exceptions
None.

Definition at line 147 of file String_DP.H.

References levenshtein_distance().

Referenced by TEST(), and TEST().

◆ edmonds_karp_maximum_flow()

template<class Net >
Net::Flow_Type Aleph::edmonds_karp_maximum_flow ( Net &  net)

Maximize flow using the Edmonds-Karp algorithm.

Parameters
[in,out]netFlow network (must have a single source and sink).
Returns
Maximized flow value.

Definition at line 2336 of file tpl_net.H.

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ elf_hash() [1/3]

size_t Aleph::elf_hash ( const char *  key)
inlinenoexcept

Definition at line 739 of file hash-fct.H.

References h.

◆ elf_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::elf_hash ( const Key &  key)
inlinenoexcept

Definition at line 602 of file hash-fct.H.

References elf_hash().

◆ elf_hash() [3/3]

size_t Aleph::elf_hash ( const std::string &  key)
inlinenoexcept

Definition at line 828 of file hash-fct.H.

References elf_hash().

◆ eliminate_dead_code()

Compiler_Dead_Code_Elimination_Result Aleph::eliminate_dead_code ( const Compiler_IR_Function &  function)
inline

Eliminates unreachable blocks, dead pure instructions, dead local stores, and folds constant-condition branches.

Integer arithmetic that can overflow or divide by zero is not pure: it stays even when its value is dead, since it can stop the program.

Parameters
functionSource IR function; not modified in place.
Returns
Compiler_Dead_Code_Elimination_Result containing the optimised function copy and elimination statistics (removed_blocks, removed_instructions, folded_branches).
Note
Internally calls analyze_dataflow_function(); overall complexity is O(B·S·iter + I) where I is the total instruction count. Not thread-safe.

Definition at line 1409 of file Compiler_Dataflow.H.

References Aleph::DynArray< T >::access(), analyze_dataflow_function(), and, Aleph::DynArray< T >::append(), Aleph::Compiler_IR_Function::blocks, Boolean, Branch, compiler_ir_invalid_id(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_Dataflow_Detail::count_instructions(), Aleph::Compiler_IR_Function::entry_block, Aleph::Compiler_IR_Function::exit_block, Aleph::Compiler_Dead_Code_Elimination_Result::folded_branches, Aleph::Compiler_Dead_Code_Elimination_Result::function, Aleph::Compiler_SSA_Block::instructions, Aleph::Compiler_Dataflow_Detail::is_pure_instruction(), Aleph::Compiler_Dataflow_Detail::is_value_used(), Jump, Load, Aleph::Compiler_IR_Function::local_slots, Aleph::Compiler_Dataflow_Detail::make_bit_set(), Aleph::Compiler_Dataflow_Detail::mark_value_used(), Aleph::Compiler_IR_Function::next_value_id, Aleph::Compiler_Dataflow_Detail::rebuild_predecessors(), Aleph::Compiler_Dead_Code_Elimination_Result::removed_blocks, Aleph::Compiler_Dead_Code_Elimination_Result::removed_instructions, Return, Aleph::Compiler_Dataflow_Detail::simulate_block(), Aleph::DynArray< T >::size(), Store, Aleph::Compiler_SSA_Terminator::successors, and Aleph::Compiler_SSA_Block::terminator.

Referenced by main(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ enum_for_each() [1/2]

template<class Container , class Operation >
requires CallableWith<Operation &, functional_detail::get_curr_t<Container>, std::size_t &>
void Aleph::enum_for_each ( const Container &  container,
Operation &&  operation 
)
inline

Overload of enum_for_each.

Definition at line 774 of file ahFunctional.H.

References enum_for_each().

◆ enum_for_each() [2/2]

template<class Container , class Operation >
requires CallableWith<Operation &, functional_detail::get_curr_t<Container>, std::size_t &>
void Aleph::enum_for_each ( const Container &  container,
Operation &  operation 
)
inline

Apply an operation to each element and its index.

Like for_each(), but also passes the zero-based index of each element to the operation. Useful when you need to know the position of each element during iteration.

Template Parameters
ContainerContainer type with get_it() method.
OperationCallable type (const Item_Type&, size_t) -> void.
Parameters
containerSource container.
operationOperation receiving (element, index).
Example:
DynList<std::string> names = {"Alice", "Bob", "Carol"};
enum_for_each(names, [](const std::string& name, size_t i) {
std::cout << i << ": " << name << '\n';
});
// Output:
// 0: Alice
// 1: Bob
// 2: Carol
void enum_for_each(const Container &container, Operation &operation)
Apply an operation to each element and its index.
See also
for_each() for version without index.
enumerate() for getting pairs of (element, index).

Definition at line 764 of file ahFunctional.H.

Referenced by demo_iteration(), enum_for_each(), and TEST_F().

◆ enum_zip_it()

template<class... Cs>
EnumZipIterator< Cs... > Aleph::enum_zip_it ( const Cs &...  cs)
inline

Alias for get_enum_zip_it.

Definition at line 1421 of file ah-zip.H.

Referenced by TEST(), TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ enum_zip_it_pos()

template<class... Cs>
EnumZipIterator< Cs... > Aleph::enum_zip_it_pos ( size_t  pos,
const Cs &...  cs 
)
inline

Alias for get_enum_zip_it_pos.

Definition at line 1428 of file ah-zip.H.

References get_enum_zip_it_pos().

Referenced by TEST_F().

◆ enumerate()

template<class Container >
auto Aleph::enumerate ( const Container &  c)
inline

Return pairs of (element, index).

Creates a list of pairs where each pair contains an element and its zero-based index in the container. Similar to Python's enumerate() but returns pairs instead of tuples.

Template Parameters
ContainerContainer type with for_each() method.
Parameters
cSource container.
Returns
DynList of pairs (element, index).
Example:
DynList<std::string> names = {"Alice", "Bob", "Carol"};
for (const auto& [name, idx] : enumerate(names))
std::cout << idx << ": " << name << '\n';
// Output:
// 0: Alice
// 1: Bob
// 2: Carol
auto enumerate(const Container &c)
Return pairs of (element, index).
See also
enumerate_tuple() for tuple-based version.
enum_for_each() for applying operation with index.

Definition at line 1188 of file ahFunctional.H.

References Aleph::DynList< T >::append().

Referenced by Aleph::CA::Ghost_Lattice< Storage, Boundary, Halo >::for_each_halo_cell(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ enumerate_tuple()

template<class Container >
DynList< std::tuple< size_t, typename Container::Item_Type > > Aleph::enumerate_tuple ( const Container &  container)
inline

Zip containers with an index (enumerate with zip).

Returns list of tuples (index, element).

Parameters
containerSource container.
Returns
DynList of tuples (size_t, T).

Definition at line 2760 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and Tuple.

Referenced by TEST().

◆ EnumZipIterator()

Aleph::EnumZipIterator ( const HeadC &  head,
const TailC &...  tail 
)

Construct an enumerating zip iterator over multiple containers.

The index is appended as the last element in the resulting tuple.

Definition at line 1246 of file ah-zip.H.

◆ eq()

template<class C1 , class C2 , class Eq = std::equal_to<typename C1::Item_Type>>
bool Aleph::eq ( const C1 &  c1,
const C2 &  c2,
Eq  e = Eq() 
)
inline

Check equality of two containers using a predicate.

Compares two containers element-by-element using the given equality predicate. Returns true only if both containers have the same length and all corresponding pairs are equal.

Template Parameters
C1Type of the first container.
C2Type of the second container.
EqEquality predicate type (defaults to std::equal_to).
Parameters
c1First container.
c2Second container.
eEquality predicate for comparing elements.
Returns
true if containers have equal length and all elements compare equal.
Example:
DynList<int> a = {1, 2, 3};
DynList<int> b = {1, 2, 3};
DynList<int> c = {1, 2, 4};
eq(a, b); // true
eq(a, c); // false
bool eq(const C1 &c1, const C2 &c2, Eq e=Eq())
Check equality of two containers using a predicate.
See also
diff() for inequality check.
are_eq() for detailed mismatch information.

Definition at line 1230 of file ahFunctional.H.

References and, and LocateFunctions< Container, Type >::get_it().

Referenced by all_unique(), all_unique(), all_unique(), all_unique(), Aleph::functional_detail::all_unique_hash_path(), are_tree_equal(), are_tree_equal(), Aleph::SweepLineSegmentIntersection::check_and_enqueue(), containers_eq(), demo_comparison(), diff(), Aleph::CA::ca_io_detail::header_value(), Aleph::Path< GT >::operator!=(), Aleph::SweepLineSegmentIntersection::operator()(), Aleph::MinkowskiSumConvex::operator()(), operator==(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::operator==(), Aleph::Path< GT >::operator==(), Aleph::functional_detail::pairwise_all_unique(), Aleph::DynList< T >::remove(), Aleph::DynList< T >::remove_ne(), sequential_groups(), sequential_groups(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), sequential_search(), stl_zip_equal_by(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), uni_zip_equal_by(), Aleph::FunctionalMixin< Derived, Type >::unique_by(), unique_sequential(), and unique_sequential().

◆ equal()

template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
bool Aleph::equal ( Itor1  beg,
const Itor1 &  end,
Itor2  cmpBeg,
BinaryPredicate  op = BinaryPredicate() 
)
inline

Test if two ranges are equal.

Compares elements in the range [beg, end) with elements starting at cmpBeg.

Template Parameters
Itor1First range iterator type.
Itor2Second range iterator type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element of the first range.
endIterator past the last element of the first range.
cmpBegIterator to the first element of the second range.
opBinary predicate for comparison.
Returns
true if all corresponding elements are equal.

Definition at line 482 of file ahAlgo.H.

Referenced by csv_unique(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::less(), Aleph::Compiler_Parser::parse_type_alias_declaration(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ equal_length()

template<class... Cs>
bool Aleph::equal_length ( const Cs &...  cs)
inline

Return true if all containers have the same length.

Parameters
csContainers to compare.
Returns
true iff all containers have equal size.

Definition at line 378 of file ah-zip.H.

References get_zip_it().

Referenced by demo_length_checking(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ equal_range() [1/2]

template<class Itor , class T >
std::pair< Itor, Itor > Aleph::equal_range ( Itor  beg,
Itor  end,
const T &  value 
)
inline

Find equal range in a sorted sequence.

Returns a pair of iterators defining the subrange of elements equal to value.

Template Parameters
ItorForward iterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to search for.
Returns
Pair of iterators [lower_bound, upper_bound).

Definition at line 1330 of file ahAlgo.H.

References lower_bound(), upper_bound(), and value.

Referenced by TEST().

◆ equal_range() [2/2]

template<class Itor , class T , class BinaryPredicate >
std::pair< Itor, Itor > Aleph::equal_range ( Itor  beg,
Itor  end,
const T &  value,
BinaryPredicate  op 
)
inline

Find equal range with custom comparison.

Template Parameters
ItorForward iterator type.
TValue type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to search for.
opBinary comparison predicate.
Returns
Pair of iterators [lower_bound, upper_bound).

Definition at line 1351 of file ahAlgo.H.

References lower_bound(), upper_bound(), and value.

◆ error()

void Aleph::error ( const char *  file,
int  line,
const char *  format,
  ... 
)
extern

◆ error_msg()

void Aleph::error_msg ( const std::string &  msg)
inline

Display message and abort program execution.

Definition at line 288 of file ahUtils.H.

Referenced by TEST().

◆ escape_dot_label()

std::string Aleph::escape_dot_label ( const std::string &  text)
inline

Definition at line 56 of file generate_tree.H.

Referenced by generate_tree_graphviz().

◆ euclidean_distance()

Geom_Number Aleph::euclidean_distance ( const Geom_Number &  x,
const Geom_Number &  y 
)
inline

Euclidean distance (hypotenuse) of the vector (x, y).

Definition at line 160 of file point.H.

References hypot(), and y.

Referenced by Aleph::Polar_Point::Polar_Point(), Aleph::Point::distance_to(), Aleph::Segment::length(), Aleph::Point::norm(), pitag(), process_tag_node(), TEST(), and TEST().

◆ execute_R_script()

void Aleph::execute_R_script ( const std::string &  scr,
const std::string &  file_name = "tmp.R" 
)
inline

Generate and execute a R script from a string (containing the script)

Parameters
[in]scrstring containing the script
file_namefile name of temporary file where the script will be saved

Definition at line 485 of file ahUtils.H.

References cmd.

◆ exists() [1/4]

template<class Container , class Operation >
bool Aleph::exists ( const Container &  container,
Operation &&  operation = Operation() 
)
inline

Overload of exists.

Definition at line 884 of file ahFunctional.H.

◆ exists() [2/4]

template<class Container , class Operation >
bool Aleph::exists ( const Container &  container,
Operation &  operation 
)
inline

Overload of exists.

Definition at line 867 of file ahFunctional.H.

◆ exists() [3/4]

template<class Container , class Operation >
bool Aleph::exists ( Container &  container,
Operation &&  operation = Operation() 
)
inline

Overload of exists.

Definition at line 877 of file ahFunctional.H.

◆ exists() [4/4]

template<class Container , class Operation >
bool Aleph::exists ( Container &  container,
Operation &  operation 
)
inline

Return true if at least one element satisfies a predicate.

Tests whether the predicate returns true for at least one element in the container. Short-circuits on the first true result. Returns false for empty containers.

Template Parameters
ContainerContainer type with traverse() method.
OperationPredicate type (const Item_Type&) -> bool.
Parameters
containerSource container.
operationPredicate to test each element.
Returns
true if operation(item) is true for any item.
Example:
DynList<int> nums = {1, 3, 5, 6, 7};
bool has_even = exists(nums, [](int x) { return x % 2 == 0; });
// has_even = true (because of 6)
bool exists(Container &container, Operation &operation)
Return true if at least one element satisfies a predicate.
See also
all() for testing if all elements satisfy predicate.
none() for testing if no element satisfies predicate.

Definition at line 857 of file ahFunctional.H.

Referenced by none(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ exists_file()

bool Aleph::exists_file ( const std::string &  name)
inline

Return true if it exists a file of name

Definition at line 298 of file ahUtils.H.

Referenced by TEST().

◆ exists_in_arc() [1/2]

template<AlephGraph GT, class Op >
bool Aleph::exists_in_arc ( const GT &  g,
typename GT::Node *  p,
Op  op = Op() 
)
inline

Test if an arc of g into p satisfies an operation; on a digraph, in \(O(E)\).

Parameters
[in]gthe graph of p
[in]pnode pointer
[in]opoperation for testing on each arc
Returns
true if there is at least an arc satisfying the operation

Definition at line 3096 of file tpl_graph.H.

References traverse_in_arcs().

◆ exists_in_arc() [2/2]

template<AlephGraph GT, class Op >
bool Aleph::exists_in_arc ( typename GT::Node *  p,
Op  op = Op() 
)
inline

Test if it exists an incoming arc satisfying an operation.

op must have the following signature:

bool op(Arc * arc)

It does not compile on a digraph type: use exists_in_arc(g, p, op).

Parameters
[in]pnode pointer
[in]opoperation for testing on each arc
Returns
true if there is at least an arc satisfying the operation

Definition at line 3075 of file tpl_graph.H.

Referenced by TYPED_TEST(), and TYPED_TEST().

◆ exists_out_arc()

template<AlephGraph GT, class Op >
bool Aleph::exists_out_arc ( typename GT::Node *  p,
Op  op = Op() 
)
inline

Test if it exists an outcoming arc satisfying an operation.

op must have the following signature:

bool op(Arc * arc)

Parameters
[in]pnode pointer
[in]opoperation for testing on each arc
Returns
true if there is at least an arc satisfying the operation

Definition at line 3423 of file tpl_graph.H.

◆ exists_perm() [1/2]

template<typename T , class Pred >
bool Aleph::exists_perm ( const DynList< DynList< T > > &  l,
Pred &&  pred 
)

Convenience overload accepting an rvalue callable.

Definition at line 647 of file ah-comb.H.

References exists_perm(), l, and pred.

◆ exists_perm() [2/2]

template<typename T , class Pred >
bool Aleph::exists_perm ( const DynList< DynList< T > > &  l,
Pred &  pred 
)

Check if any permutation satisfies a predicate.

Stops as soon as a permutation makes pred return true.

Template Parameters
TElement type.
PredCallable with signature bool(const DynList<T>&).
Parameters
[in]lList of lists.
[in]predPredicate to test.
Returns
true if at least one permutation satisfies pred.

Definition at line 628 of file ah-comb.H.

References l, pred, and traverse_perm().

Referenced by demo_perm_predicates(), exists_perm(), none_perm(), TEST(), TEST(), TEST(), and TEST().

◆ exit()

void Aleph::exit ( const char *  file,
int  line,
const char *  format,
  ... 
)
extern

Print a message and exit the program.

Parameters
fileSource file name (use FILE).
lineLine number (use LINE).
formatPrintf-style format string.
...Format arguments.

Definition at line 125 of file ahDefs.C.

References aleph_message_mutex, and file.

Referenced by Aleph::Compiler_Line_Frontend::lower_ir(), main(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and usage().

◆ expect()

void Aleph::expect ( std::ifstream &  input_stream,
const std::string &  expected 
)
inline

Expect and consume a specific string/keyword.

Reads characters and verifies they match the expected string. If not, throws an error.

Parameters
input_streamThe input file stream
expectedThe string that must appear next
Exceptions
ParseErrorif the input doesn't match
Example
expect(input, "function");
std::string name = load_identifier(input);
void expect(std::ifstream &input_stream, const std::string &expected)
Expect and consume a specific string/keyword.
std::string load_identifier(std::ifstream &input_stream)
Load an identifier from the input stream.

Definition at line 1303 of file parse_utils.H.

References ah_parse_error_unless, expect(), init_token_scanning(), read_char_from_stream(), skip_white_spaces(), and token_instance.

Referenced by expect(), TEST_F(), and TEST_F().

◆ expect_char()

void Aleph::expect_char ( std::ifstream &  input_stream,
char  expected 
)
inline

Expect and consume a specific character.

Reads the next non-whitespace character and verifies it matches the expected character. If not, throws an error.

Parameters
input_streamThe input file stream
expectedThe character that must appear next
Exceptions
ParseErrorif the next character doesn't match
Example
expect_char(input, '('); // Must find opening paren
// ... parse expression ...
expect_char(input, ')'); // Must find closing paren
void expect_char(std::ifstream &input_stream, char expected)
Expect and consume a specific character.

Definition at line 1278 of file parse_utils.H.

References ah_parse_error_unless, expect_char(), read_char_from_stream(), and skip_white_spaces().

Referenced by expect_char(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ export_network_to_dimacs()

template<class Net >
void Aleph::export_network_to_dimacs ( const Net &  net,
const std::string &  filename 
)

Export network to DIMACS max-flow format.

DIMACS is a standard benchmark format for network flow problems. Many benchmark instances are available in this format.

Template Parameters
NetNetwork type.
Parameters
netNetwork to export.
filenameOutput filename.
DIMACS Format
c Comment line
p max <nodes> <arcs>
n <source_id> s
n <sink_id> t
a <src> <tgt> <cap>
...
DynArray< Graph::Arc * > arcs
Definition graphpic.C:408

Definition at line 821 of file net_utils.H.

References GraphCommon< GT, Node, Arc >::esize(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), out, and GraphCommon< GT, Node, Arc >::vsize().

Referenced by TEST_F(), TEST_F(), and TEST_F().

◆ export_network_to_dot()

template<class Net >
void Aleph::export_network_to_dot ( const Net &  net,
const std::string &  filename,
const DotExportOptions &  options = DotExportOptions() 
)

Export network to DOT format for GraphViz visualization.

Creates a DOT file that can be rendered with GraphViz tools (dot, neato, etc.) to visualize the network structure and flow.

Template Parameters
NetNetwork type.
Parameters
netNetwork to export.
filenameOutput filename (should end with .dot).
optionsExport options.
Example
// ... build and solve network ...
export_network_to_dot(net, "flow.dot");
// Then run: dot -Tpng flow.dot -o flow.png
void export_network_to_dot(const Net &net, const std::string &filename, const DotExportOptions &options=DotExportOptions())
Export network to DOT format for GraphViz visualization.
Definition net_utils.H:485

Definition at line 485 of file net_utils.H.

References and, color(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), options, and out.

Referenced by TEST_F(), and TEST_F().

◆ export_network_to_json()

template<class Net >
void Aleph::export_network_to_json ( const Net &  net,
const std::string &  filename 
)

Export network to JSON format.

Creates a JSON file with network structure including:

  • Node list with IDs
  • Arc list with source, target, capacity, flow
  • Source and sink information
Template Parameters
NetNetwork type.
Parameters
netNetwork to export.
filenameOutput filename (should end with .json).
JSON Format
{
"nodes": [0, 1, 2, ...],
"source": 0,
"sink": 3,
"arcs": [
{"src": 0, "tgt": 1, "cap": 10, "flow": 5},
...
]
}

Definition at line 695 of file net_utils.H.

References GraphCommon< GT, Node, Arc >::esize(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), out, and GraphCommon< GT, Node, Arc >::vsize().

Referenced by TEST_F().

◆ ext_gcd()

template<typename T >
requires (std::is_integral_v<T> and std::is_signed_v<T>)
T Aleph::ext_gcd ( T  a,
T  b,
T &  x,
T &  y 
)
noexcept

Extended Euclidean Algorithm.

Computes gcd(a, b) and the coefficients x, y such that a*x + b*y = gcd(a, b).

Parameters
aFirst number.
bSecond number.
xReference to store the coefficient of a.
yReference to store the coefficient of b.
Returns
The greatest common divisor of a and b.

Definition at line 138 of file modular_arithmetic.H.

References ext_gcd(), y, and y1().

Referenced by ext_gcd().

◆ extrapolate_left()

double Aleph::extrapolate_left ( const double  x1,
const double  x2,
const double  y1,
const double  y2,
const double  x 
)
inline

Basic linear extrapolation.

This function receives a pair of points in a plane plus a x point less than x1 and x2 and computes the value of f(x)

Parameters
[in]x1minimum in x
[in]x2maximum in x
[in]y1value of f(x1)
[in]y2value of f(x2)
[in]xfor which f(x) should be computed
Note
Requires x2 > x1 and x < x1.

Definition at line 391 of file ahUtils.H.

References and, and y1().

Referenced by TEST().

◆ extrapolate_right()

double Aleph::extrapolate_right ( const double  x1,
const double  x2,
const double  y1,
const double  y2,
const double  x 
)
inline

Basic linear extrapolation.

This function receives a pair of points in a plane plus a x point less than x1 and x2 and computes the value of f(x)

Parameters
[in]x1minimum in x
[in]x2maximum in x
[in]y1value of f(x1)
[in]y2value of f(x2)
[in]xfor which f(x) should be computed
Note
Requires x2 > x1 and x > x2.

Definition at line 431 of file ahUtils.H.

References and, and y1().

Referenced by TEST().

◆ faster_heapsort()

template<typename T , class Compare = Aleph::less<T>>
requires StrictWeakOrder<Compare, T>
constexpr void Aleph::faster_heapsort ( T *  array,
const size_t  n,
const Compare &  cmp = Compare() 
)
inlineconstexpr

Optimized version of heapsort.

faster_heapsort(array, n) builds the heap bottom-up (starting at n / 2) and therefore performs fewer comparisons during the build phase.

Template Parameters
Telement type
Comparecomparator defining the heap order
Parameters
[in,out]arraypointer to the first element to sort
[in]nnumber of elements in the range
[in]cmpcomparison function (default: Aleph::less<T>)
See also
insertion_sort() quicksort_rec() mergesort() heapsort()
selection_sort()

Definition at line 371 of file tpl_arrayHeap.H.

References cmp(), and Aleph::arrayheap_detail::sift_down().

Referenced by benchmark_contiguous_array(), introsort_loop(), main(), Aleph::pdq_detail::sort_loop(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ fifo_preflow_maximum_flow()

template<class Net >
Net::Flow_Type Aleph::fifo_preflow_maximum_flow ( Net &  net)

Preflow-push maximum flow using a FIFO queue of active nodes.

Parameters
[in,out]netFlow network (must have a single source and sink).
Returns
Maximized flow value.

Definition at line 2668 of file tpl_net.H.

Referenced by Aleph::Fifo_Preflow_Maximum_Flow< Net >::operator()(), and TEST().

◆ fill() [1/2]

template<AlephSequentialContainer C>
void Aleph::fill ( C &  container,
const typename C::Item_Type &  value 
)

Fill all elements of a container with a fixed value.

Sets every element currently in container to value in traversal order (front to back). The container size is unchanged; if it is empty this is a no-op.

Analogous to std::fill, but works with any Aleph-w sequential container via the AlephSequentialContainer concept.

Template Parameters
CContainer type satisfying AlephSequentialContainer.
Parameters
[in,out]containerThe container whose elements are overwritten.
[in]valueThe value assigned to every element.
Example
DynList<int> lst = {1, 2, 3, 4};
fill(lst, 0); // lst is now {0, 0, 0, 0}
Array<double> arr(5, 0.0);
fill(arr, 3.14); // all elements become 3.14
auto zeros = rep(4, 0); // {0, 0, 0, 0}
fill(zeros, 7); // {7, 7, 7, 7}
void fill(Itor beg, const Itor &end, const T &value)
Fill a range with a value.
Definition ahAlgo.H:707
DynList< T > rep(const size_t n, const T &item)
Create a sequence of repeated items.
Note
To create a new container of repeated values, use rep().
See also
iota() For filling with a sequence of incrementing values.
rep() For constructing a new list of repeated values.

Definition at line 463 of file ahFunctional.H.

References value.

◆ fill() [2/2]

template<class Itor , class T >
void Aleph::fill ( Itor  beg,
const Itor &  end,
const T &  value 
)
inline

Fill a range with a value.

Assigns the specified value to all elements in [beg, end).

Template Parameters
ItorIterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to assign.

Definition at line 707 of file ahAlgo.H.

References value.

Referenced by Aleph::negative_cycles_detail::build_out_adjacency(), Aleph::TestVisual::emit_case_svg(), main(), Aleph::Compiler_Dataflow_Detail::make_constant_vector(), most_negative_cycle_up_to_3(), Aleph::Compiler_Bytecode_Interpreter_Detail::reset_values(), shift_lines_to_left(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ fill_n()

template<class Itor , class T , class Size >
void Aleph::fill_n ( Itor  beg,
Size  num,
const T &  value 
)
inline

Fill n elements with a value.

Assigns the specified value to the first n elements starting at beg.

Template Parameters
ItorIterator type.
TValue type.
SizeInteger type.
Parameters
begIterator to the first element.
numNumber of elements to fill.
valueValue to assign.

Definition at line 727 of file ahAlgo.H.

References value.

Referenced by TEST().

◆ fill_string()

void Aleph::fill_string ( std::string &  str,
char  sym 
)
inline

Fill all the content of std::string with a defined char.

Use for deleting sensitive data; for example, passwords

Definition at line 710 of file ah-string-utils.H.

Referenced by demo_filtering(), and TEST().

◆ filter() [1/4]

template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > Aleph::filter ( const Container1 &  container,
Operation &&  operation 
)
inline

Overload of filter.

Definition at line 953 of file ahFunctional.H.

◆ filter() [2/4]

template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > Aleph::filter ( const Container1 &  container,
Operation &  operation 
)
inline

Overload of filter.

Definition at line 927 of file ahFunctional.H.

References FunctionalMethods< Container, T >::for_each().

◆ filter() [3/4]

template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > Aleph::filter ( Container1 &  container,
Operation &&  operation 
)
inline

Overload of filter.

Definition at line 943 of file ahFunctional.H.

◆ filter() [4/4]

template<class Container1 , template< typename > class Container2 = Aleph::DynList, class Operation = Dft_Filter_Op<typename Container1::Item_Type>>
Container2< typename Container1::Item_Type > Aleph::filter ( Container1 &  container,
Operation &  operation 
)
inline

◆ filter_in_arcs() [1/2]

template<AlephGraph GT, class Op >
DynList< typename GT::Arc * > Aleph::filter_in_arcs ( const GT &  g,
typename GT::Node *  p,
Op  cond 
)
inline

Return the arcs of g into p that meet a condition; on a digraph, in \(O(E)\).

Parameters
[in]gthe graph of p
[in]pnode pointer
[in]condfiltering condition
Returns
a DynList<typename GT::Arc*> containing the filtered arcs

Definition at line 3348 of file tpl_graph.H.

References Aleph::DynList< T >::append(), and for_each_in_arc().

◆ filter_in_arcs() [2/2]

template<AlephGraph GT, class Op >
DynList< typename GT::Arc * > Aleph::filter_in_arcs ( typename GT::Node *  p,
Op  cond 
)
inline

Filter the incoming arcs meeting an condition.

It does not compile on a digraph type: use filter_in_arcs(g, p, cond).

Parameters
[in]pnode pointer
[in]condfiltering condition
Returns
a DynList<typename GT::Arc*> containing the filtered arcs

Definition at line 3324 of file tpl_graph.H.

References Aleph::DynList< T >::append().

Referenced by TYPED_TEST().

◆ filter_out_arcs()

template<AlephGraph GT, class Op >
DynList< typename GT::Arc * > Aleph::filter_out_arcs ( typename GT::Node *  p,
Op  cond 
)
inline

Filter the outcoming arcs meeting an condition.

Parameters
[in]pnode pointer
[in]condfiltering condition
Returns
a DynList<typename GT::Arc*> containing the filtered arcs

Definition at line 3547 of file tpl_graph.H.

References Aleph::DynList< T >::append().

◆ filter_perm() [1/2]

template<typename T , class Pred >
DynList< DynList< T > > Aleph::filter_perm ( const DynList< DynList< T > > &  l,
Pred &&  pred 
)

Convenience overload accepting an rvalue callable.

Definition at line 735 of file ah-comb.H.

References filter_perm(), l, and pred.

◆ filter_perm() [2/2]

template<typename T , class Pred >
DynList< DynList< T > > Aleph::filter_perm ( const DynList< DynList< T > > &  l,
Pred &  pred 
)

Filter permutations that satisfy a predicate.

Template Parameters
TElement type.
PredCallable with signature bool(const DynList<T>&).
Parameters
[in]lList of lists.
[in]predPredicate to select permutations.
Returns
List of permutations for which pred returned true.

Definition at line 720 of file ah-comb.H.

References Aleph::DynList< T >::append(), for_each_perm(), l, and pred.

Referenced by filter_perm(), TEST(), TEST(), TEST(), and TEST().

◆ find()

template<class Itor , class T >
Itor Aleph::find ( const Itor &  beg,
const Itor &  end,
const T &  value 
)
inline

Find the first element equal to a value.

Searches the range [beg, end) for the first element equal to the specified value.

Template Parameters
ItorIterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to search for.
Returns
Iterator to the found element, or end if not found.

Definition at line 230 of file ahAlgo.H.

References bind2nd(), find_if(), and value.

Referenced by Aleph::PatriciaMap< UInt, T >::contains(), Aleph::PatriciaMap< UInt, T >::insert_or_assign(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ find_aumenting_path()

template<class Net , template< typename T > class Q>
Path< Net > Aleph::find_aumenting_path ( const Net &  net,
const typename Net::Flow_Type &  min_slack 
)

Find an augmenting path using DFS or BFS based on Q.

Parameters
[in]netFlow network.
[in]min_slackMinimum slack required.

Definition at line 2018 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::get_sink(), and Aleph::Net_Graph< NodeT, ArcT >::get_source().

◆ find_aumenting_path_bfs()

template<class Net >
Path< Net > Aleph::find_aumenting_path_bfs ( const Net &  net,
const typename Net::Flow_Type &  min_slack 
)

Find an augmenting path using BFS.

Definition at line 2034 of file tpl_net.H.

Referenced by TYPED_TEST().

◆ find_aumenting_path_dfs()

template<class Net >
Path< Net > Aleph::find_aumenting_path_dfs ( const Net &  net,
const typename Net::Flow_Type &  min_slack 
)

Find an augmenting path using DFS.

Definition at line 2027 of file tpl_net.H.

Referenced by TEST(), and TYPED_TEST().

◆ find_aumenting_semi_path()

template<class Net , template< typename T > class Q>
SemiPath< Net > Aleph::find_aumenting_semi_path ( const Net &  net,
const typename Net::Flow_Type &  slack 
)

Find an augmenting semi-path using DFS or BFS based on Q.

Parameters
[in]netFlow network.
[in]slackMinimum slack required.
Returns
Semi-path tuple (found, slack, arc list).

Definition at line 2048 of file tpl_net.H.

References Aleph::Find_Aumenting_Path< Net, Q >::find_aum_path().

◆ find_aumenting_semi_path_bfs()

template<class Net >
SemiPath< Net > Aleph::find_aumenting_semi_path_bfs ( const Net &  net,
const typename Net::Flow_Type &  slack 
)

Find an augmenting semi-path using BFS.

Definition at line 2062 of file tpl_net.H.

Referenced by TYPED_TEST().

◆ find_aumenting_semi_path_dfs()

template<class Net >
SemiPath< Net > Aleph::find_aumenting_semi_path_dfs ( const Net &  net,
const typename Net::Flow_Type &  slack 
)

Find an augmenting semi-path using DFS.

Definition at line 2055 of file tpl_net.H.

Referenced by TYPED_TEST().

◆ find_bridges()

template<AlephGraph GT>
DynList< typename GT::Arc * > Aleph::find_bridges ( const GT &  g)

Starts from the first node of the graph.

See also
find_bridges(const GT &, typename GT::Node *, SA)

Definition at line 1097 of file tpl_cut_nodes.H.

References Aleph::Compute_Bridges< GT, SA >::find_bridges().

◆ find_decrementing_path()

template<class Net , template< typename T > class Q>
SemiPath< Net > Aleph::find_decrementing_path ( const Net &  net,
const typename Net::Flow_Type &  slack 
)

Find a decrementing semi-path using DFS or BFS based on Q.

Parameters
[in]netFlow network.
[in]slackMinimum slack required.
Returns
Semi-path tuple (found, slack, arc list).

Definition at line 2076 of file tpl_net.H.

References Aleph::Find_Aumenting_Path< Net, Q >::find_dec_path().

◆ find_decrementing_path_bfs()

template<class Net >
SemiPath< Net > Aleph::find_decrementing_path_bfs ( const Net &  net,
const typename Net::Flow_Type &  slack 
)

Find a decrementing semi-path using BFS.

Definition at line 2090 of file tpl_net.H.

Referenced by TYPED_TEST().

◆ find_decrementing_path_dfs()

template<class Net >
SemiPath< Net > Aleph::find_decrementing_path_dfs ( const Net &  net,
const typename Net::Flow_Type &  slack 
)

Find a decrementing semi-path using DFS.

Definition at line 2083 of file tpl_net.H.

Referenced by TYPED_TEST().

◆ find_depth_first_spanning_tree()

template<AlephGraph GT>
GT Aleph::find_depth_first_spanning_tree ( const GT &  g)
inline

◆ find_end()

template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 Aleph::find_end ( Itor1  beg,
Itor1  end,
Itor2  searchBeg,
Itor2  searchEnd,
BinaryPredicate  op = BinaryPredicate() 
)
inline

Find the last occurrence of a subrange.

Searches for the last occurrence of the subrange [searchBeg, searchEnd) within the range [beg, end).

Template Parameters
Itor1Main range iterator type.
Itor2Subrange iterator type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element of the main range.
endIterator past the last element of the main range.
searchBegIterator to the first element of the subrange.
searchEndIterator past the last element of the subrange.
opBinary predicate for comparison.
Returns
Iterator to the first element of the last occurrence, or end.

Definition at line 364 of file ahAlgo.H.

References search().

◆ find_first_of()

template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 Aleph::find_first_of ( const Itor1 &  beg,
const Itor1 &  end,
Itor2  searchBeg,
const Itor2 &  searchEnd,
BinaryPredicate  op = BinaryPredicate() 
)
inline

Find first element from a set.

Searches the range [beg, end) for the first element that matches any element in [searchBeg, searchEnd).

Template Parameters
Itor1Main range iterator type.
Itor2Search set iterator type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element of the main range.
endIterator past the last element of the main range.
searchBegIterator to the first element of the search set.
searchEndIterator past the last element of the search set.
opBinary predicate for comparison.
Returns
Iterator to the first matching element, or end.

Definition at line 405 of file ahAlgo.H.

◆ find_if()

template<class Itor , class UnaryPredicate >
Itor Aleph::find_if ( Itor  beg,
const Itor &  end,
UnaryPredicate  op 
)
inline

Find the first element satisfying a predicate.

Searches the range [beg, end) for the first element for which the predicate op returns true.

Template Parameters
ItorIterator type.
UnaryPredicatePredicate type.
Parameters
begIterator to the first element.
endIterator past the last element.
opUnary predicate to test elements.
Returns
Iterator to the found element, or end if not found.

Definition at line 205 of file ahAlgo.H.

References and.

Referenced by find(), remove_if(), TEST(), and TEST().

◆ find_opt() [1/2]

template<class Container , class Pred >
std::optional< typename Container::Item_Type > Aleph::find_opt ( const Container &  container,
Pred &&  pred 
)
inline

Overload of find_opt.

Definition at line 2320 of file ahFunctional.H.

References pred.

◆ find_opt() [2/2]

template<class Container , class Pred >
std::optional< typename Container::Item_Type > Aleph::find_opt ( const Container &  container,
Pred &  pred 
)
inline

Find the first element satisfying pred (safe version).

Returns a copy of the first element in container for which pred returns true, wrapped in std::optional. Returns std::nullopt if no such element exists.

Unlike find_ptr(), this function is safe to use with temporary containers because it returns a copy of the element, not a pointer.

// Safe: returns a copy
auto opt = find_opt(get_list(), pred);
if (opt) use(*opt); // OK, opt contains a copy
Freq_Node * pred
Predecessor node in level-order traversal.
std::optional< typename Container::Item_Type > find_opt(const Container &container, Pred &pred)
Find the first element satisfying pred (safe version).
Parameters
containerSource container.
predPredicate to test each element.
Returns
std::optional containing a copy of the first matching element, or std::nullopt if not found.
See also
find_ptr For a pointer-returning version (use with caution).

Definition at line 2302 of file ahFunctional.H.

References pred.

◆ find_position() [1/2]

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long Aleph::find_position ( Node *  r,
const typename Node::key_type &  key,
Node *&  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See find_position().

Definition at line 348 of file tpl_binNodeXt.H.

References cmp(), find_position(), and r.

◆ find_position() [2/2]

template<RankedBinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long Aleph::find_position ( Node *  r,
const typename Node::key_type &  key,
Node *&  p,
Compare &  cmp 
)
inlinenoexcept

Find the inorder position of a key in an extended binary search tree.

 `find_position(r, key, p, cmp)` searches `key` in the tree with root
 `r`. If `key` is found then its inorder position is returned and
 a pointer to the node containing the key is written in output
 parameter `p`. Otherwise, the function returns the position
 that would have `key` if this was in the tree. At this regard,
 there are three cases:
 -# if `key` is lesser than the minimum key of tree, then -1 is
 returned and `p` is the node with the smallest key.
 -# If `key` is greater than the maximum key in the tree, then
 the number of keys is returned and `p` is the node with the
 maximum key in the tree.
 -# For any other case, the returned value is the position that
 would have `key` if this was in the tree and `p` is the node
 whose key is immediately greater than `key`.

 @param[in] r root of tree
 @param[in] key to be searched
 @param[out] p reference to pointer to node
 @param[in] cmp comparison criteria
 @return the positions of `key` in the tree
 @throws anything that `cmp` throws; the search does not modify the
 tree. It is `noexcept` only if `cmp` cannot throw, so that what a
 comparison throws reaches the caller.

 @ingroup Trees

Definition at line 309 of file tpl_binNodeXt.H.

References cmp(), COUNT(), KEY, LLINK, offset, r, and RLINK.

Referenced by find_position(), main(), and TEST().

◆ find_ptr() [1/4]

template<class Container , class Pred >
const Container::Item_Type * Aleph::find_ptr ( const Container &  container,
Pred &&  pred 
)
inline

Overload of find_ptr.

Definition at line 2273 of file ahFunctional.H.

References pred.

◆ find_ptr() [2/4]

template<class Container , class Pred >
const Container::Item_Type * Aleph::find_ptr ( const Container &  container,
Pred &  pred 
)
inline

Overload of find_ptr.

Definition at line 2248 of file ahFunctional.H.

References pred.

◆ find_ptr() [3/4]

template<class Container , class Pred >
Container::Item_Type * Aleph::find_ptr ( Container &  container,
Pred &&  pred 
)
inline

Overload of find_ptr.

Definition at line 2266 of file ahFunctional.H.

References pred.

◆ find_ptr() [4/4]

template<class Container , class Pred >
Container::Item_Type * Aleph::find_ptr ( Container &  container,
Pred &  pred 
)
inline

Find the first element satisfying pred.

Returns a pointer to the first element in container for which pred returns true, or nullptr if no such element exists.

Warning
The returned pointer is only valid as long as the container exists and the element is not removed. Never use this function on a temporary container, as the pointer will become dangling immediately. For example:
// WRONG: dangling pointer!
auto *p = find_ptr(get_list(), pred); // list destroyed here
use(*p); // undefined behavior!
// CORRECT: keep container alive
auto list = get_list();
auto *p = find_ptr(list, pred);
if (p) use(*p); // OK
Container::Item_Type * find_ptr(Container &container, Pred &pred)
Find the first element satisfying pred.
If you need a safe copy instead of a pointer, use find_opt().
Parameters
containerSource container (must outlive the returned pointer).
predPredicate to test each element.
Returns
Pointer to the first matching element, or nullptr if not found.
See also
find_opt For a safer alternative that returns a copy.

Definition at line 2229 of file ahFunctional.H.

References pred.

Referenced by TEST().

◆ first_combination_mask()

uint64_t Aleph::first_combination_mask ( const size_t  k)
inline

Build the first k-of-64 combination mask (k low bits set).

Definition at line 892 of file ah-comb.H.

References ah_out_of_range_error_if, and k.

Referenced by next_combination_mask(), and TEST().

◆ flat_map()

template<class Container , class Op >
auto Aleph::flat_map ( const Container &  container,
Op  op 
) -> DynList<typename std::decay_t<decltype(op(std::declval<typename Container::Item_Type>()))>::Item_Type>
inline

Apply operation and flatten results (flatMap/concatMap).

For each element, apply op to get a container, then flatten all results.

Parameters
containerSource container.
opOperation returning a container for each element.
Returns
Flattened DynList of all results.

Definition at line 2469 of file ahFunctional.H.

References Aleph::DynList< T >::append().

Referenced by demo_transformation(), TEST(), TEST(), TEST(), and TEST().

◆ flatten() [1/4]

template<typename T , template< typename > class C1, template< typename > class C2>
DynList< T > Aleph::flatten ( const C2< C1< T > > &  c)

Flatten a nested container of one level.

Concatenates all inner containers into a single flat list.

Template Parameters
TElement type.
C1Inner container template.
C2Outer container template.
Parameters
cNested container (container of containers).
Returns
DynList with all elements from all inner containers.
Example:
DynList<DynList<int>> nested = {{1, 2}, {3, 4, 5}, {6}};
auto flat = flatten(nested);
// flat = {1, 2, 3, 4, 5, 6}
DynList< T > flatten(const C2< C1< T > > &c)
Flatten a nested container of one level.
See also
flat_map() for map followed by flatten.

Definition at line 2037 of file ahFunctional.H.

References Aleph::DynList< T >::append().

Referenced by demo_transformation(), flatten(), flatten(), flatten(), TEST(), and TEST().

◆ flatten() [2/4]

template<typename T , template< typename > class C1, template< typename > class C2, template< typename > class C3>
DynList< T > Aleph::flatten ( const C3< C2< C1< T > > > &  c)

Flatten a nested container of two levels.

Recursively flattens a container nested two levels deep.

Template Parameters
TElement type.
C1,C2,C3Container template types (innermost to outermost).
Parameters
cTriply-nested container.
Returns
DynList with all elements from all inner containers.

Definition at line 2061 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and flatten().

◆ flatten() [3/4]

template<typename T , template< typename > class C1, template< typename > class C2, template< typename > class C3, template< typename > class C4>
DynList< T > Aleph::flatten ( const C4< C3< C2< C1< T > > > > &  c)

Flatten a nested container of three levels.

Recursively flattens a container nested three levels deep.

Template Parameters
TElement type.
C1,C2,C3,C4Container template types (innermost to outermost).
Parameters
cQuadruply-nested container.
Returns
DynList with all elements from all inner containers.

Definition at line 2085 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and flatten().

◆ flatten() [4/4]

template<typename T , template< typename > class C1, template< typename > class C2, template< typename > class C3, template< typename > class C4, template< typename > class C5>
DynList< T > Aleph::flatten ( const C5< C4< C3< C2< C1< T > > > > > &  c)

Flatten a nested container of four levels.

Recursively flattens a container nested four levels deep.

Template Parameters
TElement type.
C1,C2,C3,C4,C5Container template types (innermost to outermost).
Parameters
cFive-times-nested container.
Returns
DynList with all elements from all inner containers.

Definition at line 2110 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and flatten().

◆ floyd_all_shortest_paths()

template<AlephGraph GT>
void Aleph::floyd_all_shortest_paths ( GT &  g,
Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &  dist,
Ady_Mat< GT, long > &  path 
)

Overload using default comparison (less) and addition (plus).

See also
floyd_all_shortest_paths()

Definition at line 290 of file latex_floyd.H.

◆ floyd_all_shortest_paths_latex()

template<AlephGraph GT, template< class > class P_i, template< class > class P_ij, template< class > class D_ij>
void Aleph::floyd_all_shortest_paths_latex ( GT &  g,
Ady_Mat< GT, typename GT::Arc_Type::Distance_Type > &  dist,
Ady_Mat< GT, long > &  path,
std::ofstream &  output 
)

Overload using default comparison (less) and addition (plus).

See also
floyd_all_shortest_paths_latex()

Definition at line 413 of file latex_floyd.H.

References output.

◆ fmix32()

static uint32_t Aleph::fmix32 ( uint32_t  h)
inlinestatic

Definition at line 94 of file hash-fct.C.

References h.

Referenced by MurmurHash3_x86_128(), and MurmurHash3_x86_32().

◆ fmix64()

static uint64_t Aleph::fmix64 ( uint64_t  k)
inlinestatic

Definition at line 105 of file hash-fct.C.

References BIG_CONSTANT, and k.

Referenced by MurmurHash3_x64_128().

◆ fnv_hash() [1/3]

size_t Aleph::fnv_hash ( const char *  key)
inlinenoexcept

Definition at line 702 of file hash-fct.H.

References h.

◆ fnv_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::fnv_hash ( const Key &  key)
inlinenoexcept

Definition at line 579 of file hash-fct.H.

References fnv_hash().

◆ fnv_hash() [3/3]

size_t Aleph::fnv_hash ( const std::string &  key)
inlinenoexcept

Definition at line 811 of file hash-fct.H.

References fnv_hash().

◆ fold_hash64_to_size_t()

static size_t Aleph::fold_hash64_to_size_t ( std::uint64_t  hash)
inlinestaticnoexcept

Definition at line 116 of file hash-fct.C.

References bits().

Referenced by xxhash64_hash().

◆ fold_perm() [1/2]

template<typename T , typename Tc , class Op = Dft_Fold_Op<Tc, T>>
T Aleph::fold_perm ( const T &  init,
const DynList< DynList< Tc > > &  l,
Op &&  op 
)

Convenience overload accepting an rvalue callable.

Definition at line 583 of file ah-comb.H.

References fold_perm(), init, and l.

◆ fold_perm() [2/2]

template<typename T , typename Tc , class Op = Dft_Fold_Op<Tc, T>>
T Aleph::fold_perm ( const T &  init,
const DynList< DynList< Tc > > &  l,
Op &  op 
)

Left-fold over all permutations.

For each permutation p, the accumulator is updated as: acu = op(acu, p).

Template Parameters
TAccumulator type.
TcElement type stored in the input lists.
OpCallable with signature T op(T acu, const DynList<Tc>& perm).
Parameters
[in]initInitial accumulator value.
[in]lList of lists.
[in]opFolding operation.
Returns
Final accumulator.

Definition at line 568 of file ah-comb.H.

References init, l, and traverse_perm().

Referenced by demo_fold(), and fold_perm().

◆ foldl()

template<typename T , class Container , class Operation >
T Aleph::foldl ( const Container &  container,
const T &  init,
Operation  operation 
)
inline

Classic left fold (reduce).

Computes f(...f(f(init, x1), x2), ..., xn).

Definition at line 984 of file ahFunctional.H.

References init, and Aleph::detail::ranges_fold_left().

Referenced by TEST(), and TYPED_TEST_P().

◆ foldl_in_arcs() [1/2]

template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T Aleph::foldl_in_arcs ( const GT &  g,
typename GT::Node *  p,
const T &  init,
Op  op 
)
inline

Fold the arcs of g into p with op, which must have the signature T op(const T & acc, Arc * arc); on a digraph, in \(O(E)\).

Parameters
[in]gthe graph of p
[in]pnode pointer
[in]initinitial value of folding
[in]opfolding operation
Returns
the final folded result after the last seen arc

Definition at line 3302 of file tpl_graph.H.

References Call, for_each_in_arc(), and init.

◆ foldl_in_arcs() [2/2]

template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T Aleph::foldl_in_arcs ( typename GT::Node *  p,
const T &  init,
Op  op 
)
inline

Fold the incoming arcs of a node.

This method folds the incoming arcs to a final folded type T. Each folding is done by an operation op, which must have the following signature:

T op(const T & acc, Arc * arc)

acc often is called an accumulator. op should take the accumulator and the arc and to produce a folded result. It does not compile on a digraph type: use foldl_in_arcs<GT, T>(g, p, init, op).

Parameters
[in]pnode pointer
[in]initinitial value of folding
[in]opfolding operation
Returns
the final folded result after the last seen arc

Definition at line 3275 of file tpl_graph.H.

References init.

◆ foldl_out_arcs()

template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, const T &, typename GT::Arc *>
T Aleph::foldl_out_arcs ( typename GT::Node *  p,
const T &  init,
Op  op 
)
inline

Fold the outcoming arcs of a node.

This method folds the outcoming arcs to a final folded type T. Each folding is done by an operation op, which must have the following signature:

T op(const T & acc, Arc * arc)

acc often is called an accumulator. op should take the accumulator and the arc and to produce a folded result.

Parameters
[in]pnode pointer
[in]initinitial value of folding
[in]opfolding operation
Returns
the final folded result after the last seen arc

Definition at line 3528 of file tpl_graph.H.

References init.

◆ foldr()

template<typename T , class Container , class Operation >
requires requires(T &acc, Operation &op, T &x) { acc = op(x, acc); }
T Aleph::foldr ( const Container &  container,
const T &  init,
Operation  operation 
)
inline

Right fold (reduce).

Computes f(x1, f(x2, ... f(xn, init)...)).

Note
Unlike foldl, this traverses from right to left conceptually, but physically still iterates left-to-right, so the associativity and operation order differ from foldl.

Definition at line 2337 of file ahFunctional.H.

References init.

◆ for_each() [1/5]

template<class Container , class Operation >
const Container & Aleph::for_each ( const Container &  container,
Operation &&  operation = Operation() 
)
inline

Overload of for_each.

Definition at line 730 of file ahFunctional.H.

◆ for_each() [2/5]

template<class Container , class Operation >
const Container & Aleph::for_each ( const Container &  container,
Operation &  operation 
)
inline

Overload of for_each.

Definition at line 711 of file ahFunctional.H.

◆ for_each() [3/5]

template<class Container , class Operation >
Container & Aleph::for_each ( Container &  container,
Operation &&  operation = Operation() 
)
inline

Overload of for_each.

Definition at line 723 of file ahFunctional.H.

◆ for_each() [4/5]

template<class Container , class Operation >
Container & Aleph::for_each ( Container &  container,
Operation &  operation 
)
inline

Apply an operation to each element in a container.

Traverses all elements in the container and applies the given operation to each one. This is a side-effect operation that returns the container for chaining.

Template Parameters
ContainerContainer type with traverse() method.
OperationCallable type (const Item_Type&) -> void.
Parameters
containerSource container.
operationOperation to apply to each element.
Returns
Reference to the container (for method chaining).
Example:
DynList<int> nums = {1, 2, 3};
for_each(nums, [](int x) { std::cout << x << " "; });
// Output: 1 2 3
Operation for_each(Itor beg, const Itor &end, Operation op)
Apply an operation to each element in a range.
Definition ahAlgo.H:76
See also
enum_for_each() for version with index.

Definition at line 699 of file ahFunctional.H.

◆ for_each() [5/5]

template<class Itor , class Operation >
Operation Aleph::for_each ( Itor  beg,
const Itor &  end,
Operation  op 
)
inline

Apply an operation to each element in a range.

Iterates through all elements in the range [beg, end) and applies the given operation to each one.

Template Parameters
ItorIterator type.
OperationCallable type.
Parameters
begIterator to the first element.
endIterator past the last element.
opOperation to apply to each element.
Returns
A copy of the operation op.

Definition at line 76 of file ahAlgo.H.

Referenced by Aleph::Matrix< Trow, Tcol, NumType >::Matrix(), main(), main(), Aleph::Matrix< Trow, Tcol, NumType >::matrix_vector_mult(), partition(), TEST(), TEST(), TEST(), test_DynMapLinHash(), test_DynSet(), test_DynSetLinHash(), TEST_F(), Aleph::Matrix< Trow, Tcol, NumType >::to_collist(), Aleph::Matrix< Trow, Tcol, NumType >::to_rowlist(), TYPED_TEST(), TYPED_TEST_P(), and Aleph::Matrix< Trow, Tcol, NumType >::vector_matrix_mult().

◆ for_each_combination() [1/2]

template<typename T , class Op >
bool Aleph::for_each_combination ( const Array< T > &  values,
const size_t  k,
Op &&  op 
)
inline

*‍/

Enumerate all k-combinations of an Array<T> in lexicographic index order.

The callback receives each materialized combination as Array<T> and can stop early by returning false.

Template Parameters
TElement type.
OpCallable with the signature bool(const Array<T>&).
Parameters
[in]valuesSource values.
[in]kCombination size.
[in]opCallback invoked for each combination.
Returns
true if fully traversed; false if the callback stopped early.

Definition at line 1013 of file ah-comb.H.

References k.

Referenced by build_combinations(), build_combinations(), TEST(), and TEST().

◆ for_each_combination() [2/2]

template<typename T , class Op >
bool Aleph::for_each_combination ( const DynArray< T > &  values,
const size_t  k,
Op &&  op 
)
inline

Overload of for_each_combination for DynArray<T>.

Definition at line 1020 of file ah-comb.H.

References k.

◆ for_each_in_tuple()

template<class Op , class Tuple >
void Aleph::for_each_in_tuple ( Op &&  op,
Tuple &&  t 
)

Apply op to each element of a tuple.

Iterates over all elements in the tuple at compile-time using std::index_sequence, applying the callable op to each element. The operation can modify elements if the tuple is passed by reference.

Template Parameters
OpCallable type (must be invocable with each tuple element type).
TupleTuple type to iterate over.
Parameters
opCallable to apply to each element.
tTuple to iterate over (can be lvalue or rvalue reference).
Example:
auto t = std::make_tuple(1, 2.5, std::string("hello"));
// Print each element
for_each_in_tuple([](const auto& elem) {
std::cout << elem << " ";
}, t);
// Output: 1 2.5 hello
// Modify elements (requires non-const tuple)
auto t2 = std::make_tuple(1, 2, 3);
for_each_in_tuple([](auto& x) { x *= 2; }, t2);
// t2 is now (2, 4, 6)
void for_each_in_tuple(Op &&op, Tuple &&t)
Apply op to each element of a tuple.
Definition ah-zip.H:1911

Definition at line 1911 of file ah-zip.H.

References Aleph::zip_index_detail::for_each_in_tuple_impl().

Referenced by TEST(), TEST(), and TEST().

◆ for_each_perm() [1/2]

template<typename T , class Op >
void Aleph::for_each_perm ( const DynList< DynList< T > > &  l,
Op &&  op 
)
inline

Convenience overload accepting an rvalue callable.

Definition at line 494 of file ah-comb.H.

References for_each_perm(), and l.

◆ for_each_perm() [2/2]

template<typename T , class Op >
void Aleph::for_each_perm ( const DynList< DynList< T > > &  l,
Op &  op 
)
inline

Apply a procedure to every permutation produced by traverse_perm.

Unlike traverse_perm, the operation cannot stop the traversal early.

Template Parameters
TElement type.
OpCallable with signature void(const DynList<T>&).
Parameters
[in]lList of lists.
[in]opOperation to run on each permutation.

Definition at line 482 of file ah-comb.H.

References l, row, and traverse_perm().

Referenced by build_combs(), build_perms(), demo_permutations(), demo_practical(), filter_perm(), for_each_perm(), map_perm(), TEST(), and TEST().

◆ ford_fulkerson_maximum_flow()

template<class Net >
Net::Flow_Type Aleph::ford_fulkerson_maximum_flow ( Net &  net)

Maximize flow using the Ford-Fulkerson algorithm.

With an integer flow, it takes the augmenting paths of a depth-first search. With a floating flow, it takes the shortest ones, those of edmonds_karp_maximum_flow(): rounding leaves residues of the order of an ulp on the arcs, which the paths of a depth-first search take and spread, taking the flows off the multiples of the data, so that the augmentations, bounded only by the value of the flow over the least of its units, did not end on networks of some hundreds of nodes with capacities in tenths. The number of shortest augmentations is O(V E), whatever the capacities.

Parameters
[in,out]netFlow network (must have a single source and sink).
Returns
Maximized flow value.

Definition at line 2306 of file tpl_net.H.

Referenced by demo_benchmarking(), demonstrate_bipartite_matching(), main(), Aleph::Ford_Fulkerson_Maximum_Flow< Net >::operator()(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ format_string() [1/3]

DynList< DynList< std::string > > Aleph::format_string ( const DynList< DynList< std::string > > &  mat)
inline

Format a matrix by computing column widths.

Parameters
[in]matInput matrix.
Returns
Matrix of padded strings.

Definition at line 984 of file ah-string-utils.H.

References FunctionalMethods< Container, T >::foldl(), format_string(), l, FunctionalMethods< Container, T >::maps(), and zip().

◆ format_string() [2/3]

DynList< DynList< std::string > > Aleph::format_string ( const DynList< size_t > &  lens,
const DynList< DynList< std::string > > &  mat 
)
inline
Parameters
[in]lensparallel row containing the maximum length of each column
[in]matmatrix of strings to format
Returns
formatted matrix with strings aligned according to lens

Definition at line 937 of file ah-string-utils.H.

References l, FunctionalMethods< Container, T >::maps(), and zip().

Referenced by format_string(), TEST(), TEST(), and TEST().

◆ format_string() [3/3]

std::ostream & Aleph::format_string ( std::ostream &  out,
const DynList< size_t > &  lens,
const DynList< DynList< std::string > > &  mat 
)
inline

Write a formatted matrix to a stream.

Parameters
[in,out]outOutput stream.
[in]lensColumn widths.
[in]matMatrix.
Returns
Reference to out.

Definition at line 957 of file ah-string-utils.H.

References FunctionalMethods< Container, T >::for_each(), out, row, and zip().

◆ format_string_csv()

DynList< DynList< std::string > > Aleph::format_string_csv ( const DynList< DynList< std::string > > &  mat)
inline

Produce a CSV-like matrix (commas added to all but last element in each row).

Parameters
[in]matInput matrix.
Returns
Matrix where each row has "," appended to non-last cells.

Definition at line 1007 of file ah-string-utils.H.

References Aleph::DynList< T >::append(), LocateFunctions< Container, Type >::get_it(), Aleph::DynList< T >::get_last(), and row.

Referenced by TEST().

◆ gen_random_euclidian_graph()

template<AlephGraph GT>
GT Aleph::gen_random_euclidian_graph ( size_t  n,
size_t  m,
int  w,
int  h,
unsigned int  seed 
)
inline

◆ gen_seq_list_tuples()

template<class Container >
auto Aleph::gen_seq_list_tuples ( const Container &  c,
size_t  n 
)

Generate all sequential tuples (sliding windows) of size n.

Creates a list of lists where each inner list is a consecutive sequence of n elements from the source container. This is a sliding window operation.

Template Parameters
ContainerContainer type with iterator.
Parameters
cSource container.
nSize of each tuple (window size).
Returns
DynList of DynLists, each containing n consecutive elements.
Example:
DynList<int> nums = {1, 2, 3, 4, 5};
auto windows = gen_seq_list_tuples(nums, 3);
// windows = { {1, 2, 3}, {2, 3, 4}, {3, 4, 5} }
auto gen_seq_list_tuples(const Container &c, size_t n)
Generate all sequential tuples (sliding windows) of size n.
Note
The source container must have at least n elements.

Definition at line 1560 of file ahFunctional.H.

References Aleph::DynList< T >::append(), l, and Aleph::DynList< T >::remove_first().

Referenced by TEST_F().

◆ generate()

template<class Itor , class Func >
void Aleph::generate ( Itor  beg,
const Itor &  end,
Func  op 
)
inline

Generate values for a range.

Assigns the result of successive calls to op to each element in [beg, end).

Template Parameters
ItorIterator type.
FuncGenerator function type.
Parameters
begIterator to the first element.
endIterator past the last element.
opGenerator function.

Definition at line 746 of file ahAlgo.H.

Referenced by TEST(), and TYPED_TEST().

◆ generate_bipartite_network()

template<class Net >
Net Aleph::generate_bipartite_network ( size_t  left_size,
size_t  right_size,
double  edge_prob = 0.5,
unsigned  seed = 0 
)

Generate a bipartite network for matching.

Creates a bipartite graph with:

  • A super-source connected to all left nodes
  • A super-sink connected from all right nodes
  • Random arcs between left and right nodes

Useful for testing maximum bipartite matching.

Template Parameters
NetNetwork type.
Parameters
left_sizeNumber of nodes on left side.
right_sizeNumber of nodes on right side.
edge_probProbability of edge between left-right pair.
seedRandom seed.
Returns
Bipartite network ready for max-flow = max matching.

Definition at line 302 of file net_utils.H.

References Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), and seed.

◆ generate_cross_graph() [1/3]

template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc >
void Aleph::generate_cross_graph ( GT &  g,
const size_t &  nodes_by_level,
const double &  xdist,
const double &  ydist,
std::ostream &  out 
)

Definition at line 846 of file generate_graph.H.

References out.

◆ generate_cross_graph() [2/3]

template<AlephGraph GT, class Write_Node , class Write_Arc >
void Aleph::generate_cross_graph ( GT &  g,
const size_t &  nodes_by_level,
const double &  xdist,
const double &  ydist,
std::ostream &  out 
)

Definition at line 962 of file generate_graph.H.

References generate_cross_graph(), and out.

◆ generate_cross_graph() [3/3]

template<AlephGraph GT, class Write_Node , class Write_Arc , ArcFilter< GT > SA>
void Aleph::generate_cross_graph ( GT &  g,
const size_t &  nodes_by_level,
const double &  xdist,
const double &  ydist,
std::ostream &  out,
SA  sa = SA() 
)

Definition at line 935 of file generate_graph.H.

References generate_cross_graph(), and out.

◆ generate_grid_network()

template<class Net >
Net Aleph::generate_grid_network ( size_t  rows,
size_t  cols,
typename Net::Flow_Type  capacity,
bool  bidirectional = true 
)

Generate a grid network.

Creates a rows × cols grid with arcs connecting adjacent nodes. Source is top-left (0,0), sink is bottom-right (rows-1, cols-1).

Grid networks are useful for benchmarking because they have predictable structure and many augmenting paths.

Template Parameters
NetNetwork type.
Parameters
rowsNumber of rows.
colsNumber of columns.
capacityCapacity for all arcs.
bidirectionalIf true, create arcs in both directions.
Returns
Generated grid network.
Example
auto net = generate_grid_network<Net_Graph<>>(10, 10, 100.0);
// Creates 100-node grid with 360 arcs

Definition at line 245 of file net_utils.H.

References cols, Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), nodes, and rows.

◆ generate_layered_network()

template<class Net >
Net Aleph::generate_layered_network ( const std::vector< size_t > &  layer_sizes,
typename Net::Flow_Type  capacity,
double  edge_prob = 0.5,
unsigned  seed = 0 
)

Generate a layered network.

Creates a network with multiple layers, where each node in layer i is connected to some nodes in layer i+1.

Template Parameters
NetNetwork type.
Parameters
layer_sizesVector of sizes for each layer.
capacityArc capacity.
edge_probProbability of arc between adjacent layers.
seedRandom seed.
Returns
Layered network.

Definition at line 364 of file net_utils.H.

References ah_invalid_argument_if, and, Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), l, seed, Aleph::DynList< T >::size(), and size().

◆ generate_n()

template<class Itor , class Size , class Func >
void Aleph::generate_n ( Itor  beg,
Size  num,
Func  op 
)
inline

Generate values for n elements.

Assigns the result of successive calls to op to the first n elements.

Template Parameters
ItorIterator type.
SizeInteger type.
FuncGenerator function type.
Parameters
begIterator to the first element.
numNumber of elements to generate.
opGenerator function.

Definition at line 766 of file ahAlgo.H.

Referenced by TEST().

◆ generate_net_graph() [1/3]

template<AlephGraph GT, class Write_Node , class Write_Arc , class Shade_Node , class Shade_Arc >
void Aleph::generate_net_graph ( GT &  g,
const size_t &  nodes_by_level,
const double &  xdist,
const double &  ydist,
std::ostream &  out 
)

Definition at line 904 of file generate_graph.H.

References out.

◆ generate_net_graph() [2/3]

template<AlephGraph GT, class Write_Node , class Write_Arc >
void Aleph::generate_net_graph ( GT &  g,
const size_t &  nodes_by_level,
const double &  xdist,
const double &  ydist,
std::ostream &  out 
)

Definition at line 975 of file generate_graph.H.

References generate_net_graph(), and out.

◆ generate_net_graph() [3/3]

template<AlephGraph GT, class Write_Node , class Write_Arc , ArcFilter< GT > SA>
void Aleph::generate_net_graph ( GT &  g,
const size_t &  nodes_by_level,
const double &  xdist,
const double &  ydist,
std::ostream &  out,
SA  sa = SA() 
)

Definition at line 948 of file generate_graph.H.

References generate_net_graph(), and out.

◆ generate_random_network() [1/2]

template<class Net >
Net Aleph::generate_random_network ( const NetworkGenParams &  params)

Generate a random flow network.

Creates a network with random topology and capacities. Guarantees that the source can reach the sink if ensure_connected is true.

Template Parameters
NetNetwork type.
Parameters
paramsGeneration parameters.
Returns
Generated network with source and sink set.
Example
params.num_nodes = 50;
params.num_arcs = 200;
params.max_capacity = 1000;
auto net = generate_random_network<Net_Graph<>>(params);
Parameters for random network generation.
Definition net_utils.H:102
double max_capacity
Maximum arc capacity.
Definition net_utils.H:106
size_t num_arcs
Target number of arcs.
Definition net_utils.H:104
size_t num_nodes
Number of nodes.
Definition net_utils.H:103

Definition at line 135 of file net_utils.H.

References Aleph::NetworkGenParams::ensure_connected, Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::NetworkGenParams::max_capacity, Aleph::NetworkGenParams::min_capacity, nodes, Aleph::NetworkGenParams::num_arcs, Aleph::NetworkGenParams::num_nodes, seed, and Aleph::NetworkGenParams::seed.

◆ generate_random_network() [2/2]

template<class Net >
Net Aleph::generate_random_network ( size_t  num_nodes,
size_t  num_arcs,
double  min_cap = 1.0,
double  max_cap = 100.0,
unsigned  seed = 0 
)

Generate a random flow network (convenience overload).

Template Parameters
NetNetwork type.
Parameters
num_nodesNumber of nodes.
num_arcsNumber of arcs.
min_capMinimum capacity.
max_capMaximum capacity.
seedRandom seed (0 = use time).
Returns
Generated network.

Definition at line 208 of file net_utils.H.

References Aleph::NetworkGenParams::max_capacity, Aleph::NetworkGenParams::min_capacity, Aleph::NetworkGenParams::num_arcs, num_nodes, Aleph::NetworkGenParams::num_nodes, seed, and Aleph::NetworkGenParams::seed.

◆ generic_preflow_vertex_push_maximum_flow()

template<class Net , class Q_Type >
Net::Flow_Type Aleph::generic_preflow_vertex_push_maximum_flow ( Net &  net,
Q_Type  q = Q_Type() 
)

Generic preflow-push maximum flow (vertex-oriented).

Q_Type is the active-node container and must support:

  • get(): remove a node
  • put(p): insert a node

The Maximum_Flow bit is used to track whether a node is in the queue.

With a floating flow, the flows of the node that a discharge pushes from are summed keeping what their rounding loses, so that a small flow beside a large one is not lost; an excess of a node up to a residue of rounding of its own flows, an epsilon of the larger of its flows in and out by each of its arcs and two more, is not pushed; and at the end what the nodes keep or lack of it goes back toward the source, or forward toward the sink, so that every node keeps its flow within the tolerance of check_node(), as check_network() takes it, and a network whose maximum flow is 0 gives 0.

An arc of infinite capacity out of the source starts with a bound of the maximum flow, the capacity of the arcs into the sink, if they are finite, or else the sum of the finite capacities: filled with infinity, a node that could not send it on could not send it back either, as inf - inf is NaN, and the flow came out infinite on networks whose maximum flow is finite. A path of arcs of infinite capacity from the source to the sink makes the maximum flow infinite: its arcs take an infinite flow, and the function returns it, as the augmenting paths do.

Parameters
[in,out]netFlow network (must have a single source and sink).
[in]qthe queue of the active nodes, empty, which the push takes; by default Q_Type(), and with a seed for the random order of random_preflow_maximum_flow(net, seed).
Returns
Maximized flow value.
See also
fifo_preflow_maximum_flow() heap_preflow_maximum_flow() random_preflow_maximum_flow()

Definition at line 2526 of file tpl_net.H.

References ah_domain_error_if, and, Aleph::Net_Graph< NodeT, ArcT >::check_network(), Aleph::net_detail::fill_infinite_path(), Aleph::Net_Graph< NodeT, ArcT >::flow_value(), GraphCommon< GT, Node, Arc >::get_connected_node(), get_from_active_queue(), Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), GraphCommon< GT, Node, Arc >::get_num_arcs(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::net_detail::infinite_arc_preflow(), init_height_in_nodes(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), m, Aleph::net_detail::Flow_Sum< Flow_Type >::minus(), Aleph::net_detail::node_flows(), Aleph::net_detail::node_residue(), Aleph::net_detail::not_short(), out, Aleph::net_detail::push_excess(), put_in_active_queue(), GraphCommon< GT, Node, Arc >::reset_nodes(), Aleph::net_detail::return_dust(), Aleph::net_detail::Flow_Sum< Flow_Type >::value(), and GraphCommon< GT, Node, Arc >::vsize().

◆ geom_number_to_double()

◆ geom_pi()

const Geom_Number & Aleph::geom_pi ( )
inline

High-precision pi value for computations that require Geom_Number.

Returns
A reference to the static Geom_Number pi.

Definition at line 137 of file point.H.

References acos().

Referenced by Aleph::Ellipse::area(), Aleph::RotatedEllipse::area(), Aleph::Segment::counterclockwise_angle_with(), Aleph::Ellipse::perimeter(), and Aleph::RotatedEllipse::sample().

◆ get16bits()

std::uint16_t Aleph::get16bits ( const void *  p)
inlinenoexcept

Definition at line 420 of file hash-fct.H.

Referenced by SuperFastHash().

◆ get_array_it()

template<typename T >
Array_Iterator< T > Aleph::get_array_it ( const T *  array,
size_t  n 
)
inline

Create an iterator for a raw array.

Template Parameters
TElement type.
Parameters
arrayPointer to the array.
nNumber of elements.
Returns
Array_Iterator for the array.

Definition at line 379 of file array_it.H.

◆ get_color() [1/2]

template<AlephGraph GT>
static const long & Aleph::get_color ( typename GT::Arc *  a)
inlinestatic

Return the arc color (stored in ARC_COUNTER).

Definition at line 1878 of file tpl_graph_utils.H.

References ARC_COUNTER.

◆ get_color() [2/2]

template<AlephGraph GT>
static const long & Aleph::get_color ( typename GT::Node *  p)
inlinestatic

Return the node color (stored in NODE_COUNTER).

Definition at line 1871 of file tpl_graph_utils.H.

References NODE_COUNTER.

◆ get_curr()

◆ get_curr_list()

DynList< T > Aleph::get_curr_list ( ) const

Returns current elements as a DynList (requires homogeneous Item_Type)

Definition at line 227 of file ah-zip.H.

References Aleph::DynList< T >::append(), and l.

◆ get_curr_ne()

auto Aleph::get_curr_ne ( ) const
noexcept

Return the current tuple (unchecked variant).

Return the current tuple, with the index last (unchecked variant).

Requires has_curr().

Returns
a tuple with a copy of the current item of each container.
Exceptions
whatreading the current items throws, as the get_curr_ne() of the iterator of a container that the user wrote may do even when its items are arithmetic; what copying them throws: the std::bad_alloc of copying a std::string or a DynArray, or what the copy of a type of the user throws; and what moving the items of the other containers throws, as std::tuple_cat() moves them from the tuple of the rest of the zip into this one: an item whose copy cannot throw may have a move that does.
Note
It is noexcept only when none of these readings, copies and moves can throw, as with the arithmetic items of the containers of Aleph, so that what they throw reaches the caller instead of ending the program.

Requires has_curr().

Returns
a tuple with a copy of the current item of each container and the position.
Exceptions
whatreading, copying or moving the current items throws, as ZipIterator::get_curr_ne(): the reading of a container that the user wrote may throw even when its items are arithmetic, and std::tuple_cat() moves the items of the other containers, whose move may throw even when their copy cannot.
Note
It is noexcept only when none of these readings, copies and moves can throw, as ZipIterator::get_curr_ne(), so that what they throw reaches the caller instead of ending the program.

Definition at line 216 of file ah-zip.H.

Referenced by Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::get_current_arc_ne(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::Arc_Iterator::get_current_arc_ne(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::Node_Iterator::get_current_node_ne(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::get_tgt_node_ne(), and TEST().

◆ get_enum_zip_it()

template<class... Cs>
EnumZipIterator< Cs... > Aleph::get_enum_zip_it ( const Cs &...  cs)
inline

Create an EnumZipIterator over the given containers.

Parameters
csContainers to zip.
Returns
EnumZipIterator positioned at the first element (index 0).

Definition at line 1394 of file ah-zip.H.

Referenced by t_enum_zip(), and t_enum_zip_eq().

◆ get_enum_zip_it_pos()

template<class C , class... Cs>
EnumZipIterator< C, Cs... > Aleph::get_enum_zip_it_pos ( size_t  pos,
const C &  c,
const Cs &...  cs 
)
inline

Create an EnumZipIterator positioned at index pos.

Parameters
posStarting position.
cFirst container.
csAdditional containers.
Returns
EnumZipIterator advanced pos positions.

Definition at line 1408 of file ah-zip.H.

Referenced by enum_zip_it_pos().

◆ get_freq()

static const size_t & Aleph::get_freq ( Huffman_Node *  huffman_node)
inlinestaticnoexcept

Definition at line 93 of file Huffman.H.

Referenced by Aleph::Huffman_Encoder_Engine::merge_two_nodes().

◆ get_from_active_queue()

template<class Q_Type >
static Q_Type::Item_Type Aleph::get_from_active_queue ( Q_Type &  q)
inlinestatic

Dequeue an active node and clear its queue mark.

Definition at line 2401 of file tpl_net.H.

References Maximum_Flow, and NODE_BITS.

Referenced by generic_preflow_vertex_push_maximum_flow().

◆ get_futures() [1/4]

template<typename T >
DynList< T > Aleph::get_futures ( DynList< std::future< T > > &&  future_list)
inline

Collect results from a list of futures (rvalue overload).

Overload for rvalue references, allowing temporary lists to be passed.

Template Parameters
TThe result type of the futures.
Parameters
[in]future_listTemporary list of futures to collect.
Returns
DynList containing all the results.
Exceptions
Anyexception thrown by any of the futures will propagate.
See also
get_futures(DynList<std::future<T>> &)

Definition at line 119 of file future_utils.H.

References get_futures().

◆ get_futures() [2/4]

template<typename T >
DynList< T > Aleph::get_futures ( DynList< std::future< T > > &  future_list)
inline

Collect results from a list of futures.

Waits for each future in the list to complete and collects all results into a new DynList. The futures are consumed (removed) from the input list in FIFO order.

Template Parameters
TThe result type of the futures.
Parameters
[in,out]future_listList of futures to collect. Will be empty after the call.
Returns
DynList containing all the results in the order the futures were stored in the list.
Exceptions
Anyexception thrown by any of the futures will propagate.
Note
This function blocks until all futures have completed.
The order of results matches the order of futures in the list, not the order in which the async operations completed.
See also
std::future

Definition at line 94 of file future_utils.H.

References Aleph::DynList< T >::append().

Referenced by get_futures(), get_futures(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ get_futures() [3/4]

void Aleph::get_futures ( DynList< std::future< void > > &&  future_list)
inline

Wait for all void futures to complete (rvalue overload).

Overload for rvalue references, allowing temporary lists to be passed.

Parameters
[in]future_listTemporary list of void futures to wait for.
Exceptions
Anyexception thrown by any of the futures will propagate.
See also
get_futures(DynList<std::future<void>> &)

Definition at line 155 of file future_utils.H.

References get_futures().

◆ get_futures() [4/4]

void Aleph::get_futures ( DynList< std::future< void > > &  future_list)
inline

Wait for all void futures to complete.

Waits for each void future in the list to complete. Since void futures don't return values, this function simply ensures all async operations have finished. The futures are consumed from the input list.

Parameters
[in,out]future_listList of void futures to wait for. Will be empty after the call.
Exceptions
Anyexception thrown by any of the futures will propagate.
Note
This function blocks until all futures have completed.
See also
std::future<void>

Definition at line 139 of file future_utils.H.

References Aleph::DynList< T >::remove_first().

◆ get_min_path()

template<AlephGraph GT, ArcDistance< GT > Distance = Dft_Dist<GT>>
Distance::Distance_Type Aleph::get_min_path ( typename GT::Node *  s,
typename GT::Node *  end,
Path< GT > &  path,
Distance  distance = Distance() 
)

Extracts a shortest path from a graph painted by a shortest paths algorithm.

Follows the node cookies, which point to the parent of each node in the painted tree, from end back to s.

Parameters
[in]sStart node of the painted tree.
[in]endDestination node of the path.
[out]pathPath where the shortest path is stored.
[in]distanceDistance functor that gives the weight of each arc; it should be the one the tree was painted with.
Returns
The total cost of the path.
Exceptions
std::invalid_argumentIf s or end is null.
std::domain_errorIf the cookies do not lead from end to s.
std::bad_allocIf there is not enough memory.

Definition at line 2515 of file tpl_graph_utils.H.

References ah_domain_error_if, ah_invalid_argument_if, Aleph::Path< GT >::append(), Aleph::Path< GT >::empty(), Aleph::Path< GT >::get_graph(), LocateFunctions< Container, Type >::get_it(), Aleph::Path< GT >::init(), Aleph::DynList< T >::insert(), and NODE_COOKIE.

◆ get_pair_it() [1/2]

template<class C1 , class C2 >
auto Aleph::get_pair_it ( C1 &  c1,
C2 &  c2 
)
inline

Create a Pair_Iterator for two containers.

Factory function that creates a Pair_Iterator from two containers, automatically deducing the iterator types.

Template Parameters
C1Type of first container.
C2Type of second container.
Parameters
c1First container.
c2Second container.
Returns
Pair_Iterator positioned at the beginning of both containers.
See also
Pair_Iterator for usage examples.

Definition at line 1841 of file ahFunctional.H.

References iterator_for().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ get_pair_it() [2/2]

template<class C1 , class C2 >
auto Aleph::get_pair_it ( C1 &  c1,
C2 &  c2,
const size_t  pos 
)
inline

Overload of get_pair_it with start position.

Definition at line 1850 of file ahFunctional.H.

References iterator_for().

◆ get_partial_arcs()

template<class Net >
DynList< typename Net::Arc * > Aleph::get_partial_arcs ( const Net &  net)
inline

Get arcs with partial flow (0 < flow < cap).

Template Parameters
NetNetwork type.
Parameters
[in]netNetwork to scan.
Returns
List of arcs with partial flow.

Definition at line 1123 of file tpl_netcost.H.

References and, and Aleph::DynList< T >::append().

◆ get_unitarian_DynList()

template<typename T >
DynList< T > Aleph::get_unitarian_DynList ( const T &  item)
inline

Definition at line 2095 of file htlist.H.

References Aleph::DynList< T >::append().

◆ get_zip_it()

template<class... Cs>
ZipIterator< Cs... > Aleph::get_zip_it ( const Cs &...  cs)
inline

Create a ZipIterator over the given containers.

Parameters
csContainers to zip.
Returns
ZipIterator positioned at the first element.

Definition at line 336 of file ah-zip.H.

Referenced by equal_length(), main(), zip_cmp(), zip_for_each_eq(), zip_it(), zip_lists(), and zip_lists_eq().

◆ get_zip_it_pos()

template<class... Cs>
ZipIterator< Cs... > Aleph::get_zip_it_pos ( size_t  pos,
const Cs &...  cs 
)
inline

Create a ZipIterator positioned at index pos.

Parameters
posStarting position.
csContainers to zip.
Returns
ZipIterator advanced pos positions.

Definition at line 349 of file ah-zip.H.

Referenced by zip_it_pos().

◆ gray_to_bin()

template<std::unsigned_integral T>
constexpr T Aleph::gray_to_bin ( T  g)
constexprnoexcept

Convert a Gray code number to its binary representation.

The conversion is performed by iteratively XORing the Gray code with right-shifted versions of itself.

Template Parameters
TUnsigned integral type.
Parameters
gGray code number.
Returns
Binary representation of g.

Definition at line 1088 of file ah-comb.H.

Referenced by main(), TEST(), and TEST().

◆ greater_or_equal_than() [1/2]

template<class T , class Compare >
bool Aleph::greater_or_equal_than ( const T &  op1,
const T &  op2,
Compare &&  cmp = Compare() 
)
inline

Determines if op1 is greater than or equal to op2 using a comparison operator.

Parameters
op1First operand
op2Second operand
cmpComparison functor
Returns
true if op1 >= op2 according to cmp

Definition at line 1077 of file ahFunction.H.

References cmp().

◆ greater_or_equal_than() [2/2]

template<class T , class Compare >
bool Aleph::greater_or_equal_than ( const T &  op1,
const T &  op2,
Compare &  cmp 
)
inline

See greater_or_equal_than().

Definition at line 1088 of file ahFunction.H.

References cmp().

◆ greater_than() [1/2]

template<class T , class Compare >
bool Aleph::greater_than ( const T &  op1,
const T &  op2,
Compare &&  cmp = Compare() 
)
inline

Determines if op1 is greater than op2 using a comparison operator.

Parameters
op1First operand
op2Second operand
cmpComparison functor
Returns
true if op1 > op2 according to cmp

Definition at line 1052 of file ahFunction.H.

References cmp().

◆ greater_than() [2/2]

template<class T , class Compare >
bool Aleph::greater_than ( const T &  op1,
const T &  op2,
Compare &  cmp 
)
inline

See greater_than().

Definition at line 1063 of file ahFunction.H.

References cmp().

◆ group_by()

template<typename T , template< typename > class Container, class KeyFunc >
DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, DynList< T > > > Aleph::group_by ( const Container< T > &  c,
KeyFunc  key_func 
)

Group consecutive elements by a key function.

Partitions a container into groups of consecutive elements that share the same key (as computed by the key function). Each group is a DynList containing all consecutive elements with the same key.

This is similar to Python's itertools.groupby() or SQL's GROUP BY (but only for consecutive elements with the same key).

Template Parameters
TElement type of the container.
ContainerContainer type (template parameter).
KeyFuncFunction type (const T&) -> Key.
Parameters
cSource container.
key_funcFunction that extracts the grouping key from each element.
Returns
DynList of pairs, where each pair contains:
  • first: The key value for the group
  • second: DynList of consecutive elements with that key
Example:
DynList<int> nums = {1, 1, 2, 3, 3, 3, 2, 2};
// Group by identity (consecutive equal values)
auto groups = group_by(nums, [](int x) { return x; });
// groups contains:
// (1, {1, 1})
// (2, {2})
// (3, {3, 3, 3})
// (2, {2, 2})
// Group by even/odd
auto parity_groups = group_by(nums, [](int x) { return x % 2; });
// parity_groups contains:
// (1, {1, 1}) // odd
// (0, {2}) // even
// (1, {3, 3, 3}) // odd
// (0, {2, 2}) // even
DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, DynList< T > > > group_by(const Container< T > &c, KeyFunc key_func)
Group consecutive elements by a key function.
Note
Unlike SQL GROUP BY, this only groups CONSECUTIVE elements. Non-consecutive elements with the same key will form separate groups.
For grouping all elements regardless of position, sort the container first or use a map-based approach.
See also
sequential_groups() for grouping by equality.
unique_sequential() for getting unique consecutive values.

Definition at line 3034 of file ahFunctional.H.

Referenced by demo_grouping(), group_by_reduce(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ group_by_eq()

template<typename T , template< typename > class Container, class KeyFunc , class KeyEqual >
DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, DynList< T > > > Aleph::group_by_eq ( const Container< T > &  c,
KeyFunc  key_func,
KeyEqual  key_equal 
)

Group consecutive elements by a key function with custom equality.

Like group_by() but uses a custom equality predicate for comparing keys instead of operator==. This is useful when the key type doesn't have operator== defined, or when you need custom comparison semantics.

Template Parameters
TElement type of the container.
ContainerContainer type (template parameter).
KeyFuncFunction type (const T&) -> Key.
KeyEqualPredicate type (const Key&, const Key&) -> bool.
Parameters
cSource container.
key_funcFunction that extracts the grouping key from each element.
key_equalPredicate that returns true if two keys are equal.
Returns
DynList of pairs (key, group).
Example:
struct Point { double x, y; };
DynList<Point> points = {{1.0, 2.0}, {1.001, 2.001}, {5.0, 5.0}};
// Group by approximate x coordinate (within 0.01)
auto groups = group_by_eq(points,
[](const Point& p) { return p.x; },
[](double a, double b) { return std::abs(a - b) < 0.01; });
// First group: {(1.0, 2.0), (1.001, 2.001)}
// Second group: {(5.0, 5.0)}
DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, DynList< T > > > group_by_eq(const Container< T > &c, KeyFunc key_func, KeyEqual key_equal)
Group consecutive elements by a key function with custom equality.
See also
group_by() for version using operator==.

Definition at line 3101 of file ahFunctional.H.

◆ group_by_reduce()

template<typename T , template< typename > class Container, class KeyFunc , class Reducer >
auto Aleph::group_by_reduce ( const Container< T > &  c,
KeyFunc  key_func,
Reducer  reducer 
) -> DynList< std::pair<std::invoke_result_t<KeyFunc, const T &>, std::invoke_result_t<Reducer, const DynList<T> &>>>

Group consecutive elements and apply a reducer to each group.

Combines group_by() with a reduction operation. For each group of consecutive elements sharing the same key, applies a reducer function to produce a single output value.

This is similar to SQL's GROUP BY ... aggregate() pattern.

Template Parameters
TElement type of the container.
ContainerContainer type (template parameter).
KeyFuncFunction type (const T&) -> Key.
ReducerFunction type (const DynList<T>&) -> R.
Parameters
cSource container.
key_funcFunction that extracts the grouping key from each element.
reducerFunction that reduces each group to a single value.
Returns
DynList of pairs (key, reduced_value).
Example:
DynList<int> nums = {1, 1, 1, 2, 2, 3, 3, 3, 3};
// Count elements in each group
auto counts = group_by_reduce(nums,
[](int x) { return x; }, // key = value itself
[](const DynList<int>& g) { return g.size(); }); // count
// counts contains: {(1, 3), (2, 2), (3, 4)}
// Sum elements in each group
auto sums = group_by_reduce(nums,
[](int x) { return x; },
[](const DynList<int>& g) { return sum(g); });
// sums contains: {(1, 3), (2, 4), (3, 12)}
auto group_by_reduce(const Container< T > &c, KeyFunc key_func, Reducer reducer) -> DynList< std::pair< std::invoke_result_t< KeyFunc, const T & >, std::invoke_result_t< Reducer, const DynList< T > & > > >
Group consecutive elements and apply a reducer to each group.
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
See also
group_by() for version without reduction.

Definition at line 3172 of file ahFunctional.H.

References group_by().

Referenced by TEST().

◆ has_curr()

◆ hash_combine()

void Aleph::hash_combine ( size_t &  seed,
size_t  h 
)
inlinenoexcept

Non-commutative hash combiner (Boost-style golden-ratio mix).

Folds h into seed: seed ^= h + 0x9e3779b97f4a7c15 + (seed << 12) + (seed >> 4)

The magic constant is the nearest prime to 2^64 / phi.

Parameters
seedAccumulator; updated in place.
hHash value to fold in.

Definition at line 877 of file hash-fct.H.

References h, and seed.

Referenced by aleph_hash_value(), UserTypeNS::aleph_hash_value(), Aleph::Aleph_Hash< T >::operator()(), pair_dft_hash_fct(), and pair_snd_hash_fct().

◆ heap_preflow_maximum_flow()

template<class Net >
Net::Flow_Type Aleph::heap_preflow_maximum_flow ( Net &  net)

Preflow-push maximum flow using a height-ordered heap.

Parameters
[in,out]netFlow network (must have a single source and sink).
Returns
Maximized flow value.

Definition at line 2706 of file tpl_net.H.

Referenced by Aleph::Heap_Preflow_Maximum_Flow< Net >::operator()(), and TEST().

◆ heapsort() [1/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::heapsort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Sort a dynamic array using heapsort.

Heapsort uses the heap data structure to sort an array. It first builds a max-heap using Floyd's algorithm (O(n)), then repeatedly extracts the maximum element.

Algorithm

  1. Build a max-heap using Floyd's bottom-up construction (O(n))
  2. Repeatedly: a. Swap root (max element) with last unsorted element b. Reduce heap size by 1 c. Sift down the new root to restore heap property

Characteristics

  • Time complexity: O(n log n) - always (best, average, worst)
  • Space complexity: O(1) - in-place
  • Stability: Not stable
  • Adaptive: No

When to Use

  • When guaranteed O(n log n) worst case is critical
  • When O(1) extra space is required
  • Real-time systems (predictable performance)
  • When data is expected to be adversarial (quicksort killers)

Comparison with Other O(n log n) Algorithms

  • Slower than quicksort in practice (poor cache locality)
  • Faster worst-case than quicksort
  • Uses less space than merge sort
  • Not stable like merge sort
Template Parameters
TElement type (must be swappable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aThe dynamic array to sort.
cmpComparison functor.
See also
quicksort(), mergesort(), selection_sort()

Definition at line 3827 of file tpl_sort_utils.H.

References cmp(), sift_down(), and Aleph::DynArray< T >::size().

◆ heapsort() [2/2]

template<typename T , class Compare = Aleph::less<T>>
requires StrictWeakOrder<Compare, T>
constexpr void Aleph::heapsort ( T *  array,
const size_t  n,
const Compare &  cmp = Compare() 
)
inlineconstexpr

Sort an array using the heapsort algorithm.

heapsort(array, n) builds a heap on top of the range and performs repeated extractions. The running time is \(O(n \log n)\) and does not require additional memory.

Template Parameters
Telement type
Comparecomparator defining the heap order
Parameters
[in,out]arraypointer to the first element to sort
[in]nnumber of elements in the range
[in]cmpcomparison function (default: Aleph::less<T>)
See also
insertion_sort() quicksort_rec() mergesort()
selection_sort() faster_heapsort()

Definition at line 335 of file tpl_arrayHeap.H.

References cmp(), Aleph::arrayheap_detail::sift_down(), and Aleph::arrayheap_detail::sift_up().

Referenced by benchmark_array_algorithms(), main(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ heapsort_subrange()

template<typename T , class Compare >
void Aleph::heapsort_subrange ( DynArray< T > &  a,
const long  l,
const long  r,
const Compare &  cmp 
)
inline

Heapsort implementation for a subrange of a DynArray.

Sorts the elements in the range [l, r] (inclusive) using the heapsort algorithm.

Time complexity: O(n log n). Space complexity: O(1).

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]aThe dynamic array.
[in]lLeft index (inclusive).
[in]rRight index (inclusive).
[in]cmpComparison functor.

Definition at line 4046 of file tpl_sort_utils.H.

References cmp(), l, r, and sift_down_subrange().

◆ histogram()

template<typename Container >
auto Aleph::histogram ( const Container &  data,
size_t  num_bins 
) -> std::vector<std::pair<std::decay_t<decltype(*std::begin(data))>, size_t>>

Compute a histogram of the data.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
num_binsNumber of bins
Returns
Vector of pairs (bin_center, count)
Exceptions
std::invalid_argumentif container is empty or num_bins is 0

Definition at line 717 of file stat_utils.H.

References ah_invalid_argument_if, histogram(), min_max(), and range().

Referenced by histogram(), TEST(), TEST(), TEST(), TEST(), TEST(), and Aleph::CA::Reproductions::write_histogram_csv().

◆ hlpp_excess()

template<class Net >
Net::Flow_Type & Aleph::hlpp_excess ( typename Net::Node *  p)
inlinenoexcept

Access the excess flow stored in the node's cookie.

Definition at line 1231 of file tpl_maxflow.H.

References NODE_COOKIE.

◆ hlpp_height()

template<class Net >
long & Aleph::hlpp_height ( typename Net::Node *  p)
inlinenoexcept

Access the height label stored in the node's cookie.

Definition at line 1224 of file tpl_maxflow.H.

References NODE_COOKIE.

◆ hlpp_maximum_flow()

template<FlowNetwork Net>
Net::Flow_Type Aleph::hlpp_maximum_flow ( Net &  net)

Compute maximum flow using Highest-Label Preflow-Push.

This variant of preflow-push always processes the active node with the highest label (distance from sink). This leads to better practical performance than generic preflow-push.

Complexity

O(V²√E) - often fastest in practice for dense graphs.

With a floating flow, the excess of a node is that of its flows in and out, which each push updates keeping what their rounding loses, so that a small flow beside a large one is not lost; an excess up to a residue of rounding of its own flows, an epsilon of the larger of its flows in and out by each of its arcs and two more, is not pushed; and at the end what the nodes keep or lack of it goes back toward the source, or forward toward the sink, so that every node keeps its flow within the tolerance of check_node(), as check_network() takes it, and a network whose maximum flow is 0 gives 0.

An arc of infinite capacity out of the source starts with a bound of the maximum flow, as in generic_preflow_vertex_push_maximum_flow(): filled with infinity, the flow came out infinite on networks whose maximum flow is finite; and a path of arcs of infinite capacity from the source to the sink makes the maximum flow infinite, which the function returns.

Template Parameters
NetNetwork type.
Parameters
netFlow network.
Returns
Maximum flow value.

Definition at line 1269 of file tpl_maxflow.H.

References ah_domain_error_if, and, Aleph::net_detail::fill_infinite_path(), Aleph::Net_Graph< NodeT, ArcT >::flow_value(), Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_num_arcs(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), h, Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::net_detail::infinite_arc_preflow(), Aleph::DynListQueue< T >::is_empty(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), next(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, Aleph::net_detail::node_residue(), out, Aleph::net_detail::push_excess(), Aleph::DynListQueue< T >::put(), Aleph::net_detail::return_dust(), and GraphCommon< GT, Node, Arc >::vsize().

Referenced by main(), Aleph::HLPP_Maximum_Flow< Net >::operator()(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ hopcroft_karp_dfs()

template<AlephGraph GT, ArcFilter< GT > SA>
static bool Aleph::hopcroft_karp_dfs ( const GT &  g,
typename GT::Node *  u,
Dfs_Stack< Hopcroft_Karp_Frame< GT, SA > > &  frames,
const SA &  sa 
)
static

◆ hopcroft_karp_match()

template<AlephGraph GT, ArcFilter< GT > SA>
void Aleph::hopcroft_karp_match ( const GT &  g,
Hopcroft_Karp_Frame< GT, SA > &  f 
)
inlinenoexcept

◆ hopcroft_karp_next()

template<AlephGraph GT, ArcFilter< GT > SA>
GT::Node * Aleph::hopcroft_karp_next ( const GT &  g,
Hopcroft_Karp_Frame< GT, SA > &  f,
bool &  free 
)
inlinenoexcept

◆ ida_star_search() [1/2]

template<IDAStarDomain Domain>
auto Aleph::ida_star_search ( Domain  domain,
typename Domain::State  initial_state,
ExplorationPolicy  policy = {},
SearchLimits  limits = {} 
)

Convenience wrapper for a one-shot IDA* search.

Definition at line 462 of file State_Search_IDA_Star.H.

References ida_star_search().

Referenced by ida_star_search(), and ida_star_search().

◆ ida_star_search() [2/2]

template<IDAStarDomain Domain, typename OnSolution >
requires SearchSolutionVisitor<OnSolution, SearchSolution<typename Domain::State, typename Domain::Move>>
auto Aleph::ida_star_search ( Domain  domain,
typename Domain::State  initial_state,
OnSolution &  on_solution,
ExplorationPolicy  policy = {},
SearchLimits  limits = {} 
)

Convenience wrapper for IDA* with a solution callback.

Definition at line 474 of file State_Search_IDA_Star.H.

References ida_star_search().

◆ import_network_from_dimacs()

template<class Net >
Net Aleph::import_network_from_dimacs ( const std::string &  filename)

Import network from DIMACS max-flow format.

Template Parameters
NetNetwork type.
Parameters
filenameInput filename.
Returns
Imported network.
Exceptions
std::runtime_errorIf file cannot be opened or parsed: a line whose fields cannot be read, a second problem line, a node or arc line before the problem line, or a node number outside [1, n].

Definition at line 869 of file net_utils.H.

References ah_runtime_error_if, and, OhashCommon< HashTbl, Key >::append(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), m, and nodes.

◆ in_circle()

InCircleResult Aleph::in_circle ( const Point &  a,
const Point &  b,
const Point &  c,
const Point &  p 
)
inline

Classify point p against circumcircle of triangle (a,b,c), exactly.

Returns
INSIDE/ON_CIRCLE/OUTSIDE. If (a,b,c) is collinear, returns DEGENERATE.

Definition at line 2943 of file point.H.

References CCW, COLLINEAR, DEGENERATE, in_circle_determinant(), INSIDE, ON_CIRCLE, orientation(), and OUTSIDE.

Referenced by scenario_in_circle_in_delaunay_context(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ in_circle_determinant()

Geom_Number Aleph::in_circle_determinant ( const Point &  a,
const Point &  b,
const Point &  c,
const Point &  p 
)
inline

◆ in_place_multisort_arrays() [1/2]

template<typename C , typename... Args, typename Cmp = std::less<typename C::value_type>>
void Aleph::in_place_multisort_arrays ( Cmp  cmp,
C &  first,
Args &...  args 
)
inline

Definition at line 896 of file ahSort.H.

References cmp(), and in_place_multisort_arrays().

◆ in_place_multisort_arrays() [2/2]

template<typename C , typename... Args, typename Cmp = std::less<typename C::value_type>>
void Aleph::in_place_multisort_arrays ( Cmp  cmp,
const bool  stable,
C &  first,
Args &...  args 
)
inline

Sorts multiple arrays in place, using the first array as the key.

This function sorts multiple arrays together, keeping them synchronized. The first array provides the sort keys, and all other arrays are rearranged to maintain the correspondence between elements.

By default this uses stable sort, preserving relative order of equal elements. You can disable stability to reduce time and memory overhead.

Template Parameters
CContainer type for the first array (must have operator[], size())
ArgsContainer types for additional arrays
CmpComparison functor type (default: std::less)
Parameters
cmpComparison functor for elements of the first array
stableIf true, preserve the relative order of equal keys.
firstThe array providing sort keys (modified in place)
argsAdditional arrays to sort in sync (modified in place)
Exceptions
std::invalid_argumentif arrays have different sizes
Complexity
O(n log n) time for sorting, O(n) space for indices
Example
std::vector<int> ids = {3, 1, 2};
std::vector<std::string> names = {"Charlie", "Alice", "Bob"};
std::vector<int> ages = {30, 25, 28};
in_place_multisort_arrays(std::less<int>(), ids, names, ages);
// After sorting by id:
// ids = {1, 2, 3}
// names = {"Alice", "Bob", "Charlie"}
// ages = {25, 28, 30}
void in_place_multisort_arrays(Cmp cmp, const bool stable, C &first, Args &... args)
Sorts multiple arrays in place, using the first array as the key.
Definition ahSort.H:842
Note
All arrays MUST have the same size
This is useful for sorting parallel arrays (struct of arrays pattern)

Definition at line 842 of file ahSort.H.

References ah_invalid_argument_if, cmp(), Aleph::Array< T >::create(), introsort(), mergesort(), and swap().

Referenced by in_place_multisort_arrays(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ in_place_sort() [1/2]

template<typename T , class Cmp = Aleph::less<T>>
Array< T > & Aleph::in_place_sort ( Array< T > &  c,
Cmp  cmp = Cmp() 
)
inline

Sorts an Array in place.

Modifies the array directly without creating a copy.

Template Parameters
TElement type
CmpComparison functor type
Parameters
cThe array to sort (modified in place)
cmpComparison functor
Returns
Reference to the sorted array
Note
Uses quicksort, O(n log n) average time

Definition at line 339 of file ahSort.H.

References cmp(), and introsort().

◆ in_place_sort() [2/2]

template<typename T , class Cmp = Aleph::less<T>>
DynArray< T > & Aleph::in_place_sort ( DynArray< T > &  c,
Cmp  cmp = Cmp() 
)
inline

◆ in_place_transpose() [1/2]

template<template< typename > class C, typename T >
void Aleph::in_place_transpose ( C< C< T > > &  l)
inline

In-place transpose of a rectangular matrix stored as a nested container.

Transposes the matrix by moving elements. The matrix is represented as a container of containers (e.g., Array<Array<T>>).

Template Parameters
CContainer template (must support size(), append(), swap(), and random access).
TElement type.
Parameters
[in,out]lMatrix to transpose in-place.
Note
Non-rectangular inputs trigger an assertion in debug builds.
Complexity: Time O(rows * cols), Space O(rows * cols) (internal temporary).

Definition at line 294 of file ah-comb.H.

References Aleph::DynList< T >::get_first(), l, row, Aleph::DynList< T >::size(), size(), and Aleph::DynList< T >::swap().

Referenced by demo_transpose(), test(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ in_place_transpose() [2/2]

template<typename T >
void Aleph::in_place_transpose ( DynList< DynList< T > > &  l)
inline

In-place transpose of a matrix stored as DynList<DynList<T>>.

This overload preserves list nodes by physically moving the internal Slinknc nodes instead of copying values.

Template Parameters
TElement type.
Parameters
[in,out]lMatrix to transpose.
Note
If l is empty, the function is a no-op.
In debug builds, non-rectangular inputs trigger an assertion.

Definition at line 332 of file ah-comb.H.

References Aleph::Array< T >::append(), Aleph::DynList< T >::append(), col, Aleph::HTList::is_empty(), l, Aleph::DynList< T >::remove_first(), Aleph::DynList< T >::remove_head(), Aleph::Array< T >::reserve(), and row.

◆ in_place_unique()

template<AlephSequential Container, class Compare = std::less<typename Container::Key_Type>>
requires Aleph::StrictWeakOrder<Compare, typename Container::Key_Type>
void Aleph::in_place_unique ( Container &  c,
Compare  cmp = {} 
)

Remove duplicates in-place preserving first occurrence order.

Template Parameters
ContainerAlephSequential container type (Array, DynArray, DynList, DynDlist).
CompareStrict weak ordering on Key_Type (defaults to std::less<Key>).
Parameters
cContainer to deduplicate.
cmpComparator for keys.

Definition at line 74 of file ah-unique.H.

Referenced by Aleph::MonotonePolygonTriangulation::build_faces_from_diagonals(), TEST(), and TEST().

◆ includes()

template<class Itor1 , class Itor2 >
bool Aleph::includes ( Itor1  beg,
Itor1  end,
Itor2  searchBeg,
Itor2  searchEnd 
)
inline

Test if one sorted range includes another.

Tests whether all elements in [searchBeg, searchEnd) are contained in the sorted range [beg, end).

Template Parameters
Itor1Main range iterator type.
Itor2Search range iterator type.
Parameters
begIterator to the first element of the main range.
endIterator past the last element of the main range.
searchBegIterator to the first element of the search range.
searchEndIterator past the last element of the search range.
Returns
true if all search elements are found.

Definition at line 1373 of file ahAlgo.H.

References and.

Referenced by TEST(), TEST(), and TEST().

◆ increase_flow() [1/2]

template<class Net >
void Aleph::increase_flow ( Net &  net,
const DynList< Parc< Net > > &  semi_path,
const typename Net::Flow_Type  slack 
)

Increase flow along a semi-path by a given slack.

With a floating type of flow, a flow that rounding leaves next to the capacity of its arc, or next to zero, is set to it. A node may then keep or lack a residue of rounding beyond the tolerance of check_node(), when its flows are such residues, which came from arcs of larger flows: aumenting_path_maximum_flow() returns them at its end.

Parameters
[in,out]netFlow network to update.
[in]semi_pathSemi-path arc list.
[in]slackSlack to apply (not validated).

Definition at line 1763 of file tpl_net.H.

References Aleph::net_detail::add_flow(), Aleph::Net_Graph< NodeT, ArcT >::check_network(), and Aleph::net_detail::subtract_flow().

◆ increase_flow() [2/2]

template<class Net >
Net::Flow_Type Aleph::increase_flow ( Net &  net,
const Path< Net > &  path 
)

Increase flow along an augmenting path.

With a floating type of flow, a flow that rounding leaves next to the capacity of its arc, or next to zero, is set to it.

Parameters
[in,out]netFlow network to update.
[in]pathAugmenting path.
Returns
Slack value used to increase the flow.

Definition at line 1714 of file tpl_net.H.

References Aleph::net_detail::add_flow(), Aleph::Path< GT >::Iterator::has_current_arc(), Aleph::Net_Graph< NodeT, ArcT >::Infinity, Aleph::net_detail::subtract_flow(), Tuple, and w.

Referenced by TEST(), TEST(), and TYPED_TEST().

◆ increase_freq()

static void Aleph::increase_freq ( Huffman_Node *  huffman_node)
inlinestaticnoexcept

Definition at line 98 of file Huffman.H.

Referenced by Aleph::Huffman_Encoder_Engine::update_freq().

◆ indexes()

template<class Container >
DynList< std::pair< size_t, typename Container::Key_Type > > Aleph::indexes ( const Container &  c)
inline

Return pairs of (index, key).

Definition at line 1480 of file ahFunctional.H.

Referenced by main(), and TEST_F().

◆ infix()

template<BinNodeLike Node>
static void Aleph::infix ( Node *  root,
DynList< Node * > &  acc 
)
static

Definition at line 502 of file tpl_binNodeUtils.H.

References Aleph::DynList< T >::append(), infix(), LLINK, RLINK, and root().

Referenced by infix(), infix(), and TEST().

◆ infix_for_each()

template<BinNodeLike Node, class Op >
void Aleph::infix_for_each ( Node *  root,
Op  op 
)

Traverse all the container and performs an operation on each element.

for_each(operation) traverses the container and on each element item is performed operation(item).

operation must have the following signature:

void operation(Node * p)

Overloading of this method allow that the signature can be lightly different; for example, remove the reference or the const.

Parameters
root
[in]opoperation to be done on each element.
Exceptions
anythingthat can throw operation

Definition at line 3226 of file tpl_binNodeUtils.H.

References Aleph::BinNodeInfixIterator< Node >::has_curr(), and root().

◆ Init_Guard()

template<typename CleanupFunc >
Aleph::Init_Guard ( CleanupFunc  ) -> Init_Guard< CleanupFunc >

Deduction guide for Init_Guard.

◆ init_height_in_nodes() [1/2]

template<class Net >
static void Aleph::init_height_in_nodes ( Net &  net)
inlinestatic

Initialize node heights with BFS distance to the sink.

Definition at line 2378 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::get_sink(), and GraphCommon< GT, Node, Arc >::get_tgt_node().

Referenced by generic_preflow_vertex_push_maximum_flow().

◆ init_height_in_nodes() [2/2]

template<class Rnet >
void Aleph::init_height_in_nodes ( Rnet &  rnet,
typename Rnet::Node *  sink 
)
inline

Initialize node heights in a residual network from sink.

Definition at line 2649 of file tpl_net.H.

◆ init_to_Array()

template<class T >
Array< T > Aleph::init_to_Array ( std::initializer_list< T >  il)

Convert an initializer_list to an Array.

Creates a new Array containing copies of all elements from the given initializer_list.

Template Parameters
TThe element type.
Parameters
ilThe source initializer_list.
Returns
An Array containing copies of all elements from il.
Example
auto arr = init_to_Array({1, 2, 3, 4, 5});
Array< T > init_to_Array(std::initializer_list< T > il)
Convert an initializer_list to an Array.
Definition ah-convert.H:810

Definition at line 810 of file ah-convert.H.

References Aleph::Array< T >::append().

Referenced by TEST().

◆ init_to_DynArray()

template<class T >
DynArray< T > Aleph::init_to_DynArray ( std::initializer_list< T >  il)

Convert an initializer_list to a DynArray.

Creates a new DynArray containing copies of all elements from the given initializer_list.

Template Parameters
TThe element type.
Parameters
ilThe source initializer_list.
Returns
A DynArray containing copies of all elements from il.
Example
auto arr = init_to_DynArray({1, 2, 3, 4, 5});
DynArray< T > init_to_DynArray(std::initializer_list< T > il)
Convert an initializer_list to a DynArray.
Definition ah-convert.H:835

Definition at line 835 of file ah-convert.H.

References Aleph::DynArray< T >::append().

Referenced by TEST().

◆ init_to_DynDlist()

template<class T >
DynDlist< T > Aleph::init_to_DynDlist ( std::initializer_list< T >  il)

Convert an initializer_list to a DynDlist.

Creates a new DynDlist containing copies of all elements from the given initializer_list.

Template Parameters
TThe element type.
Parameters
ilThe source initializer_list.
Returns
A DynDlist containing copies of all elements from il.
Example
auto list = init_to_DynDlist({1, 2, 3, 4, 5});
DynDlist< T > init_to_DynDlist(std::initializer_list< T > il)
Convert an initializer_list to a DynDlist.
Definition ah-convert.H:860

Definition at line 860 of file ah-convert.H.

References Aleph::DynDlist< T >::append().

◆ init_to_DynList()

template<class T >
DynList< T > Aleph::init_to_DynList ( std::initializer_list< T >  il)

Convert an initializer_list to a DynList.

Creates a new DynList containing copies of all elements from the given initializer_list.

Template Parameters
TThe element type.
Parameters
ilThe source initializer_list.
Returns
A DynList containing copies of all elements from il.
Example
auto list = init_to_DynList({1, 2, 3, 4, 5});
DynList< T > init_to_DynList(std::initializer_list< T > il)
Convert an initializer_list to a DynList.
Definition ah-convert.H:785

Definition at line 785 of file ah-convert.H.

References Aleph::DynList< T >::append().

Referenced by TEST().

◆ init_token_scanning()

void Aleph::init_token_scanning ( )
inline

Initialize token scanning by recording current position.

Call this before starting to read a new token. It saves the current line and column numbers so that error messages can report where the token began.

Example
// ... read characters for the token ...
close_token_scanning(buffer, ptr, end);
void init_token_scanning()
Initialize token scanning by recording current position.
void close_token_scanning(const char *buffer, char *&start_addr, const char *end_addr)
Finalize token scanning by null-terminating and saving the token.
See also
close_token_scanning()

Definition at line 232 of file parse_utils.H.

References current_col_number, current_line_number, previous_col_number, and previous_line_number.

Referenced by expect(), get_token(), load_binary_number(), load_char_literal(), load_deway_number(), load_double(), load_escaped_string(), load_hex_number(), load_identifier(), load_number(), load_octal_number(), load_string(), and TEST().

◆ inner_product() [1/2]

template<class Itor1 , class Itor2 , class T >
T Aleph::inner_product ( Itor1  beg1,
Itor1  end1,
Itor2  beg2,
T  initValue 
)
inline

Compute inner product of two ranges.

Computes the inner product of elements from [beg1, end1) with elements starting at beg2, initialized with initValue.

Template Parameters
Itor1First range iterator type.
Itor2Second range iterator type.
TAccumulator type.
Parameters
beg1Iterator to the first element of the first range.
end1Iterator past the last element of the first range.
beg2Iterator to the first element of the second range.
initValueInitial value for the accumulation.
Returns
The inner product.

Definition at line 1543 of file ahAlgo.H.

Referenced by TEST(), and TEST().

◆ inner_product() [2/2]

template<class Itor1 , class Itor2 , class T , class BinaryFunc1 , class BinaryFunc2 >
T Aleph::inner_product ( Itor1  beg1,
Itor1  end1,
Itor2  beg2,
T  initValue,
BinaryFunc1  op1,
BinaryFunc2  op2 
)
inline

Compute inner product with custom operations.

Computes a generalized inner product using op1 for accumulation and op2 for combining element pairs.

Template Parameters
Itor1First range iterator type.
Itor2Second range iterator type.
TAccumulator type.
BinaryFunc1Accumulation operation type.
BinaryFunc2Combination operation type.
Parameters
beg1Iterator to the first element of the first range.
end1Iterator past the last element of the first range.
beg2Iterator to the first element of the second range.
initValueInitial value for the accumulation.
op1Binary operation for accumulation.
op2Binary operation for combining element pairs.
Returns
The generalized inner product.

Definition at line 1572 of file ahAlgo.H.

◆ inorder_position() [1/3]

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long Aleph::inorder_position ( Node *  r,
const typename Node::key_type &  key,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See inorder_position().

Definition at line 271 of file tpl_binNodeXt.H.

References cmp(), inorder_position(), and r.

◆ inorder_position() [2/3]

template<BinNodeLike Node, class Compare >
long Aleph::inorder_position ( Node *  r,
const typename Node::key_type &  key,
Compare &  cmp 
)
inlinenoexcept

See inorder_position().

Definition at line 261 of file tpl_binNodeXt.H.

References cmp(), inorder_position(), and r.

◆ inorder_position() [3/3]

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
long Aleph::inorder_position ( Node *  r,
const typename Node::key_type &  key,
Node *&  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See inorder_position().

Definition at line 251 of file tpl_binNodeXt.H.

References cmp(), inorder_position(), and r.

◆ inorder_rec_helper()

template<BinNodeLike Node>
void Aleph::inorder_rec_helper ( Node *  node,
const int &  level,
int &  position,
void(*)(Node *, int, int)  visitFct 
)
inline

Definition at line 162 of file tpl_binNodeUtils.H.

References inorder_rec_helper(), LLINK, and RLINK.

Referenced by inorder_rec_helper(), and inOrderRec().

◆ insert_by_key_xt()

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * Aleph::insert_by_key_xt ( Node *&  r,
Node *  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See insert_by_key_xt(Node *& r, Node * p, Compare & cmp).

Definition at line 442 of file tpl_binNodeXt.H.

References cmp(), insert_by_key_xt(), and r.

◆ insert_child()

template<class TNode , class BNode >
static void Aleph::insert_child ( BNode *  lnode,
TNode *  tree_node 
)
inlinestatic

Definition at line 1791 of file tpl_tree_node.H.

References KEY.

Referenced by bin_to_tree().

◆ insert_dup_by_key_xt()

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * Aleph::insert_dup_by_key_xt ( Node *&  r,
Node *  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See insert_dup_by_key_xt(Node *& r, Node * p, Compare & cmp).

Definition at line 480 of file tpl_binNodeXt.H.

References cmp(), insert_dup_by_key_xt(), and r.

◆ insert_dup_root_xt()

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * Aleph::insert_dup_root_xt ( Node *&  root,
Node *  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See insert_dup_root_xt(Node *& root, Node * p, Compare & cmp).

Definition at line 801 of file tpl_binNodeXt.H.

References cmp(), insert_dup_root_xt(), and root().

◆ insert_in_container()

template<class C , typename... Args>
size_t Aleph::insert_in_container ( C &  c,
Args &&...  args 
)
inline

Insert multiple items into a container.

Each item is passed to c.insert(), in argument order; an rvalue is moved.

Returns
Number of items the container added: a set leaves out a key it already holds (its insert() returns a null pointer then).

Definition at line 1915 of file ahFunctional.H.

Referenced by TEST(), and TEST().

◆ insert_root_xt()

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * Aleph::insert_root_xt ( Node *&  root,
Node *  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See insert_root_xt(Node *& root, Node * p, Compare & cmp).

Definition at line 762 of file tpl_binNodeXt.H.

References cmp(), insert_root_xt(), and root().

◆ insert_sibling()

template<class TNode , class BNode >
static void Aleph::insert_sibling ( BNode *  rnode,
TNode *  tree_node 
)
inlinestatic

Definition at line 1801 of file tpl_tree_node.H.

References KEY.

Referenced by bin_to_tree().

◆ insert_sorted() [1/2]

template<class Compare >
void Aleph::insert_sorted ( Dlink &  list,
Dlink *  p,
const Compare &  cmp 
)
inline

Inserts a node orderly into a doubly linked list.

insert_sorted(list,p) inserts into a list based on Dlink the node pointed to by p.

The ordering criterion is given by the comparison class Compare.

Parameters
[in,out]listthe list to which p will be inserted.
[in]pthe node to be inserted.
cmpcomparison object.
See also
Dlink

Definition at line 968 of file tpl_sort_utils.H.

References and, cmp(), Aleph::Dlink::get_last(), Aleph::Dlink::get_prev(), and Aleph::Dlink::insert().

◆ insert_sorted() [2/2]

◆ insertion_sort() [1/7]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::insertion_sort ( C< T > &  a,
const Compare &  cmp = Compare() 
)
inline

See insertion_sort().

Definition at line 3607 of file tpl_sort_utils.H.

References cmp(), and insertion_sort().

◆ insertion_sort() [2/7]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::insertion_sort ( C< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Sorts a dynamic array by the insert method.

insertion_sort(a) uses the selection method to sort the dynamic arrangement a.

The insert method has a performance of \(O(n^2)\). It is a simple method, so it consumes little constant time. On average, it performs half as many exchanges as the method of selection. Its time tends to be linear if the arrangement is semi-ordered. It is a good method for small arrangements and for partitions made by superior methods but with longer constant times.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.
Parameters
[in,out]athe array to sort.
[in]lleft index of the array art to be would you like to order
[in]rright index of the desired part of the array order.
cmpcomparison object.
See also
selection_sort() quicksort_rec() mergesort() heapsort()

Definition at line 3589 of file tpl_sort_utils.H.

References and, cmp(), l, and r.

◆ insertion_sort() [3/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::insertion_sort ( Dnode< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Insertion sort for Dnode-based lists.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 1097 of file tpl_sort_utils.H.

References cmp().

◆ insertion_sort() [4/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::insertion_sort ( DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Insertion sort for DynDlist.

Without it, a DynDlist would take the template of the arrays.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 1114 of file tpl_sort_utils.H.

References cmp().

◆ insertion_sort() [5/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T > Aleph::insertion_sort ( DynList< T > &&  l,
const Compare &  cmp = Compare() 
)
inline

Insertion sort for DynList (rvalue overload).

Moves the input list into the sorted result. Useful for sorting temporary lists efficiently.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]lThe list to sort (rvalue).
[in]cmpComparison functor.
Returns
The sorted list.

Definition at line 1081 of file tpl_sort_utils.H.

References cmp(), and l.

◆ insertion_sort() [6/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::insertion_sort ( DynList< T > &  l,
const Compare &  cmp = Compare() 
)
inline

Insertion sort for DynList.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]lThe list to sort.
[in]cmpComparison functor.

Definition at line 1062 of file tpl_sort_utils.H.

References cmp(), and l.

◆ insertion_sort() [7/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::insertion_sort ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inlinenoexcept

Sort an array using insertion sort.

Insertion sort builds the sorted array one element at a time by repeatedly taking the next element and inserting it into its correct position among the previously sorted elements.

Algorithm

For each element from position l+1 to r:

  1. Store the element temporarily
  2. Shift larger elements one position to the right
  3. Insert the element in its correct position

Characteristics

  • Time complexity: O(n²) worst/average, O(n) best (nearly sorted)
  • Space complexity: O(1) - in-place
  • Stability: Stable (equal elements maintain relative order)
  • Adaptive: Yes - runs faster on nearly sorted data

When to Use

  • Small arrays (n < 20-50)
  • Nearly sorted data (few inversions)
  • As a base case for recursive sorting algorithms
  • When stability is required with small data
Template Parameters
TElement type (must be copy-assignable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array to sort.
[in]lLeft index (inclusive) of the range to sort.
[in]rRight index (inclusive) of the range to sort.
cmpComparison functor; cmp(x, y) returns true if x < y.
See also
selection_sort(), quicksort(), mergesort(), heapsort()

Definition at line 938 of file tpl_sort_utils.H.

References and, cmp(), l, and r.

Referenced by benchmark_array_algorithms(), benchmark_list_algorithms(), insertion_sort(), introsort(), quicksort(), quicksort_op(), TEST(), TEST(), and TEST_F().

◆ insertion_sort_range()

template<typename Container , class Compare >
static void Aleph::insertion_sort_range ( Container &  a,
long  l,
long  r,
const Compare &  cmp 
)
inlinestatic

Definition at line 3169 of file tpl_sort_utils.H.

References and, cmp(), l, and r.

Referenced by __random_select(), and __random_select().

◆ intercept()

◆ internal_path_length_helper()

template<BinNodeLike Node>
size_t Aleph::internal_path_length_helper ( Node *  p,
const size_t &  level 
)
inlinenoexcept

◆ interpolate()

double Aleph::interpolate ( const double  x1,
const double  x2,
const double  y1,
const double  y2,
const double  x 
)
inline

Basic linear interpolation.

This function receives a pair of points in a plane plus a x point and computes the value of f(x) through linear interpolation

Parameters
[in]x1minimum in x
[in]x2maximum in x
[in]y1value of f(x1)
[in]y2value of f(x2)
[in]xfor which f(x) should be computed
Note
Requires x2 > x1 and x in [x1, x2].

Definition at line 367 of file ahUtils.H.

References and, and y1().

Referenced by TEST().

◆ interpreter_control_flow_name()

const char * Aleph::interpreter_control_flow_name ( const Interpreter_Control_Flow_Kind  kind)
inlinenoexcept

Stable debug name for one control-flow outcome.

Definition at line 133 of file Interpreter_Runtime.H.

References Break, Continue, None, Return, and Runtime_Error.

Referenced by Aleph::Compiler_Driver_Detail::render_run_result().

◆ interpreter_dump_environment()

std::string Aleph::interpreter_dump_environment ( const Interpreter_Environment &  env)
inline

Dumps one environment deterministically.

Parameters
envEnvironment to render.
Returns
Stable textual dump of local bindings.

Definition at line 1541 of file Interpreter_Runtime.H.

References Aleph::Interpreter_Environment::bindings(), interpreter_value_to_string(), out, and size().

◆ interpreter_dump_globals()

std::string Aleph::interpreter_dump_globals ( const Interpreter_Runtime &  runtime)
inline

◆ interpreter_value_kind_name()

const char * Aleph::interpreter_value_kind_name ( const Interpreter_Value_Kind  kind)
inlinenoexcept

◆ interpreter_value_to_string()

std::string Aleph::interpreter_value_to_string ( const Interpreter_Value &  value)
inline

Formats one runtime value deterministically for dumps and tests.

Parameters
valueRuntime value to render.
Returns
Deterministic textual representation.

Definition at line 485 of file Interpreter_Runtime.H.

References Bool, Character, Function, Host_Function, Integer, interpreter_value_to_string(), Invalid, out, size(), String, Tuple, Unit, and value.

Referenced by compiler_bytecode_value_to_string(), Aleph::Compiler_Driver::execute_hir_runtime(), Aleph::Compiler_Generic_Driver::execute_hir_runtime(), interpreter_dump_environment(), interpreter_dump_globals(), interpreter_value_to_string(), main(), and TEST().

◆ interpreter_values_equal()

bool Aleph::interpreter_values_equal ( const Interpreter_Value &  lhs,
const Interpreter_Value &  rhs 
)
inline

◆ intersect_improp()

bool Aleph::intersect_improp ( const Point &  a,
const Point &  b,
const Point &  c,
const Point &  d 
)
inline

Definition at line 109 of file point_utils.H.

References intersect_improp(), and Aleph::Point::is_between().

Referenced by intersect_improp().

◆ intersectp()

bool Aleph::intersectp ( const Point &  a,
const Point &  b,
const Point &  c,
const Point &  d 
)
inline

Definition at line 117 of file point_utils.H.

References intersectp(), and segments_intersect().

Referenced by intersectp().

◆ introsort() [1/5]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::introsort ( Array< T > &  arr,
const Compare &  cmp = Compare() 
)
inline

Introsort for Aleph Array.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]arrArray to sort.
[in]cmpComparison functor.

Definition at line 2500 of file tpl_sort_utils.H.

References cmp(), introsort(), and Aleph::Array< T >::size().

◆ introsort() [2/5]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::introsort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Sort a dynamic array using introsort (introspective sort).

Introsort is a hybrid sorting algorithm that combines quicksort, heapsort, and insertion sort. It provides guaranteed O(n log n) worst-case performance while maintaining quicksort's excellent average-case performance.

This is the recommended general-purpose sorting algorithm.

The pivot of each partition is the median of the first, the middle and the last items of its range.

Characteristics

  • Time complexity: O(n log n) - guaranteed
  • Space complexity: O(log n) for recursion
  • Stability: Not stable
  • In-place: Yes
Template Parameters
TElement type.
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aThe dynamic array to sort.
cmpComparison functor.
Example
DynArray<int> arr = {5, 2, 8, 1, 9};
introsort(arr); // arr is now {1, 2, 5, 8, 9}
void introsort(T *a, const long l, const long r, const Compare &cmp=Compare())
Sort an array using introsort (introspective sort).
See also
quicksort(), heapsort(), mergesort()

Main introsort loop with depth limit.

Definition at line 4136 of file tpl_sort_utils.H.

References cmp(), insertion_sort(), introsort_depth_limit(), Quicksort_Threshold, and Aleph::DynArray< T >::size().

◆ introsort() [3/5]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::introsort ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Sort an array using introsort (introspective sort).

Sorts a[l..r] with pattern-defeating quicksort (O. R. L. Peters, 2021), an introsort that adapts to the patterns of its input.

Algorithm

  1. A range of fewer than 24 items is sorted by insertion.
  2. The pivot is the median of three items, or of nine above 128 items.
  3. The partition compares blocks of 64 items with the pivot, with no branch on the result, and moves only the items on the wrong side (BlockQuicksort, S. Edelkamp and A. Weiss, 2016): the processor mispredicts almost no branch on random input. When a partition swaps few items, as on nearly sorted input, its subranges take a partition with branches, which the processor predicts there.
  4. A partition that moved no item ends its range if an insertion sort with a few moves sorts both sides: sorted input costs O(n).
  5. When the pivot equals the item before its range, which no item of the range is less than, the items equal to it go to their places in one pass: k distinct values cost O(n k).
  6. A highly unbalanced partition swaps some items to break the pattern of the input, and after log2(n) of them the range goes to heapsort.

Characteristics

  • Time complexity: O(n log n) in the worst case; O(n) on a sorted range, or on one in strictly descending order
  • Space complexity: O(log n) for the recursion
  • Stability: Not stable
  • In-place: Yes

On random input it takes from a third (numbers, pointers, small records) to four fifths (strings) of the time of std::sort of libstdc++, and less than it on sorted, reversed, nearly sorted or repeated input.

Template Parameters
TElement type (must be movable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array to sort.
[in]lLeft index (inclusive) of the range to sort.
[in]rRight index (inclusive) of the range to sort.
cmpComparison functor.
Exceptions
Anythingthat cmp throws; a[l..r] then holds its items in some order, as long as moving a T does not throw.
Example
int arr[] = {5, 2, 8, 1, 9, 3};
introsort(arr, 0, 5); // arr is now {1, 2, 3, 5, 8, 9}
// With custom comparator (descending order)
introsort(arr, 0, 5, std::greater<int>());
See also
quicksort(), heapsort(), mergesort()

Definition at line 2427 of file tpl_sort_utils.H.

References cmp(), l, r, and Aleph::pdq_detail::sort_loop().

Referenced by benchmark_array_algorithms(), benchmark_contiguous_array(), compute_stats(), demonstrate_complexity(), in_place_multisort_arrays(), in_place_sort(), in_place_sort(), introsort(), introsort(), introsort(), main(), Aleph::Gen_Mo_On_Trees< GT, Policy >::mo_sweep(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::mo_sweep(), Aleph::Gen_Mo_On_Trees< GT, Policy >::path_solve(), Aleph::Gen_Mo_On_Tree_Node< T, Policy >::path_solve(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::reinsert_farthest(), Aleph::net_detail::return_dust(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::rstar_split(), Aleph::Gen_Mo_Algorithm< T, Policy >::solve(), sort(), sort(), sort(), sort(), Aleph::suffix_structures_detail::sort_matches(), sort_ranked_moves(), subset_sum_mitm(), and TEST().

◆ introsort() [4/5]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::introsort ( T *  a,
const size_t  n,
const Compare &  cmp = Compare() 
)
inline

Sort an array using introsort (convenience overload).

This overload sorts the entire array [0, n-1].

Parameters
[in,out]aPointer to the array to sort.
[in]nNumber of elements in the array.
cmpComparison functor.
See also
introsort(T*, long, long, Compare)

Definition at line 2449 of file tpl_sort_utils.H.

References cmp(), and introsort().

◆ introsort() [5/5]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::introsort ( T *  begin,
T *  end,
const Compare &  cmp = Compare() 
)
inline

Sort a range using introsort (STL-style iterator interface).

This overload provides an STL-compatible interface using begin/end pointers, similar to std::sort(begin, end).

Template Parameters
TElement type (must be swappable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in]beginPointer to the first element.
[in]endPointer to one past the last element.
cmpComparison functor.
Example
int arr[] = {5, 2, 8, 1, 9, 3};
introsort(arr, arr + 6); // Sort entire array
// Sort only elements [1, 4)
introsort(arr + 1, arr + 4);
// With custom comparator
introsort(arr, arr + 6, std::greater<int>());
See also
introsort(T*, long, long, Compare)

Definition at line 2484 of file tpl_sort_utils.H.

References cmp(), and introsort().

◆ introsort_depth_limit()

size_t Aleph::introsort_depth_limit ( size_t  n)
inlinenoexcept

Forward declaration.

Compute the depth limit for introsort.

Returns 2 * floor(log2(n)), which is the maximum recursion depth before introsort switches to heapsort.

Parameters
nThe number of elements.
Returns
The depth limit.

Definition at line 1885 of file tpl_sort_utils.H.

Referenced by introsort(), quicksort(), quicksort(), and quicksort_op().

◆ introsort_loop() [1/2]

template<typename T , class Compare >
void Aleph::introsort_loop ( DynArray< T > &  a,
long  l,
long  r,
size_t  depth_limit,
const Compare &  cmp 
)

Internal recursive function for introsort on DynArray.

Definition at line 4071 of file tpl_sort_utils.H.

References cmp(), l, Aleph::sort_utils_detail::median_of_three_to_last(), partition(), Quicksort_Threshold, and r.

◆ introsort_loop() [2/2]

template<typename T , class Compare >
void Aleph::introsort_loop ( T *  a,
long  l,
long  r,
size_t  depth_limit,
const Compare &  cmp 
)

Quicksort loop with a depth limit, after which heapsort sorts the range: the loop of introsort() before pattern-defeating quicksort.

Definition at line 1902 of file tpl_sort_utils.H.

References cmp(), faster_heapsort(), l, Quicksort_Threshold, and r.

◆ iota() [1/2]

template<AlephSequentialContainer C>
requires requires(typename C::Item_Type v) { ++v; }
void Aleph::iota ( C &  container,
typename C::Item_Type  start 
)

Fill all elements of a container with unit-step sequential values.

Assigns start, start+1, start+2, … to successive elements of container in traversal order (front to back). The container size is unchanged; if it is empty this is a no-op.

Analogous to std::iota but for Aleph-w sequential containers.

Template Parameters
CContainer type satisfying AlephSequentialContainer. Additionally, C::Item_Type must support prefix ++.
Parameters
[in,out]containerContainer whose elements are overwritten.
[in]startFirst value written to the first element.
Example
auto lst = rep(5, 0); // {0, 0, 0, 0, 0}
iota(lst, 1); // {1, 2, 3, 4, 5}
Array<int> arr(4, 0);
iota(arr, 10); // {10, 11, 12, 13}
void iota(C &container, typename C::Item_Type start)
Fill all elements of a container with unit-step sequential values.
See also
fill() For filling with a constant value.
iota(C&,T,T) For a custom step size.

Definition at line 499 of file ahFunctional.H.

Referenced by RankTreeTest< Tree >::SetUp(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and test_sorted_ascending().

◆ iota() [2/2]

template<AlephSequentialContainer C>
requires requires(typename C::Item_Type v, typename C::Item_Type s) { v += s; }
void Aleph::iota ( C &  container,
typename C::Item_Type  start,
const typename C::Item_Type  step 
)

Fill all elements of a container with custom-step sequential values.

Assigns start, start + step, start + 2*step, … to successive elements of container in traversal order. The container size is unchanged; if it is empty this is a no-op.

Template Parameters
CContainer type satisfying AlephSequentialContainer. Additionally, C::Item_Type must support +=.
Parameters
[in,out]containerContainer whose elements are overwritten.
[in]startFirst value written to the first element.
[in]stepIncrement added after each element.
Example
auto lst = rep(4, 0);
iota(lst, 0, 2); // {0, 2, 4, 6}
Array<double> arr(3, 0.0);
iota(arr, 1.0, 0.5); // {1.0, 1.5, 2.0}
See also
fill() For filling with a constant value.
iota(C&,T) For unit-step iota.

Definition at line 534 of file ahFunctional.H.

◆ iqr()

template<typename Container >
auto Aleph::iqr ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute the interquartile range (IQR = Q3 - Q1).

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Interquartile range

Definition at line 426 of file stat_utils.H.

References iqr(), and percentile().

Referenced by iqr(), and TEST().

◆ is_a_cross_arc()

template<AlephGraph GT>
static bool Aleph::is_a_cross_arc ( typename GT::Arc *  a)
inlinestatic

Return true if the arc is marked as a cross-arc by paint_subgraphs().

Definition at line 1822 of file tpl_graph_utils.H.

References ARC_COUNTER, and Cross_Arc.

◆ is_a_cut_node()

template<AlephGraph GT>
static bool Aleph::is_a_cut_node ( typename GT::Node *  p)
inlinestatic

Return true if the node is marked as an articulation point.

Definition at line 1829 of file tpl_graph_utils.H.

References Cut, and NODE_BITS.

◆ is_an_cut_arc()

template<AlephGraph GT>
static bool Aleph::is_an_cut_arc ( typename GT::Arc *  a)
inlinestatic

Return true if the arc is marked as a cut-arc (between cut nodes).

Definition at line 1836 of file tpl_graph_utils.H.

References ARC_BITS, and Cut.

◆ is_arc_painted()

template<AlephGraph GT>
static bool Aleph::is_arc_painted ( typename GT::Arc *  arc)
inlinestatic

Return true if the arc has a positive color.

Definition at line 1850 of file tpl_graph_utils.H.

References ARC_COUNTER.

◆ is_avl_rk()

template<class Node >
bool Aleph::is_avl_rk ( Node *  p)

Verify if tree rooted at p is a valid AVL tree with correct counters.

Parameters
proot of tree to verify
Returns
true if tree is valid AVL with correct counts

Definition at line 124 of file avlNodeRk.H.

References checked_avl_height_rk().

Referenced by TEST(), TEST(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::verify().

◆ is_clockwise()

bool Aleph::is_clockwise ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Definition at line 76 of file point_utils.H.

References area_of_parallelogram(), and is_clockwise().

Referenced by is_clockwise().

◆ is_dinic_cookie_valid()

template<class Net >
bool Aleph::is_dinic_cookie_valid ( typename Net::Node *  p)
inlinenoexcept

Check if a node's cookie is properly initialized for Dinic's algorithm.

Validates that NODE_COOKIE points to a valid Dinic_Node_Info structure.

Template Parameters
NetNetwork type.
Parameters
pPointer to network node.
Returns
true if the cookie is valid, false otherwise.
Exceptions
none
Note
Complexity: O(1)
Thread safety: Thread-safe for read-only access.
Exception safety: noexcept

Definition at line 199 of file tpl_maxflow.H.

References NODE_COOKIE.

◆ is_double()

bool Aleph::is_double ( const std::string &  str)
inline

Check whether a std::string fully parses as a finite double.

Parses using std::strtod and requires that the entire std::string is consumed. Values that overflow/underflow (ERANGE) are rejected.

Parameters
[in]strInput std::string.
Returns
true if str fully parses as a double and is in range.

Definition at line 485 of file ah-string-utils.H.

References and.

Referenced by demo_validation(), TEST(), and TEST().

◆ is_equal() [1/2]

template<typename T >
bool Aleph::is_equal ( const T &  val)
inline

Variadic check for equality against multiple values.

Tests if a value equals any of the provided comparison values. Short-circuits on first match.

Template Parameters
TType of value to test.
Parameters
valValue to compare (no comparisons, returns false).
Returns
false (base case with no values to compare).
Example:
is_equal(5, 1, 3, 5, 7); // true (5 == 5)
is_equal(4, 1, 3, 5, 7); // false
bool is_equal(const T &val)
Variadic check for equality against multiple values.

Definition at line 2164 of file ahFunctional.H.

Referenced by is_equal(), and TEST().

◆ is_equal() [2/2]

template<typename T , typename U , typename... Args>
bool Aleph::is_equal ( const T &  val,
const U &  rhs,
const Args &...  args 
)
inline

Overload of is_equal.

Parameters
valValue to compare.
rhsFirst comparison value.
argsAdditional comparison values.
Returns
true if val equals rhs or any of args.

Definition at line 2177 of file ahFunctional.H.

References is_equal().

◆ is_even()

bool Aleph::is_even ( const long  n)
inline

◆ is_float()

bool Aleph::is_float ( const std::string &  str)
inline

Check whether a std::string fully parses as a finite float.

Parses using std::strtof and requires that the entire std::string is consumed. Values that overflow/underflow (ERANGE) are rejected.

Parameters
[in]strInput std::string.
Returns
true if str fully parses as a float and is in range.

Definition at line 504 of file ah-string-utils.H.

References and.

Referenced by TEST().

◆ is_inside()

template<typename T >
bool Aleph::is_inside ( const T &  val,
const DynList< T > &  values 
)
inline

Check if a value is present in a list.

Linear search through the list to find the value.

Template Parameters
TElement type (must support operator==).
Parameters
valValue to search for.
valuesList to search in.
Returns
true if val is found in values.
Example:
DynList<int> nums = {1, 2, 3, 4, 5};
is_inside(3, nums); // true
is_inside(6, nums); // false
bool is_inside(const T &val, const DynList< T > &values)
Check if a value is present in a list.
See also
contains() for searching in any container type.

Definition at line 2138 of file ahFunctional.H.

Referenced by TEST().

◆ is_inversely_sorted()

template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
bool Aleph::is_inversely_sorted ( const Container< T > &  cont,
const Compare &  cmp = Compare() 
)

Check if a container is sorted in descending order.

Tests whether all elements in the container are arranged in non-increasing order according to the comparison functor.

Time complexity: O(n), where n is the container size.

Template Parameters
ContainerTemplate container type.
TElement type stored in the container.
CompareComparison functor type (default: Aleph::less<T>).
Parameters
contThe container to check.
cmpComparison functor defining "less than" relationship.
Returns
true if container is empty or inversely sorted; false otherwise.
See also
is_sorted()

Definition at line 248 of file tpl_sort_utils.H.

References cmp(), Aleph::Const_Iterator< It >::get_curr(), Aleph::Const_Iterator< It >::has_curr(), and Aleph::Const_Iterator< It >::next_ne().

◆ is_keyword()

bool Aleph::is_keyword ( const std::string &  s,
const std::vector< std::string > &  keywords 
)
inline

Check if a string is in a list of keywords.

Parameters
[in]sThe string to check
[in]keywordsVector of keywords to match against
Returns
true if s matches any keyword
Example
std::vector<std::string> kw = {"if", "while", "for", "return"};
if (is_keyword(identifier, kw)) {
// Handle keyword
}

Definition at line 1251 of file parse_utils.H.

References is_keyword().

Referenced by is_keyword(), TEST(), and TEST().

◆ is_leaf()

◆ is_leap_year()

bool Aleph::is_leap_year ( const size_t  yy)
inlinenoexcept

Return true if the provided year is a leap year.

Definition at line 65 of file ah-date.H.

References and.

Referenced by TEST(), and valid_day().

◆ is_long()

bool Aleph::is_long ( const std::string &  str)
inline

Check whether a std::string fully parses as a long.

Parses using std::strtol and requires that the entire std::string is consumed. Values that overflow/underflow (ERANGE) are rejected.

Parameters
[in]strInput std::string.
Returns
true if str fully parses as a long and is in range.

Definition at line 523 of file ah-string-utils.H.

Referenced by demo_validation(), TEST(), and TEST().

◆ is_multimodal()

template<typename Container >
bool Aleph::is_multimodal ( const Container &  data)

Check if data is multimodal.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
true if multiple values share the maximum frequency

Definition at line 480 of file stat_utils.H.

References count().

Referenced by TEST(), and TEST().

◆ is_node_active() [1/2]

template<class Net >
static bool Aleph::is_node_active ( const Net &  net,
typename Net::Node *  p 
)
inlinestatic

Return true if p has excess flow in net.

Definition at line 2357 of file tpl_net.H.

References Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), and Aleph::Net_Graph< NodeT, ArcT >::get_out_flow().

◆ is_node_active() [2/2]

template<class Rnet >
static bool Aleph::is_node_active ( typename Rnet::Node *  p)
inlinestatic

Return true if residual node p has excess flow.

Definition at line 2364 of file tpl_net.H.

◆ is_node_painted()

template<AlephGraph GT>
static bool Aleph::is_node_painted ( typename GT::Node *  p)
inlinestatic

Return true if the node has a positive color.

Definition at line 1843 of file tpl_graph_utils.H.

References NODE_COUNTER.

◆ is_normal_number()

bool Aleph::is_normal_number ( const double  n)
inline

Return true if a floating-point number is normal or zero.

This excludes NaN, infinities, and subnormal.

Parameters
[in]nValue to classify.
Returns
true if n is a finite number classified as FP_NORMAL or FP_ZERO.

Definition at line 509 of file ahUtils.H.

References bits(), exp(), and frac().

Referenced by LFit::LFit(), and TEST().

◆ is_odd()

bool Aleph::is_odd ( const long  n)
inline

Return true if n is odd.

Definition at line 115 of file ahUtils.H.

References is_even().

Referenced by TEST().

◆ is_power_of_2()

◆ is_prefix()

bool Aleph::is_prefix ( const std::string &  str,
const std::string &  prefix 
)
inline

Check whether prefix is a prefix of str.

Parameters
[in]strInput std::string.
[in]prefixPrefix to test.
Returns
true if str begins with prefix.

Definition at line 601 of file ah-string-utils.H.

References prefix().

Referenced by demo_validation(), remove_prefix(), and TEST().

◆ is_primitive_type()

template<typename T >
bool Aleph::is_primitive_type ( )

Check if type T is a primitive C++ type.

Default template returns false for non-primitive types. Specialized versions return true for primitives.

Template Parameters
TType to check
Returns
true if T is a primitive type, false otherwise

Definition at line 83 of file ahTypes.H.

◆ is_primitive_type< char >()

template<>
bool Aleph::is_primitive_type< char > ( )
inline

Definition at line 99 of file ahTypes.H.

◆ is_primitive_type< double >()

template<>
bool Aleph::is_primitive_type< double > ( )
inline

Definition at line 110 of file ahTypes.H.

◆ is_primitive_type< float >()

template<>
bool Aleph::is_primitive_type< float > ( )
inline

Definition at line 109 of file ahTypes.H.

◆ is_primitive_type< int >()

template<>
bool Aleph::is_primitive_type< int > ( )
inline

Definition at line 103 of file ahTypes.H.

◆ is_primitive_type< long >()

template<>
bool Aleph::is_primitive_type< long > ( )
inline

Definition at line 105 of file ahTypes.H.

◆ is_primitive_type< long double >()

template<>
bool Aleph::is_primitive_type< long double > ( )
inline

Definition at line 111 of file ahTypes.H.

◆ is_primitive_type< long long >()

template<>
bool Aleph::is_primitive_type< long long > ( )
inline

Definition at line 107 of file ahTypes.H.

◆ is_primitive_type< short >()

template<>
bool Aleph::is_primitive_type< short > ( )
inline

Definition at line 101 of file ahTypes.H.

◆ is_primitive_type< unsigned char >()

template<>
bool Aleph::is_primitive_type< unsigned char > ( )
inline

Definition at line 100 of file ahTypes.H.

◆ is_primitive_type< unsigned int >()

template<>
bool Aleph::is_primitive_type< unsigned int > ( )
inline

Definition at line 104 of file ahTypes.H.

◆ is_primitive_type< unsigned long >()

template<>
bool Aleph::is_primitive_type< unsigned long > ( )
inline

Definition at line 106 of file ahTypes.H.

◆ is_primitive_type< unsigned long long >()

template<>
bool Aleph::is_primitive_type< unsigned long long > ( )
inline

Definition at line 108 of file ahTypes.H.

◆ is_primitive_type< unsigned short >()

template<>
bool Aleph::is_primitive_type< unsigned short > ( )
inline

Definition at line 102 of file ahTypes.H.

◆ is_red_black_bst_rk()

template<class Node , class Compare >
bool Aleph::is_red_black_bst_rk ( Node *  node,
Compare &  cmp 
)

Verify that tree rooted at node is a valid red-black BST with counters.

Parameters
noderoot of tree
cmpcomparison criteria
Returns
true if valid

Definition at line 201 of file rbNodeRk.H.

References check_bst(), cmp(), and is_red_black_tree_rk().

Referenced by Aleph::HtdRbTreeRk< Key, Compare >::verify(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::verify(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::verify().

◆ is_red_black_rk()

template<class Node >
bool Aleph::is_red_black_rk ( Node *  node)

Verify if tree rooted at node is a valid red-black tree.

Parameters
noderoot of tree
Returns
true if tree satisfies red-black properties

Definition at line 162 of file rbNodeRk.H.

References BLACK, COLOR, LLINK, max(), RED, RLINK, and test_black_condition_rk().

◆ is_red_black_tree_rk()

template<class Node >
bool Aleph::is_red_black_tree_rk ( Node *  node)

Verify if tree is a valid red-black tree with correct counters.

Checks every node: valid colors, no red node with a red child, the same number of black nodes on every path down to Node::NullPtr, and the counter of each subtree. node itself can be red or black.

Parameters
noderoot of tree
Returns
true if tree is valid

Definition at line 189 of file rbNodeRk.H.

References red_black_height_rk().

Referenced by is_red_black_bst_rk(), and TEST().

◆ is_residual()

template<class Net >
bool Aleph::is_residual ( typename Net::Node *  src,
typename Net::Arc *  a 
)
noexcept

Return true if arc a is residual with respect to src.

Definition at line 212 of file tpl_net.H.

◆ is_size_t()

bool Aleph::is_size_t ( const std::string &  str)
inline

Check whether a std::string fully parses as a non-negative size_t.

Parses using std::strtoull and requires that the entire std::string is consumed. Negative strings are rejected.

Parameters
[in]strInput std::string.
Returns
true if str parses as size_t and is in range.

Definition at line 542 of file ah-string-utils.H.

Referenced by demo_practical(), demo_validation(), TEST(), and TEST().

◆ is_sorted()

template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
bool Aleph::is_sorted ( const Container< T > &  cont,
const Compare &  cmp = Compare() 
)

Check if a container is sorted in ascending order.

Tests whether all elements in the container are arranged in non-decreasing order according to the comparison functor.

Time complexity: O(n), where n is the container size.

Template Parameters
ContainerTemplate container type (must provide Iterator).
TElement type stored in the container.
CompareComparison functor type (default: Aleph::less<T>).
Parameters
contThe container to check.
cmpComparison functor defining "less than" relationship.
Returns
true if container is empty or sorted; false if an inversion is found.
See also
is_inversely_sorted(), search_inversion(), test_sorted()

Definition at line 164 of file tpl_sort_utils.H.

References cmp(), Aleph::Const_Iterator< It >::get_curr(), Aleph::Const_Iterator< It >::has_curr(), and Aleph::Const_Iterator< It >::next_ne().

Referenced by benchmark_array_algorithms(), benchmark_contiguous_array(), benchmark_list_algorithms(), example_parallel_sort(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ is_there_a_double_arc()

template<AlephGraph GT, ArcFilter< GT > SA>
static bool Aleph::is_there_a_double_arc ( const GT *  g,
typename GT::Node *  src,
typename GT::Node *  tgt,
const SA &  sa 
)
inlinestaticnoexcept

Whether the digraph g has, among the arcs that sa shows, an arc from src to tgt and another from tgt to src; false if g is not a digraph.

Exceptions
anythingthat sa throws

Definition at line 120 of file generate_graph.H.

References and.

◆ is_treap()

template<class Node >
bool Aleph::is_treap ( Node *  root)
noexcept

Validate that a tree satisfies treap (heap) property.

Checks that every parent has priority ≤ both children's priorities. This is the min-heap property that treaps maintain along with the BST property.

Template Parameters
NodeTreap node type
Parameters
rootRoot of subtree to validate
Returns
true if heap property holds throughout the subtree
Note
This only checks heap property, not BST ordering. Use with check_bst() for complete validation.
Example
Treap<int> treap;
// ... insertions ...
assert(is_treap(treap.getRoot()));
Node *& getRoot() noexcept
Return the tree's root.
Definition tpl_treap.H:338
bool is_treap(Node *root) noexcept
Validate that a tree satisfies treap (heap) property.
Definition treapNode.H:144
Treap (a special type of randomized binary search tree) using nodes without virtual destructor.
Definition tpl_treap.H:797

Definition at line 144 of file treapNode.H.

References and, is_treap(), LLINK, PRIO(), RLINK, and root().

Referenced by is_treap(), main(), TEST(), TEST(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::verify(), Aleph::Gen_Treap< NodeType, Key, Compare >::verify(), and Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::verify().

◆ iterative_deepening_alpha_beta_search() [1/6]

template<AdversarialGameDomain Domain>
auto Aleph::iterative_deepening_alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Alpha-Beta without tracing.

Definition at line 1117 of file Alpha_Beta.H.

References iterative_deepening_alpha_beta_search().

◆ iterative_deepening_alpha_beta_search() [2/6]

template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto Aleph::iterative_deepening_alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Alpha-Beta using domain.state_key() and no tracing.

Definition at line 1150 of file Alpha_Beta.H.

References iterative_deepening_alpha_beta_search().

◆ iterative_deepening_alpha_beta_search() [3/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto Aleph::iterative_deepening_alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Alpha-Beta with TT/keyer reuse and no tracing.

Definition at line 1132 of file Alpha_Beta.H.

References iterative_deepening_alpha_beta_search().

◆ iterative_deepening_alpha_beta_search() [4/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::iterative_deepening_alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
Tracer &  tracer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Alpha-Beta with TT/keyer reuse.

Definition at line 985 of file Alpha_Beta.H.

References iterative_deepening_alpha_beta_search().

◆ iterative_deepening_alpha_beta_search() [5/6]

template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::iterative_deepening_alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Tracer &  tracer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Alpha-Beta using domain.state_key().

Definition at line 1092 of file Alpha_Beta.H.

References iterative_deepening_alpha_beta_search().

◆ iterative_deepening_alpha_beta_search() [6/6]

template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto Aleph::iterative_deepening_alpha_beta_search ( Domain  domain,
typename Domain::State  initial_state,
Tracer &  tracer,
ExplorationPolicy  policy = Alpha_Beta<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

◆ iterative_deepening_negamax_search() [1/6]

template<AdversarialGameDomain Domain>
auto Aleph::iterative_deepening_negamax_search ( Domain  domain,
typename Domain::State  initial_state,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

◆ iterative_deepening_negamax_search() [2/6]

template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto Aleph::iterative_deepening_negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Negamax using domain.state_key().

Definition at line 1429 of file Negamax.H.

References iterative_deepening_negamax_search().

◆ iterative_deepening_negamax_search() [3/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto Aleph::iterative_deepening_negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Negamax with TT/keyer reuse across iterations.

Definition at line 1370 of file Negamax.H.

References iterative_deepening_negamax_search().

◆ iterative_deepening_negamax_search() [4/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::iterative_deepening_negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
Tracer &  tracer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Negamax with TT/keyer reuse and tracing.

Definition at line 1388 of file Negamax.H.

References iterative_deepening_negamax_search().

◆ iterative_deepening_negamax_search() [5/6]

template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::iterative_deepening_negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Tracer &  tracer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Negamax using domain.state_key() and tracing.

Definition at line 1447 of file Negamax.H.

References iterative_deepening_negamax_search().

◆ iterative_deepening_negamax_search() [6/6]

template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto Aleph::iterative_deepening_negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Tracer &  tracer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {},
AdversarialIterativeDeepeningOptions< typename Domain::Score >  options = {} 
)

Iterative deepening over Negamax with tracing.

Definition at line 1332 of file Negamax.H.

References iterative_deepening_negamax_search().

◆ iterator_for() [1/2]

template<class C >
requires (not std::is_const_v<C>)
auto Aleph::iterator_for ( C &  c)

Iterator on c positioned on its first item: the container's own iterator on a modifiable container.

Parameters
[in]cthe container.
Returns
typename C::Iterator.

Definition at line 547 of file ah-iterator.H.

Referenced by get_pair_it(), get_pair_it(), TEST(), Aleph::TraverseMixin< Derived, Type >::traverse(), Aleph::TraverseMixin< Derived, Type >::traverse(), and GenericTraverse< Container >::traverse().

◆ iterator_for() [2/2]

template<class C >
auto Aleph::iterator_for ( const C &  c)

Iterator on c positioned on its first item: the read-only view on a constant container.

Parameters
[in]cthe container.
Returns
const_iterator_t<C>.

Definition at line 558 of file ah-iterator.H.

◆ jen_hash() [1/2]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::jen_hash ( const Key &  key,
const unsigned  initval 
)
inlinenoexcept

Definition at line 609 of file hash-fct.H.

References jen_hash().

◆ jen_hash() [2/2]

size_t Aleph::jen_hash ( const std::string &  key,
unsigned  initval 
)
inlinenoexcept

Definition at line 833 of file hash-fct.H.

References jen_hash().

◆ join() [1/3]

template<class C >
std::ostream & Aleph::join ( const C &  c,
const std::string &  sep,
std::ostream &  out 
)
inline

Join elements of an Aleph-style container into a stream.

The container is expected to support is_empty(), get_last(), and get_it() with has_curr()/next_ne()/get_curr().

Template Parameters
CContainer type.
Parameters
[in]cContainer to join.
[in]sepSeparator inserted between elements.
[in,out]outOutput stream.
Returns
Reference to out.

Definition at line 445 of file ah-string-utils.H.

References out.

Referenced by Aleph::PolygonOffset::compute_raw_offset(), demo_joining(), join(), join(), main(), main(), Aleph::PolygonOffset::offset_polygon(), Aleph::PolygonOffset::operator()(), ComplexArray::print(), TEST(), TEST(), TEST(), and TEST().

◆ join() [2/3]

template<class C >
std::string Aleph::join ( const C &  c,
const std::string &  sep = " " 
)
inline

Join elements of an Aleph-style container into a std::string.

Template Parameters
CContainer type.
Parameters
[in]cContainer to join.
[in]sepSeparator inserted between elements (defaults to a space).
Returns
Joined std::string.

Definition at line 469 of file ah-string-utils.H.

References join().

◆ join() [3/3]

template<typename T , template< typename > class Container>
DynList< T > Aleph::join ( const Container< T > &  c1,
const Container< T > &  c2 
)
inline

Return union of two containers as a DynList (no duplicates).

Definition at line 1063 of file tpl_dynSetHash.H.

References Aleph::DynHashTable< Key, HashTable, Cmp >::insert(), and GenericItems< Container, T >::keys().

◆ jsw_fill_table()

static void Aleph::jsw_fill_table ( std::uint32_t  seed)
staticnoexcept

◆ jsw_hash()

size_t Aleph::jsw_hash ( const char *  key)
noexcept

Compute a 32-bit JSW hash for a null-terminated string.

Parameters
keyNull-terminated string to hash.
Returns
32-bit hash value.
Exceptions
Nothing.

Definition at line 304 of file hash-fct.C.

References Default_Hash_Seed, h, init, jsw_fill_table(), jsw_init_flag, jsw_mtx, and tab.

◆ justify_line()

std::string Aleph::justify_line ( std::string  line,
const size_t  page_width 
)
inline

Justify a single line by inserting extra spaces.

Parameters
[in]lineInput line.
[in]page_widthDesired width.
Returns
Justified line.

Definition at line 1099 of file ah-string-utils.H.

Referenced by justify_text().

◆ justify_line_except_first()

std::string Aleph::justify_line_except_first ( const std::string &  text,
const size_t  width,
const size_t  left_margin = 0 
)
inline

Justify all lines except the first one.

Parameters
[in]textInput text.
[in]widthTarget width.
[in]left_marginLeft margin for lines after the first.
Returns
Formatted text.

Definition at line 1161 of file ah-string-utils.H.

References justify_text(), split_text_into_lines(), and to_string().

Referenced by TEST().

◆ justify_text()

std::string Aleph::justify_text ( const std::string &  text,
const size_t  width,
const size_t  left_margin = 0 
)
inline

Justify a text to a target width.

Parameters
[in]textInput text.
[in]widthTarget width.
[in]left_marginOptional left margin (spaces).
Returns
Justified text with newlines.

Definition at line 1123 of file ah-string-utils.H.

References justify_line(), and split_text_into_words().

Referenced by demo_formatting(), justify_line_except_first(), TEST(), and TEST().

◆ KEY()

template<class Node >
constexpr const Node::Key_Type & Aleph::KEY ( const Node *  p)
inlineconstexprnoexcept

Definition at line 510 of file tpl_binNode.H.

◆ key_to_pair() [1/2]

template<typename Key , typename Data >
const std::pair< Key, Data > * Aleph::key_to_pair ( const Key *  ptr)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 276 of file ahDry.H.

◆ key_to_pair() [2/2]

template<typename Key , typename Data >
std::pair< Key, Data > * Aleph::key_to_pair ( Key *  ptr)

Converts a pointer to Key to a pointer to the containing pair.

Parameters
ptrPointer to the key within a pair
Returns
Pointer to the containing pair

Definition at line 267 of file ahDry.H.

◆ kmp_prefix_function()

Array< size_t > Aleph::kmp_prefix_function ( const std::string_view  pattern)
inline

Prefix-function used by KMP.

For each index i, returns the length of the longest proper prefix of pattern[0..i] which is also a suffix of pattern[0..i].

Parameters
[in]patternPattern to preprocess.
Returns
Prefix-function array with size pattern.size().
Exceptions
None.
Complexity
O(m) time and O(m) space, where m = pattern.size().

Definition at line 141 of file String_Search.H.

References and, and Aleph::Array< T >::create().

Referenced by kmp_search(), main(), and TEST().

◆ kmp_search()

Array< size_t > Aleph::kmp_search ( const std::string_view  text,
const std::string_view  pattern 
)
inline

Find all occurrences of a pattern using KMP.

Parameters
[in]textText where matches are searched.
[in]patternPattern to find.
Returns
Array with all match start indices (0-based).
Exceptions
None.
Note
If pattern is empty, returns all positions in [0, text.size()].
Complexity
O(n + m) time and O(m) extra space.

Definition at line 178 of file String_Search.H.

References Aleph::string_search_detail::all_match_positions(), and, Aleph::Array< T >::append(), and kmp_prefix_function().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and z_search().

◆ knapsack_01()

template<typename V , std::integral W>
Knapsack_Result< V > Aleph::knapsack_01 ( const Array< Knapsack_Item< W, V > > &  items,
W  capacity 
)

Solve the 0/1 Knapsack problem with item reconstruction.

In the 0/1 variant, each item can be selected at most once.

Template Parameters
VValue type (must support addition and comparison).
WWeight type (integral, must support comparison).
Parameters
[in]itemsArray of Knapsack_Item representing the available items.
[in]capacityMaximum total weight allowed.
Returns
A Knapsack_Result containing the optimal value and indices of selected items.
Exceptions
ah_domain_errorif capacity or any item weight is negative.
ah_bad_allocif memory allocation for the DP table fails.
Note
Complexity: Time O(n * capacity), Space O(n * capacity), where n is items.size.

Definition at line 166 of file Knapsack.H.

References Aleph::Array< T >::append(), Aleph::Array< T >::create(), Aleph::knapsack_detail::dp_add(), Aleph::knapsack_detail::extract_weights_checked(), k, Aleph::Array< T >::reserve(), row, Aleph::Array< T >::size(), Aleph::knapsack_detail::to_size_checked(), V, and w.

Referenced by knapsack_bounded(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ knapsack_01_value()

template<typename V , std::integral W>
V Aleph::knapsack_01_value ( const Array< Knapsack_Item< W, V > > &  items,
W  capacity 
)

Solve the 0/1 Knapsack problem (value only, space-optimized).

This version only computes the maximum value, using O(capacity) space.

Template Parameters
VValue type.
WWeight type.
Parameters
[in]itemsArray of Knapsack_Item.
[in]capacityMaximum total weight allowed.
Returns
The maximum total value achieved.
Exceptions
ah_domain_errorif capacity or any item weight is negative.
Note
Complexity: Time O(n * capacity), Space O(capacity).

Definition at line 237 of file Knapsack.H.

References and, Aleph::Array< T >::create(), Aleph::knapsack_detail::dp_add(), Aleph::knapsack_detail::extract_weights_checked(), Aleph::Array< T >::size(), Aleph::knapsack_detail::to_size_checked(), V, and w.

Referenced by main(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ knapsack_bounded()

template<typename V , std::integral W>
Knapsack_Result< V > Aleph::knapsack_bounded ( const Array< Knapsack_Item< W, V > > &  items,
const Array< size_t > &  counts,
W  capacity 
)

Solve the Bounded Knapsack problem with reconstruction.

In the bounded variant, each item i can be taken at most counts[i] times. This algorithm internally uses binary decomposition to reduce the problem to a 0/1 Knapsack problem efficiently.

Template Parameters
VValue type.
WWeight type.
Parameters
[in]itemsArray of Knapsack_Item.
[in]countsArray of maximum counts allowed for each corresponding item.
[in]capacityMaximum total weight allowed.
Returns
A Knapsack_Result containing the optimal value and original indices of selected items.
Exceptions
std::domain_errorif capacity or any item weight is negative.
std::invalid_argumentif items.size() != counts.size().
Note
Complexity: Time O(capacity * sum(log(counts[i]))), Space O(capacity * sum(log(counts[i]))).

Definition at line 357 of file Knapsack.H.

References ah_invalid_argument_if, and, Aleph::Array< T >::append(), Aleph::knapsack_detail::extract_weights_checked(), k, knapsack_01(), Aleph::Knapsack_Result< V >::optimal_value, Aleph::Array< T >::size(), Aleph::knapsack_detail::to_size_checked(), V, and value.

Referenced by main(), TEST(), TEST(), TEST(), and TEST().

◆ knapsack_unbounded()

template<typename V , std::integral W>
Knapsack_Result< V > Aleph::knapsack_unbounded ( const Array< Knapsack_Item< W, V > > &  items,
W  capacity 
)

Solve the Unbounded Knapsack problem with reconstruction.

In the unbounded variant, an unlimited number of copies of each item is available.

Template Parameters
VValue type.
WWeight type.
Parameters
[in]itemsArray of Knapsack_Item.
[in]capacityMaximum total weight allowed.
Returns
A Knapsack_Result containing the optimal value and indices of selected items (may contain duplicates).
Exceptions
ah_domain_errorif capacity or any item weight is negative.
ah_domain_errorif an item with weight 0 has a positive value (as the problem would have an infinite optimal value).
Note
Complexity: Time O(n * capacity), Space O(capacity).

Definition at line 286 of file Knapsack.H.

References ah_domain_error_if, and, Aleph::Array< T >::append(), Aleph::Array< T >::create(), Aleph::knapsack_detail::dp_add(), Aleph::knapsack_detail::extract_weights_checked(), Aleph::knapsack_detail::to_size_checked(), V, value, and w.

Referenced by main(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ knuth_optimize_interval()

template<typename Cost , class Interval_Cost_Fn >
Knuth_Optimization_Result< Cost > Aleph::knuth_optimize_interval ( const size_t  n,
Interval_Cost_Fn  interval_cost,
const Cost  inf = dp_optimization_detail::default_inf<Cost>() 
)
inline

Optimize interval DP with Knuth optimization.

Solves recurrences of the form:

dp[i][j] = min_{i < k < j} (dp[i][k] + dp[k][j] + interval_cost(i, j))

for intervals [i, j) over n atomic elements.

Requires the standard Knuth assumptions to hold for interval_cost: quadrangle inequality and monotone optima.

Template Parameters
CostNumeric DP cost type.
Interval_Cost_FnCallable returning Cost given (i, j).
Parameters
[in]nNumber of atomic elements.
[in]interval_costCost term depending only on interval [i, j).
[in]infSentinel for unreachable states.
Returns
Knuth_Optimization_Result<Cost> with optimum, DP table and opt table.
Note
Base case: dp[i][i] = 0, dp[i][i+1] = 0.
Complexity: O(n^2).

Definition at line 252 of file DP_Optimizations.H.

References ah_runtime_error_if, Aleph::Array< T >::append(), Aleph::Array< T >::create(), k, Aleph::Array< T >::reserve(), row, and w.

◆ kurtosis()

template<typename Container >
auto Aleph::kurtosis ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute excess kurtosis (measure of tailedness).

Positive kurtosis: heavy tails (leptokurtic) Negative kurtosis: light tails (platykurtic) Zero kurtosis: normal distribution (mesokurtic)

Returns excess kurtosis (kurtosis - 3).

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Excess kurtosis value
Exceptions
std::invalid_argumentif container has fewer than 4 elements

Definition at line 564 of file stat_utils.H.

References ah_invalid_argument_if, diff(), kurtosis(), m, mean(), and stddev().

Referenced by compute_all_stats(), kurtosis(), TEST(), TEST(), and TEST().

◆ l_index()

constexpr size_t Aleph::l_index ( const size_t  i)
inlineconstexpr

Map a binary heap index to the index of its left child.

For 1-based heaps, l_index(i) returns 2*i.

Parameters
[in]iNode index.
Returns
Left child index.

Definition at line 218 of file ahUtils.H.

Referenced by Aleph::dynarrayheap_detail::down_index(), Aleph::arrayheap_detail::sift_down(), TEST(), and valid_heap().

◆ lazy_combinations()

template<typename T >
Aleph::Generator< Array< T > > Aleph::lazy_combinations ( Array< T >  a,
size_t  k 
)

Lazily enumerate all k-element combinations of a's elements.

Combinations are drawn positionally (index-based, via next_combination_indices) and yielded in the same relative order as a: for input [x0, x1, ..., x(n-1)], the first combination is [x0, ..., x(k-1)] and the last is [x(n-k), ..., x(n-1)]. Yields exactly combination_count(n, k) combinations for k <= n (1 when k == 0).

Template Parameters
TElement type. Must be copyable.
Parameters
aSource sequence (taken by value: the generator owns and reads from its own copy — see the note on coroutine reference parameters below).
kSize of each combination.
Returns
A lazy sequence of C(a.size(), k) combinations, each a fresh Array<T> of size k.
Exceptions
std::domain_errorif k > a.size().
Note
Complexity: O(k) amortized per yielded combination (the classic next_combination_indices bound) plus O(k) to materialize each combination's values.
Each combination is materialized as its own Array<T> before it is yielded (materializing values from indices requires a copy anyway). The iterator still returns a reference into the suspended coroutine frame, so that reference is valid only until the generator advances. Copy it (Array<T> snapshot = c;) if you need to keep it.
a is taken by value, not by reference, on purpose: a coroutine's reference parameters bind to whatever the caller passed, but the coroutine body doesn't start running until the first resume (it starts suspended) — by which point a temporary argument (e.g. lazy_combinations(Array<int>{1,2,3}, 2)) has already been destroyed. Taking a by value sidesteps this well-known C++20 coroutine pitfall entirely, at the cost of one copy of the source sequence.
Example
for (const Array<char> &c : lazy_combinations(Array<char>{'a','b','c'}, 2))
process(c); // sees {a,b}, {a,c}, {b,c}
Aleph::Generator< Array< T > > lazy_combinations(Array< T > a, size_t k)
Lazily enumerate all k-element combinations of a's elements.

Start from the first k-combination: indices [0, 1, ..., k-1].

Definition at line 157 of file ah-comb-generators.H.

References ah_domain_error_if, Aleph::Array< T >::create(), Aleph::Array< T >::create_reserved(), k, next_combination_indices(), and Aleph::Array< T >::size().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ lazy_permutations()

template<typename T , class Compare = Aleph::less<T>>
Aleph::Generator< Array< T > > Aleph::lazy_permutations ( Array< T >  a,
Compare  cmp = Compare() 
)

Lazily enumerate all permutations of a, in lexicographic order.

Sorts a working copy of a ascending (per cmp) — the lexicographic starting point — then repeatedly applies next_permutation to advance it, co_yielding after each step. For n elements with no ties, this yields exactly n! permutations.

Template Parameters
TElement type. Must be movable and comparable via Compare.
CompareStrict weak ordering over T. Defaults to Aleph::less<T>. Duplicate-valued elements (ties under Compare) collapse permutations exactly as next_permutation does — the yielded count is n! divided by the multinomial of tie-group sizes, matching std::next_permutation.
Parameters
aSequence to permute (taken by value: the generator owns and mutates its own copy).
cmpComparator instance (defaulted).
Returns
A lazy sequence of n! permutations (or fewer, with ties).
Warning
The yielded array is reused in place: every co_yield exposes the same backing Array<T>, mutated one step further on each resume. This avoids an O(n) copy per permutation, but means the reference is only valid between resumes — copy it (Array<T> snapshot = *it;) if you need to keep more than one permutation alive at a time.
Note
Complexity: O(1) amortized element swaps per yielded permutation (the classic next_permutation bound); O(n log n) once up front to sort the starting point.
Example
for (const Array<int> &p : lazy_permutations(Array<int>{1, 2, 3}))
process(p); // sees {1,2,3}, {1,3,2}, {2,1,3}, {2,3,1}, {3,1,2}, {3,2,1}
Aleph::Generator< Array< T > > lazy_permutations(Array< T > a, Compare cmp=Compare())
Lazily enumerate all permutations of a, in lexicographic order.

Start from the lexicographically smallest permutation so the loop below enumerates the complete sequence.

Definition at line 104 of file ah-comb-generators.H.

References cmp(), next_permutation(), and timsort().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ lcp_array_kasai()

Array< size_t > Aleph::lcp_array_kasai ( const std::string_view  text,
const Array< size_t > &  sa 
)
inline

Compute LCP array from text and suffix array using Kasai.

Calculates the Longest Common Prefix (LCP) values for adjacent suffixes in the suffix array. The resulting array lcp has size n, where lcp[i] is the length of the LCP of text[sa[i]...] and text[sa[i+1]...].

Parameters
[in]textInput text string.
[in]saSuffix array for text.
Returns
Array containing LCP values of length text.size().
Exceptions
std::domain_errorif sa.size() != text.size().
std::out_of_rangeif sa contains an index >= text.size() or if sa contains duplicate indices.
Complexity
O(n) time and O(n) space.

Definition at line 183 of file Suffix_Structures.H.

References ah_domain_error_if, ah_out_of_range_error_if, and, Aleph::Array< T >::create(), k, r, and Aleph::Array< T >::size().

Referenced by main(), TEST(), TEST(), TEST(), and TEST().

◆ left_on()

bool Aleph::left_on ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Definition at line 82 of file point_utils.H.

References area_of_parallelogram(), and left_on().

Referenced by left_on().

◆ less_or_equal_than() [1/2]

template<class T , class Compare >
bool Aleph::less_or_equal_than ( const T &  op1,
const T &  op2,
Compare &&  cmp = Compare() 
)
inline

See less_or_equal_than().

Definition at line 1037 of file ahFunction.H.

References cmp().

◆ less_or_equal_than() [2/2]

template<class T , class Compare >
bool Aleph::less_or_equal_than ( const T &  op1,
const T &  op2,
Compare &  cmp 
)
inline

Determines if op1 is less than or equal to op2 using a comparison operator.

Uses an exclusive comparison operator (< or >). For use with generic programs that need comparison functionality.

Parameters
op1First operand
op2Second operand
cmpComparison functor
Returns
true if op1 <= op2 according to cmp

Definition at line 1020 of file ahFunction.H.

References cmp().

Referenced by check_bst_range().

◆ less_than() [1/2]

template<class T , class Compare >
bool Aleph::less_than ( const T &  op1,
const T &  op2,
Compare &&  cmp = Compare() 
)
inline

See less_than().

Definition at line 1002 of file ahFunction.H.

References cmp().

◆ less_than() [2/2]

template<class T , class Compare >
bool Aleph::less_than ( const T &  op1,
const T &  op2,
Compare &  cmp 
)
inline

Determines if op1 is less than op2 using a comparison operator.

Uses an exclusive comparison operator (< or >). For use with generic programs that need comparison functionality.

Parameters
op1First operand
op2Second operand
cmpComparison functor
Returns
true if op1 < op2 according to cmp

Definition at line 991 of file ahFunction.H.

References cmp().

◆ lesser()

template<class C1 , class C2 , class Cmp = std::less<typename C1::Item_Type>>
bool Aleph::lesser ( const C1 &  c1,
const C2 &  c2,
Cmp  cmp = Cmp() 
)
inline

Lexicographical comparison between two containers.

Compares two containers lexicographically (dictionary order). Returns true if c1 is lexicographically less than c2.

Template Parameters
C1Type of the first container.
C2Type of the second container.
CmpComparator type (defaults to std::less).
Parameters
c1First container.
c2Second container.
cmpComparator for element comparison.
Returns
true if c1 < c2 lexicographically.
Example:
DynList<int> a = {1, 2, 3};
DynList<int> b = {1, 2, 4};
DynList<int> c = {1, 2};
lesser(a, b); // true (3 < 4)
lesser(c, a); // true (shorter prefix)
lesser(a, a); // false (equal)
bool lesser(const C1 &c1, const C2 &c2, Cmp cmp=Cmp())
Lexicographical comparison between two containers.

Definition at line 1327 of file ahFunctional.H.

References and, and cmp().

Referenced by demo_comparison(), and TEST().

◆ level_traverse()

template<BinNodeLike Node, class Operation >
bool Aleph::level_traverse ( Node *  root,
Operation &&  operation 
)
inline

Definition at line 1037 of file tpl_binNodeUtils.H.

References root().

◆ levenshtein_distance()

size_t Aleph::levenshtein_distance ( const std::string_view  a,
const std::string_view  b 
)
inline

Levenshtein distance (insert/delete/substitute each cost 1).

Parameters
[in]aFirst string.
[in]bSecond string.
Returns
Edit distance.
Exceptions
None.
Complexity
O(nm) time and O(min(n,m)) space.

Definition at line 94 of file String_DP.H.

References Aleph::Array< T >::create(), Aleph::Array< T >::size(), and Aleph::Array< T >::swap().

Referenced by edit_distance(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ lexicographical_compare()

template<class Itor1 , class Itor2 , class Comp = Aleph::less<typename Itor1::value_type>>
bool Aleph::lexicographical_compare ( Itor1  beg1,
const Itor1 &  end1,
Itor2  beg2,
const Itor2 &  end2,
Comp  op = Comp() 
)
inline

Lexicographical comparison of two ranges.

Compares two ranges lexicographically.

Template Parameters
Itor1First range iterator type.
Itor2Second range iterator type.
CompComparison functor.
Parameters
beg1Iterator to the first element of the first range.
end1Iterator past the last element of the first range.
beg2Iterator to the first element of the second range.
end2Iterator past the last element of the second range.
opComparison function.
Returns
true if the first range is lexicographically less than the second.

Definition at line 547 of file ahAlgo.H.

References and.

Referenced by TEST(), TEST(), and TEST().

◆ lis_length()

template<typename T , class Compare = Aleph::less<T>>
size_t Aleph::lis_length ( const Array< T > &  seq,
Compare  cmp = Compare() 
)

Compute only the length of the LIS (no reconstruction).

A space-optimized version that returns the maximum length of a strictly increasing subsequence without storing extra info for reconstruction.

Template Parameters
TElement type.
CompareStrict weak ordering instance.
Parameters
[in]seqInput sequence to analyze.
[in]cmpComparator instance defining the order.
Returns
The length of the longest strictly increasing subsequence.
Note
Complexity: Time O(n log n), Space O(n).

Definition at line 212 of file LIS.H.

References Aleph::Array< T >::append(), cmp(), Aleph::lis_detail::lower_bound_pos(), Aleph::Array< T >::reserve(), and Aleph::Array< T >::size().

Referenced by main(), TEST(), TEST(), and TEST().

◆ list_insertion_sort()

template<class ListType , class Compare >
void Aleph::list_insertion_sort ( ListType &  list,
const Compare &  cmp 
)
inline

Generic insertion sort for linked lists.

Template Parameters
ListTypeThe list container type (e.g., DynList, DynDlist).
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 1018 of file tpl_sort_utils.H.

References cmp().

◆ List_Sort() [1/2]

Aleph::List_Sort ( DynDlist  )

◆ List_Sort() [2/2]

Aleph::List_Sort ( DynList  )

◆ list_to_DynList()

template<typename T >
DynList< T > Aleph::list_to_DynList ( const std::list< T > &  l)
inline

Convert a std::list to a DynList.

Template Parameters
TElement type.
Parameters
lSource std::list.
Returns
DynList containing copies of all elements.

Definition at line 385 of file ah-stl-utils.H.

References Aleph::DynList< T >::append(), and l.

Referenced by demo_list_dynlist(), TEST(), TEST(), and TEST().

◆ LLINK()

template<class Node >
constexpr const Node * Aleph::LLINK ( const Node *  p)
inlineconstexprnoexcept

Definition at line 476 of file tpl_binNode.H.

◆ load_binary_number()

long Aleph::load_binary_number ( std::ifstream &  input_stream)
inline

Load a binary number from the input stream.

Parses a number in binary format (0b or 0B prefix).

Parameters
input_streamThe input file stream
Returns
The parsed value
Exceptions
ParseErrorif format is invalid
Accepted formats
  • 0b1010
  • 0B11110000

Definition at line 1148 of file parse_utils.H.

References ah_parse_error_unless, Buffer_Size, close_token_scanning(), current_col_number, init_token_scanning(), load_binary_number(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by load_binary_number(), TEST_F(), and TEST_F().

◆ load_char_literal()

char Aleph::load_char_literal ( std::ifstream &  input_stream)
inline

Load a character literal.

Parses a character literal enclosed in single quotes. Supports escape sequences.

Parameters
input_streamThe input file stream
Returns
The parsed character
Exceptions
ParseErrorif the format is invalid
Accepted formats
  • ‘'a’ -'\n' -'\t'`

Definition at line 1464 of file parse_utils.H.

References ah_parse_error_unless, init_token_scanning(), load_char_literal(), process_escape(), read_char_from_stream(), skip_white_spaces(), and token_instance.

Referenced by load_char_literal(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ load_double()

double Aleph::load_double ( std::ifstream &  input_stream)
inline

Load a floating-point number from the input stream.

Parses and returns a double-precision floating-point number. Supports optional sign, decimal point, and scientific notation.

Parameters
input_streamThe input file stream
Returns
The parsed double value
Exceptions
ParseErrorif the format is invalid
Accepted formats
  • 123.456
  • -3.14
  • 1e10, 1E10
  • 1.5e-3
  • .5 (leading decimal)
  • 5. (trailing decimal)
Example
double pi = load_double(input); // "3.14159"
double load_double(std::ifstream &input_stream)
Load a floating-point number from the input stream.

Definition at line 958 of file parse_utils.H.

References ah_parse_error_unless, Buffer_Size, close_token_scanning(), current_col_number, init_token_scanning(), load_double(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by load_double(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ load_escaped_string()

std::string Aleph::load_escaped_string ( std::ifstream &  input_stream)
inline

Load a string with escape sequence processing.

Like load_string() but processes escape sequences like \n, \t, etc. Only works with quoted strings.

Parameters
input_streamThe input file stream
Returns
The parsed string with escapes processed
Exceptions
ParseErrorif string is unterminated
Example
// Input: "hello\nworld"
std::string s = load_escaped_string(input);
// s contains "hello" + newline + "world"
std::string load_escaped_string(std::ifstream &input_stream)
Load a string with escape sequence processing.

Definition at line 1411 of file parse_utils.H.

References ah_parse_error_if, ah_parse_error_unless, Buffer_Size, close_token_scanning(), init_token_scanning(), load_escaped_string(), process_escape(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by load_escaped_string(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ load_file_contents()

std::string Aleph::load_file_contents ( const std::string &  filename)
inline

Load entire file contents into a string.

Parameters
filenamePath to the file
Returns
Contents of the file as a string
Exceptions
std::runtime_errorif file cannot be opened

Definition at line 1591 of file parse_utils.H.

References ah_runtime_error_unless, file, and load_file_contents().

Referenced by load_file_contents(), TEST(), and TEST_F().

◆ load_file_lines()

DynList< std::string > Aleph::load_file_lines ( const std::string &  filename)
inline

Load file as a list of lines.

Parameters
filenamePath to the file
Returns
List where each element is one line (without newline)
Exceptions
std::runtime_errorif file cannot be opened

Definition at line 1609 of file parse_utils.H.

References ah_runtime_error_unless, Aleph::DynList< T >::append(), file, and load_file_lines().

Referenced by load_file_lines(), and TEST_F().

◆ load_hex_number()

long Aleph::load_hex_number ( std::ifstream &  input_stream)
inline

Load a hexadecimal number from the input stream.

Parses a number in hexadecimal format (0x or 0X prefix).

Parameters
input_streamThe input file stream
Returns
The parsed value
Exceptions
ParseErrorif format is invalid
Accepted formats
  • 0xFF, 0XFF
  • 0x1a2b

Definition at line 1049 of file parse_utils.H.

References ah_parse_error_unless, Buffer_Size, close_token_scanning(), current_col_number, init_token_scanning(), load_hex_number(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by load_hex_number(), TEST_F(), and TEST_F().

◆ load_identifier()

std::string Aleph::load_identifier ( std::ifstream &  input_stream)
inline

Load an identifier from the input stream.

Parses an identifier (variable name, function name, etc.). Identifiers start with a letter or underscore, followed by letters, digits, or underscores.

Parameters
input_streamThe input file stream
Returns
The parsed identifier
Exceptions
ParseErrorif no valid identifier found
Valid identifiers
  • foo, _bar, camelCase, snake_case, var123

Definition at line 1201 of file parse_utils.H.

References ah_parse_error_unless, Buffer_Size, close_token_scanning(), current_col_number, init_token_scanning(), load_identifier(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by load_identifier(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ load_number()

long Aleph::load_number ( std::ifstream &  input_stream)
inline

Load an integer number from the input stream.

Parses and returns a signed integer from the input stream. Leading whitespace is automatically skipped. The number may optionally be preceded by a minus sign for negative values.

Parameters
input_streamThe input file stream
Returns
The parsed integer value
Exceptions
std::domain_errorif the number format is invalid
std::out_of_rangeif EOF is reached unexpectedly
Accepted formats
  • Positive integers: 123, 0, 42
  • Negative integers: -123, -1
Example
// Input: " -42 hello"
long num = load_number(input);
// num == -42, stream positioned at space before "hello"
long load_number(std::ifstream &input_stream)
Load an integer number from the input stream.
Note
Numbers must be terminated by whitespace. Other terminators (like commas) will cause an error.

Definition at line 356 of file parse_utils.H.

References ah_domain_error_if, Buffer_Size, close_token_scanning(), init_token_scanning(), load_number(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by build_cross_net_graph(), build_net_graph(), build_poly_graph(), file_to_dynarrays(), load_arc_option(), load_distance_option(), load_key_option(), load_node(), load_nodes(), load_number(), load_offset_option(), load_parrectangle_option(), load_rectangle_option(), load_split_option(), load_tag_option(), load_thread_option(), load_triangle_option(), load_triangleh_option(), parse_arc_text_definition(), parse_curve_arc_definition(), parse_graph_definition(), parse_hradio(), parse_hradio_definition(), parse_node_definition(), parse_node_text_definition(), parse_tag(), parse_tag_definition(), parse_vradio(), parse_vradio_definition(), parse_xoffset(), parse_yoffset(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ load_octal_number()

long Aleph::load_octal_number ( std::ifstream &  input_stream)
inline

Load an octal number from the input stream.

Parses a number in octal format (leading 0).

Parameters
input_streamThe input file stream
Returns
The parsed value
Exceptions
ParseErrorif format is invalid
Accepted formats
  • 0755
  • 0123

Definition at line 1098 of file parse_utils.H.

References ah_parse_error_if, ah_parse_error_unless, and, Buffer_Size, close_token_scanning(), current_col_number, init_token_scanning(), load_octal_number(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by load_octal_number(), TEST_F(), and TEST_F().

◆ load_string()

std::string Aleph::load_string ( std::ifstream &  input_stream)
inline

Load a string from the input stream.

Parses and returns a string from the input stream. The string may be quoted with double quotes or unquoted.

  • Quoted strings: Start and end with a double quote character ("). and special characters. The quotes are not included in the result.
  • Unquoted strings: End at whitespace or EOF. Cannot contain spaces.
Parameters
input_streamThe input file stream
Returns
The parsed string (without quotes if quoted)
Exceptions
std::out_of_rangeif EOF is reached unexpectedly
Example
// Input: "hello world" more
std::string s1 = load_string(input); // s1 == "hello world"
std::string s2 = load_string(input); // s2 == "more"
std::string load_string(std::ifstream &input_stream)
Load a string from the input stream.
Example (unquoted)
// Input: hello world
std::string s1 = load_string(input); // s1 == "hello"
std::string s2 = load_string(input); // s2 == "world"

Definition at line 439 of file parse_utils.H.

References and, Buffer_Size, close_token_scanning(), init_token_scanning(), load_string(), put_char_in_buffer(), read_char_from_stream(), and skip_white_spaces().

Referenced by load_distance_option(), load_key_option(), load_split_option(), load_string(), load_tag_option(), parse_arc_text_definition(), parse_key_node_and_allocate(), parse_node_definition(), parse_node_text_definition(), parse_tag(), parse_tag_definition(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ load_tree_keys_from_array()

template<BinNodeLike Node, class Load_Key >
void Aleph::load_tree_keys_from_array ( Node *  root,
const char *  keys[],
int &  idx 
)
inline

Definition at line 1551 of file tpl_binNodeUtils.H.

References keys, LLINK, RLINK, and root().

◆ longest_common_subsequence()

LCS_Result Aleph::longest_common_subsequence ( const std::string_view  a,
const std::string_view  b 
)
inline

Compute Longest Common Subsequence.

Parameters
[in]aFirst string.
[in]bSecond string.
Returns
LCS length and one optimal subsequence.
Exceptions
None.
Complexity
O(nm) time and O(nm) space.

Definition at line 241 of file String_DP.H.

References and, m, Aleph::string_dp_detail::make_zero_matrix(), and OhashCommon< HashTbl, Key >::size().

Referenced by main(), TEST(), TEST(), and TEST().

◆ longest_common_substring()

Longest_Common_Substring_Result Aleph::longest_common_substring ( const std::string_view  a,
const std::string_view  b 
)
inline

Compute the longest common substring (contiguous) between two strings.

Parameters
[in]aFirst string.
[in]bSecond string.
Returns
Length, starting indices, and substring.
Exceptions
None.
Complexity
O(nm) time and O(m) space.

Definition at line 301 of file String_DP.H.

References Aleph::Longest_Common_Substring_Result::begin_a, Aleph::Longest_Common_Substring_Result::begin_b, Aleph::Array< T >::create(), Aleph::Longest_Common_Substring_Result::length, m, OhashCommon< HashTbl, Key >::size(), Aleph::Longest_Common_Substring_Result::substring, and Aleph::Array< T >::swap().

Referenced by main(), TEST(), TEST(), TEST(), and TEST().

◆ longest_common_substring_sam()

std::string Aleph::longest_common_substring_sam ( const std::string_view  a,
const std::string_view  b 
)
inline

Convenience function: LCS via suffix automaton.

Computes the longest common substring between a and b in linear time by building a suffix automaton for a and processing b.

Parameters
[in]aFirst string.
[in]bSecond string.
Returns
Longest common substring between a and b.
Exceptions
std::bad_allocif memory allocation fails.
Note
Time: O(n + m), Space: O(n * alphabet) where n = a.size(), m = b.size(), and alphabet = 256.

Definition at line 933 of file Suffix_Structures.H.

References Aleph::Suffix_Automaton::build(), and Aleph::Suffix_Automaton::longest_common_substring().

Referenced by TEST(), TEST(), and TEST().

◆ longest_increasing_subsequence()

template<typename T , class Compare = Aleph::less<T>>
LIS_Result< T > Aleph::longest_increasing_subsequence ( const Array< T > &  seq,
Compare  cmp = Compare() 
)

Compute the Longest Increasing Subsequence (strictly increasing).

Uses the patience sorting algorithm to find a strictly increasing subsequence of maximum length.

Template Parameters
TElement type (must be comparable via Compare).
CompareStrict weak ordering (default Aleph::less<T>).
Parameters
[in]seqInput sequence to analyze.
[in]cmpComparator instance defining the order.
Returns
A LIS_Result containing the length and the actual subsequence.
Note
Complexity: Time O(n log n), Space O(n), where n is seq.size().

Definition at line 149 of file LIS.H.

References Aleph::Array< T >::append(), cmp(), Aleph::Array< T >::create(), k, Aleph::lis_detail::lower_bound_pos(), Aleph::Array< T >::reserve(), and Aleph::Array< T >::size().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ longest_nondecreasing_subsequence()

template<typename T , class Compare = Aleph::less<T>>
LIS_Result< T > Aleph::longest_nondecreasing_subsequence ( const Array< T > &  seq,
Compare  cmp = Compare() 
)

Compute the Longest Non-Decreasing Subsequence.

Finds a subsequence where each element is greater than or equal to the previous one (a <= b <= c).

Template Parameters
TElement type.
CompareStrict weak ordering (default Aleph::less<T>).
Parameters
[in]seqInput sequence to analyze.
[in]cmpComparator instance defining the order.
Returns
A LIS_Result containing the length and the actual subsequence.
Note
Complexity: Time O(n log n), Space O(n).

Definition at line 249 of file LIS.H.

References Aleph::Array< T >::append(), cmp(), Aleph::Array< T >::create(), k, Aleph::Array< T >::reserve(), Aleph::Array< T >::size(), and Aleph::lis_detail::upper_bound_pos().

Referenced by main(), TEST(), TEST(), TEST(), and TEST().

◆ longest_palindromic_substring()

std::string Aleph::longest_palindromic_substring ( const std::string_view  text)
inline

Convenience wrapper returning only the longest palindromic substring.

Parameters
[in]textInput text.
Returns
Longest palindromic substring.

Definition at line 194 of file String_Palindromes.H.

References Aleph::Manacher_Result::longest_palindrome, and manacher().

Referenced by TEST(), and TEST().

◆ low()

◆ lower_bound() [1/2]

template<class Itor , class T >
Itor Aleph::lower_bound ( Itor  beg,
Itor  end,
const T &  value 
)
inline

Find lower bound in a sorted range.

Returns an iterator to the first element not less than value in the sorted range [beg, end).

Template Parameters
ItorForward iterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to compare against.
Returns
Iterator to the lower bound.
Note
This is a linear implementation suitable for forward iterators. For random access iterators, consider using binary search.

Definition at line 1190 of file ahAlgo.H.

References and, and value.

Referenced by binary_search(), binary_search(), equal_range(), equal_range(), Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA >::find_path(), Aleph::Network_Simplex< Net >::set_lower_bound(), TEST(), and TEST().

◆ lower_bound() [2/2]

template<class Itor , class T , class BinaryPredicate >
Itor Aleph::lower_bound ( Itor  beg,
Itor  end,
const T &  value,
BinaryPredicate  op 
)
inline

Find lower bound with custom comparison.

Returns an iterator to the first element for which op(*beg, value) is false in the sorted range [beg, end).

Template Parameters
ItorForward iterator type.
TValue type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to compare against.
opBinary comparison predicate.
Returns
Iterator to the lower bound.

Definition at line 1215 of file ahAlgo.H.

References and, and value.

◆ ltrim()

void Aleph::ltrim ( std::string &  s)
inline

Remove leading whitespace from a std::string in-place.

Whitespace is defined by std::isspace in the current C locale.

Parameters
[in,out]sString to modify.

Definition at line 124 of file ah-string-utils.H.

Referenced by demo_trimming(), trim(), and trim_in_place().

◆ make_array_container()

template<typename T >
Array_Container< T > Aleph::make_array_container ( T *  array,
size_t  n 
)
inline

Create an Array_Container from a raw array.

Template Parameters
TElement type.
Parameters
arrayPointer to the array.
nNumber of elements.
Returns
Array_Container wrapping the array.

Definition at line 394 of file array_it.H.

Referenced by TEST().

◆ make_init_guard()

template<typename CleanupFunc >
auto Aleph::make_init_guard ( CleanupFunc  f)
inline

Create an Init_Guard with a cleanup function.

Convenience factory function that creates an Init_Guard.

Template Parameters
CleanupFuncCallable type.
Parameters
fCleanup function.
Returns
Init_Guard wrapping the cleanup function.

Definition at line 169 of file ah_init_guard.H.

Referenced by TEST(), and TEST().

◆ make_tikz_draw_style()

Tikz_Style Aleph::make_tikz_draw_style ( const std::string &  draw_color)
inline

Create a basic draw style with a custom color.

Definition at line 172 of file tikzgeom.H.

References Aleph::Tikz_Style::draw_color.

Referenced by main(), TEST(), and TEST().

◆ make_tikz_fill_style()

Tikz_Style Aleph::make_tikz_fill_style ( const std::string &  draw_color,
const std::string &  fill_color 
)
inline

Create a basic fill style with custom draw/fill colors.

Definition at line 180 of file tikzgeom.H.

References Aleph::Tikz_Style::draw_color, Aleph::Tikz_Style::fill, and Aleph::Tikz_Style::fill_color.

Referenced by TEST().

◆ manacher()

Manacher_Result Aleph::manacher ( const std::string_view  text)
inline

Compute palindromic radii and the longest palindrome with Manacher.

Parameters
[in]textInput text.
Returns
Full Manacher result.
Complexity
O(n) time and O(n) space.

Definition at line 81 of file String_Palindromes.H.

References and, Aleph::Array< T >::create(), Aleph::Manacher_Result::even_radius, k, l, Aleph::Manacher_Result::longest_begin, Aleph::Manacher_Result::longest_length, Aleph::Manacher_Result::longest_palindrome, Aleph::Manacher_Result::odd_radius, and r.

Referenced by longest_palindromic_substring(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ map_hash_fct()

template<typename Key , typename Data , typename Fct >
size_t Aleph::map_hash_fct ( Fct  fct,
const std::pair< Key, Data > &  p 
)
inlinenoexcept

Definition at line 1137 of file hash-fct.H.

◆ map_in_arcs() [1/2]

template<AlephGraph GT, typename T , class Op >
requires std::is_invocable_r_v<T, Op &, typename GT::Arc *>
auto Aleph::map_in_arcs ( const GT &  g,
typename GT::Node *  p,
Op  op 
)
inline

Map the arcs of g into p to a transformation op, which must have the signature T op(Arc * arc); on a digraph, in \(O(E)\).

Parameters
[in]gthe graph of p
[in]pnode pointer
[in]optransformation
Returns
a DynList<T> containing the mapping.

Definition at line 3229 of file tpl_graph.H.

References Aleph::DynList< T >::append(), Call, and for_each_in_arc().

◆ map_in_arcs() [2/2]

template<AlephGraph GT, typename T , class Op >
requires (std::is_invocable_r_v<T, Op &, typename GT::Arc *> and not std::is_same_v<Op, std::function<T (typename GT::Arc *)>>)
auto Aleph::map_in_arcs ( typename GT::Node *  p,
Op  op 
)
inline

Map the incoming arcs to a transformation,.

The transformation is called op and must have the following signature:

T op(Arc * arc)

Where T is the transformed type from the arc. It does not compile on a digraph type: use map_in_arcs<GT, T>(g, p, op).

Parameters
[in]pnode pointer
[in]optransformation
Returns
a DynList<T> containing the mapping.

Definition at line 3183 of file tpl_graph.H.

References Aleph::DynList< T >::append().

Referenced by TEST().

◆ map_keys_to_DynList()

template<class K , class V , class Compare , class Alloc >
DynList< K > Aleph::map_keys_to_DynList ( const std::map< K, V, Compare, Alloc > &  m)

Extract keys from a std::map to a DynList.

Creates a new DynList containing copies of all keys from the given std::map. Keys are inserted in sorted order.

Template Parameters
KThe key type.
VThe value type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
mThe source std::map.
Returns
A DynList containing all keys from m.

Definition at line 735 of file ah-convert.H.

References Aleph::DynList< T >::append(), m, and value.

Referenced by TEST().

◆ map_out_arcs()

template<AlephGraph GT, typename T , class Op >
requires (std::is_invocable_r_v<T, Op &, typename GT::Arc *> and not std::is_same_v<Op, std::function<T (typename GT::Arc *)>>)
auto Aleph::map_out_arcs ( typename GT::Node *  p,
Op  op 
)
inline

Map the outcoming arcs to a transformation,.

The transformation is called op and must have the following signature:

T op(Arc * arc)

Where T is the transformed type from the arc.

Parameters
[in]pnode pointer
[in]optransformation
Returns
a DynList<T> containing the mapping.

Definition at line 3478 of file tpl_graph.H.

References Aleph::DynList< T >::append().

Referenced by TEST().

◆ map_perm() [1/2]

template<typename R , typename T , class Op >
DynList< R > Aleph::map_perm ( const DynList< DynList< T > > &  l,
Op &&  op 
)

Convenience overload accepting an rvalue callable.

Definition at line 767 of file ah-comb.H.

References l.

◆ map_perm() [2/2]

template<typename R , typename T , class Op >
DynList< R > Aleph::map_perm ( const DynList< DynList< T > > &  l,
Op &  op 
)

Transform each permutation via a mapping operation.

Template Parameters
RResult element type.
TElement type in input lists.
OpCallable with signature R(const DynList<T>&).
Parameters
[in]lList of lists.
[in]opMapping operation.
Returns
List of results from applying op to each permutation.

Definition at line 753 of file ah-comb.H.

References Aleph::DynList< T >::append(), for_each_perm(), and l.

◆ map_to_Array()

template<class K , class V , class Compare , class Alloc >
Array< std::pair< K, V > > Aleph::map_to_Array ( const std::map< K, V, Compare, Alloc > &  m)

Convert a std::map to an Array of pairs.

Creates a new Array containing copies of all key-value pairs from the given std::map. Elements are inserted in key-sorted order.

Template Parameters
KThe key type.
VThe value type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
mThe source std::map.
Returns
An Array of pairs containing all key-value pairs from m.

Definition at line 711 of file ah-convert.H.

References Aleph::Array< T >::append(), m, Aleph::Array< T >::reserve(), OhashCommon< HashTbl, Key >::size(), and value.

Referenced by TEST().

◆ map_to_DynList()

template<class K , class V , class Compare , class Alloc >
DynList< std::pair< K, V > > Aleph::map_to_DynList ( const std::map< K, V, Compare, Alloc > &  m)

Convert a std::map to a DynList of pairs.

Creates a new DynList containing copies of all key-value pairs from the given std::map. Elements are inserted in key-sorted order.

Template Parameters
KThe key type.
VThe value type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
mThe source std::map.
Returns
A DynList of pairs containing all key-value pairs from m.

Definition at line 687 of file ah-convert.H.

References Aleph::DynList< T >::append(), m, and value.

Referenced by TEST(), and TEST().

◆ map_unify()

template<typename T , class Op , class C >
DynMapTree< typename C::Item_Type, T > Aleph::map_unify ( const C &  c,
Op  op 
)

◆ map_values_to_DynList()

template<class K , class V , class Compare , class Alloc >
DynList< V > Aleph::map_values_to_DynList ( const std::map< K, V, Compare, Alloc > &  m)

Extract values from a std::map to a DynList.

Creates a new DynList containing copies of all values from the given std::map. Values are inserted in key-sorted order.

Template Parameters
KThe key type.
VThe value type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
mThe source std::map.
Returns
A DynList containing all values from m.

Definition at line 758 of file ah-convert.H.

References Aleph::DynList< T >::append(), m, and value.

Referenced by TEST().

◆ map_vector()

template<typename T , class Op >
auto Aleph::map_vector ( const std::vector< T > &  v,
Op  op 
) -> std::vector<std::decay_t<decltype(op(v[0]))>>
inline

Map a function over a std::vector.

Template Parameters
TElement type of input vector.
OpCallable type.
Parameters
vSource vector.
opFunction to apply to each element.
Returns
std::vector with transformed elements.

Definition at line 174 of file ah-stl-utils.H.

References Aleph::Array< T >::reserve().

Referenced by demo_map_transformations(), TEST(), TEST(), and TEST().

◆ maphash_keys_to_DynList()

template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< Key > Aleph::maphash_keys_to_DynList ( const MapOpenHash< Key, Data, Cmp, HashTable > &  m)

Extract keys from a MapOpenHash to a DynList.

Template Parameters
KeyThe key type.
DataThe data type.
CmpThe equality comparator.
HashTableThe hash table template.
Parameters
mThe source MapOpenHash.
Returns
A DynList containing all keys from m.

Definition at line 1300 of file ah-convert.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST().

◆ maphash_to_Array()

template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
Array< std::pair< Key, Data > > Aleph::maphash_to_Array ( const MapOpenHash< Key, Data, Cmp, HashTable > &  m)

Convert a MapOpenHash to an Array of pairs.

Template Parameters
KeyThe key type.
DataThe data type.
CmpThe equality comparator.
HashTableThe hash table template.
Parameters
mThe source MapOpenHash.
Returns
An Array of pairs containing all key-value pairs from m.

Definition at line 1255 of file ah-convert.H.

References Aleph::Array< T >::append(), FunctionalMethods< Container, T >::for_each(), m, Aleph::Array< T >::reserve(), and OhashCommon< HashTbl, Key >::size().

Referenced by TEST().

◆ maphash_to_DynList()

template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< std::pair< Key, Data > > Aleph::maphash_to_DynList ( const MapOpenHash< Key, Data, Cmp, HashTable > &  m)

Convert a MapOpenHash to a DynList of pairs.

Template Parameters
KeyThe key type.
DataThe data type.
CmpThe equality comparator.
HashTableThe hash table template.
Parameters
mThe source MapOpenHash.
Returns
A DynList of pairs containing all key-value pairs from m.

Definition at line 1234 of file ah-convert.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST().

◆ maphash_to_stdmap()

template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
std::map< Key, Data > Aleph::maphash_to_stdmap ( const MapOpenHash< Key, Data, Cmp, HashTable > &  m)

Convert a MapOpenHash to a std::map.

Template Parameters
KeyThe key type.
DataThe data type.
CmpThe equality comparator.
HashTableThe hash table template.
Parameters
mThe source MapOpenHash.
Returns
A std::map containing all key-value pairs from m.

Definition at line 1277 of file ah-convert.H.

References FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST().

◆ maphash_values_to_DynList()

template<typename Key , typename Data , class Cmp , template< typename, class > class HashTable>
DynList< Data > Aleph::maphash_values_to_DynList ( const MapOpenHash< Key, Data, Cmp, HashTable > &  m)

Extract values from a MapOpenHash to a DynList.

Template Parameters
KeyThe key type.
DataThe data type.
CmpThe equality comparator.
HashTableThe hash table template.
Parameters
mThe source MapOpenHash.
Returns
A DynList containing all values from m.

Definition at line 1321 of file ah-convert.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST().

◆ mapped_arc() [1/2]

template<AlephGraph GT>
GT::Arc * Aleph::mapped_arc ( typename GT::Arc *  a)
noexcept

Return the mapped arc through the cookie of p

Definition at line 3629 of file tpl_graph.H.

References ARC_COOKIE.

◆ mapped_arc() [2/2]

template<AlephGraph GTSRC, AlephGraph GTTGT>
GTTGT::Arc * Aleph::mapped_arc ( typename GTSRC::Arc *  a)
noexcept

See mapped_arc(typename GT::Arc * a).

Definition at line 3643 of file tpl_graph.H.

References ARC_COOKIE.

◆ mapped_node()

template<AlephGraph GTSRC, AlephGraph GTTGT>
GTTGT::Node * Aleph::mapped_node ( typename GTSRC::Node *  p)
noexcept

See mapped_node(typename GT::Node * p).

Definition at line 3636 of file tpl_graph.H.

References NODE_COOKIE.

◆ maps()

template<typename T , class C , class Op >
requires requires(DynList<T> &ret, Op &op) { ret.append(op(std::declval<functional_detail::get_curr_t<C>>())); }
DynList< T > Aleph::maps ( const C &  c,
Op  op 
)

Classic map operation.

Return a new list with each element of container mapped to the result of op(item).

Note
The name maps is used to avoid clashes with std::map.

Definition at line 969 of file ahFunctional.H.

References Aleph::DynList< T >::append().

Referenced by TEST().

◆ maptree_keys_to_DynList()

template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< Key > Aleph::maptree_keys_to_DynList ( const DynMapTree< Key, Data, Tree, Compare > &  m)

Extract keys from a DynMapTree to a DynList.

Template Parameters
KeyThe key type.
DataThe data type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
mThe source DynMapTree.
Returns
A DynList containing all keys from m.

Definition at line 1169 of file ah-convert.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST().

◆ maptree_to_Array()

template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
Array< std::pair< Key, Data > > Aleph::maptree_to_Array ( const DynMapTree< Key, Data, Tree, Compare > &  m)

Convert a DynMapTree to an Array of pairs.

Template Parameters
KeyThe key type.
DataThe data type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
mThe source DynMapTree.
Returns
An Array of pairs containing all key-value pairs from m.

Definition at line 1124 of file ah-convert.H.

References Aleph::Array< T >::append(), FunctionalMethods< Container, T >::for_each(), m, Aleph::Array< T >::reserve(), and OhashCommon< HashTbl, Key >::size().

Referenced by TEST().

◆ maptree_to_DynList()

template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< std::pair< Key, Data > > Aleph::maptree_to_DynList ( const DynMapTree< Key, Data, Tree, Compare > &  m)

Convert a DynMapTree to a DynList of pairs.

Creates a new DynList containing copies of all key-value pairs from the given DynMapTree. Elements are in tree traversal order (in-order).

Template Parameters
KeyThe key type.
DataThe data type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
mThe source DynMapTree.
Returns
A DynList of pairs containing all key-value pairs from m.

Definition at line 1103 of file ah-convert.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST(), and TEST().

◆ maptree_to_stdmap()

template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
std::map< Key, Data > Aleph::maptree_to_stdmap ( const DynMapTree< Key, Data, Tree, Compare > &  m)

Convert a DynMapTree to a std::map.

Template Parameters
KeyThe key type.
DataThe data type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
mThe source DynMapTree.
Returns
A std::map containing all key-value pairs from m.

Definition at line 1146 of file ah-convert.H.

References FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST().

◆ maptree_values_to_DynList()

template<typename Key , typename Data , template< typename, class > class Tree, class Compare >
DynList< Data > Aleph::maptree_values_to_DynList ( const DynMapTree< Key, Data, Tree, Compare > &  m)

Extract values from a DynMapTree to a DynList.

Template Parameters
KeyThe key type.
DataThe data type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
mThe source DynMapTree.
Returns
A DynList containing all values from m.

Definition at line 1190 of file ah-convert.H.

References Aleph::DynList< T >::append(), FunctionalMethods< Container, T >::for_each(), and m.

Referenced by TEST().

◆ mark_position()

StreamPosition Aleph::mark_position ( std::ifstream &  input_stream)
inline

Mark the current position for potential backtracking.

Saves the current stream position and line/column state so that it can be restored later if needed.

Parameters
input_streamThe input file stream
Returns
StreamPosition that can be passed to restore_position()
See also
restore_position()

Definition at line 760 of file parse_utils.H.

References Aleph::StreamPosition::column, current_col_number, current_line_number, Aleph::StreamPosition::line, mark_position(), and Aleph::StreamPosition::pos.

Referenced by mark_position(), TEST_F(), and try_char().

◆ mat_to_latex() [1/2]

template<typename Mat , class RowIndexFormatter , class ColIndexFormatter , class EntryFormatter >
void Aleph::mat_to_latex ( Mat &  mat,
long  n,
long  m,
std::ofstream &  out,
const std::string &  prefix = "",
const std::string &  suffix = "" 
)

Overload for std::ofstream output.

Convenience overload that accepts std::ofstream directly.

See also
mat_to_latex(Mat&, long, long, std::ostream&, const std::string&, const std::string&)

Definition at line 198 of file mat_latex.H.

References m, mat_to_latex(), out, prefix(), and suffix().

◆ mat_to_latex() [2/2]

template<typename Mat , class RowIndexFormatter , class ColIndexFormatter , class EntryFormatter >
void Aleph::mat_to_latex ( Mat &  mat,
long  n,
long  m,
std::ostream &  out,
const std::string &  prefix = "",
const std::string &  suffix = "" 
)

Generate LaTeX tabular representation of a matrix.

Converts a matrix to a LaTeX tabular environment with customizable formatting for row indices, column indices, and matrix entries.

Template Parameters
MatMatrix type (must support operator()(long, long) for entry access)
RowIndexFormatterFunctor type for formatting row indices. Must provide: std::string operator()(Mat&, long) const
ColIndexFormatterFunctor type for formatting column indices. Must provide: std::string operator()(Mat&, long) const
EntryFormatterFunctor type for formatting matrix entries. Must provide: std::string operator()(Mat&, long, long) const
Parameters
[in]matThe matrix to convert (passed by reference for efficiency)
[in]nNumber of rows
[in]mNumber of columns
[out]outOutput stream to write LaTeX content
[in]prefixOptional LaTeX content to prepend (e.g., "\\begin{center}")
[in]suffixOptional LaTeX content to append (e.g., "\\end{center}")
Note
The column width is set to 1mm by default. For larger content, consider modifying the generated LaTeX or using a different approach.
Example Output
\begin{tabular}{|c|p{1mm}p{1mm}p{1mm}|} \hline
& 0 & 1 & 2\\ \hline
0 & 0 & 5 & 3\\
1 & 5 & 0 & 2\\
2 & 3 & 2 & 0\\
\hline\end{tabular}

Definition at line 144 of file mat_latex.H.

References m, mat_to_latex(), out, prefix(), and suffix().

Referenced by mat_to_latex(), mat_to_latex(), and mat_to_latex_simple().

◆ mat_to_latex_simple()

template<typename Mat >
void Aleph::mat_to_latex_simple ( Mat &  mat,
long  n,
long  m,
std::ostream &  out,
const std::string &  prefix = "",
const std::string &  suffix = "" 
)

Generate LaTeX table with default formatters.

Simplified version using default integer formatters for indices and stream-based formatting for entries.

Template Parameters
MatMatrix type
Parameters
matThe matrix to convert
nNumber of rows
mNumber of columns
outOutput stream
prefixOptional LaTeX prefix
suffixOptional LaTeX suffix

Definition at line 276 of file mat_latex.H.

References m, mat_to_latex(), mat_to_latex_simple(), out, prefix(), and suffix().

Referenced by mat_to_latex_simple(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ matrix_chain_min_cost()

size_t Aleph::matrix_chain_min_cost ( const Array< size_t > &  dims)
inline

Compute only the minimum multiplication cost (value only).

A convenience version that delegates to matrix_chain_order and returns the min_multiplications value computed there.

Parameters
[in]dimsArray of matrix dimensions ( \(n+1\)entries for \(n\)matrices).
Returns
The minimum number of scalar multiplications.
Exceptions
ah_domain_errorif dims has fewer than 2 entries.
ah_runtime_errorif the cost calculation overflows size_t.
Note
Complexity: Time O(n^3), Space O(n^2).

Definition at line 225 of file Matrix_Chain.H.

References matrix_chain_order(), and Aleph::Matrix_Chain_Result::min_multiplications.

Referenced by main(), and TEST().

◆ matrix_chain_order()

Matrix_Chain_Result Aleph::matrix_chain_order ( const Array< size_t > &  dims)
inline

Compute the optimal matrix-chain multiplication order.

Finds the parenthesization that minimizes the total number of scalar multiplications.

Parameters
[in]dimsArray of matrix dimensions. Matrix \(A_i\)is assumed to have dimensions \(dims[i] \times dims[i+1]\). Therefore, for \(n\)matrices, dims must contain \(n+1\)elements.
Returns
A Matrix_Chain_Result containing the minimum cost, the string representation of the parenthesization, and the split table.
Exceptions
ah_domain_errorif dims has fewer than 2 entries.
ah_domain_errorif any dims dimension is zero.
ah_runtime_errorif the cost calculation overflows size_t.
Note
Complexity: Time O(n^3), Space O(n^2), where n is the number of matrices.

Definition at line 153 of file Matrix_Chain.H.

References ah_domain_error_if, Aleph::Array< T >::append(), Aleph::matrix_chain_detail::build_parens(), Aleph::matrix_chain_detail::checked_add(), Aleph::Array< T >::create(), dim(), k, l, Aleph::Array< T >::reserve(), row, Aleph::matrix_chain_detail::scalar_cost(), Aleph::Array< T >::size(), and split().

Referenced by matrix_chain_min_cost(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ matrix_dims()

template<DenseMatrix MatrixT>
constexpr std::pair< size_t, size_t > Aleph::matrix_dims ( const MatrixT &  m)
constexprnoexcept

Get dimensions of a matrix (dense or sparse).

Template Parameters
MatrixTThe matrix type (must satisfy ModularMatrixBackend).
Parameters
[in]mThe input matrix.
Returns
A pair containing (number of rows, number of columns).
Exceptions
noneDoes not throw (noexcept).
Note
Complexity: O(1).

Definition at line 95 of file modular_linalg.H.

References m, rows, and OhashCommon< HashTbl, Key >::size().

Referenced by Aleph::Modular_Matrix< MatrixT >::Modular_Matrix(), Aleph::Modular_Matrix< MatrixT >::determinant(), and Aleph::Modular_Matrix< MatrixT >::inverse().

◆ max_element()

template<class Itor , class CompFunc = Aleph::greater<typename Itor::value_type>>
Itor Aleph::max_element ( const Itor &  beg,
const Itor &  end,
CompFunc  op = CompFunc() 
)
inline

Find the maximum element in a range.

Returns an iterator to the largest element in the range [beg, end) according to the comparison function.

Template Parameters
ItorIterator type.
CompFuncComparison functor type.
Parameters
begIterator to the first element.
endIterator past the last element.
opComparison function (defaults to greater-than).
Returns
Iterator to the maximum element.

Definition at line 184 of file ahAlgo.H.

References min_element().

Referenced by TEST().

◆ MAX_EP() [1/2]

template<class Node >
const auto & Aleph::MAX_EP ( const Node *  p)
inlinenoexcept

Definition at line 499 of file tpl_interval_tree.H.

◆ MAX_EP() [2/2]

◆ max_flow_min_cost_by_cycle_canceling()

template<FlowNetwork Net, template< class > class Max_Flow_Algo = Ford_Fulkerson_Maximum_Flow>
std::tuple< size_t, double > Aleph::max_flow_min_cost_by_cycle_canceling ( Net &  net,
double  it_factor = 0.4,
size_t  step = 10 
)

Compute maximum flow at minimum cost using cycle canceling.

This algorithm first computes a maximum flow using a max-flow algorithm (Ford-Fulkerson by default), then iteratively finds and cancels negative cost cycles in the residual network using the Bellman-Ford algorithm until no more negative cycles exist.

The algorithm guarantees that the final flow is:

  1. A maximum flow (same value as produced by the max-flow algorithm)
  2. Has minimum total cost among all maximum flows

The costs may be negative: the cheapest maximum flow saturates the cycles of negative cost, also those apart from the source.

Warning
With a floating flow, the comparisons are within tolerances relative to the whole network: a relaxation of Bellman-Ford must improve a distance by more than 4 n^2 epsilons of the largest finite cost, where n is the number of nodes, and an arc has residual capacity if it has more than 1000 epsilons, some 2.2e-13, of the largest finite capacity or flow left. They keep the residues of rounding from being taken for negative cycles, at any scale of the data; but a difference below them counts as zero, and the tolerance of the costs holds for each relaxation, not for a whole cycle: a cycle of m arcs, each of which improves a distance by less than it, goes unseen with a cost of up to m times it, and only a cycle of cost below -n times it is sure to be found. So an arc of a far larger magnitude, even one without flow, as a large penalty cost or a large finite capacity, can hide the negative cycles of the other arcs, and the flow is not of least cost, without notice: with 100 nodes, a cost of 2e11 can hide the cycles of cost -1; with 10 nodes, a cost of 1e13 hides a cycle of 8 arcs of -0.8, of cost -6.4; and a capacity of 1e13 keeps an arc of capacity 1 out of the residual network. Keep the largest cost below the smallest difference of cost that matters over 4 n^3 epsilons, and the largest capacity below some 4.5e12 times the smallest one, as by scaling them; give an arc without a bound the capacity max() or infinity, which the tolerances leave out; or take an integer flow, which compares exactly.
Template Parameters
NetNetwork type (must be Net_Cost_Graph or compatible).
Max_Flow_AlgoMaximum flow algorithm template (default: Ford_Fulkerson_Maximum_Flow).
Parameters
[in,out]netThe network to compute max-flow min-cost on. Flow values are modified in place.
[in]it_factorInitial iteration factor for Bellman-Ford's early cycle detection (default: 0.4).
[in]stepStep increment for iteration threshold (default: 10).
Returns
Tuple containing:
  • Number of negative cycles cancelled
  • Final iteration factor used
Exceptions
bad_allocIf there is not enough memory.
domain_errorIf network is not single source and single sink, if the maximum flow is infinite, as through a path from the source to the sink of arcs of infinite capacity, which has no cost to minimize, or if the program is unbounded: a cycle of negative cost through arcs without capacity. The network keeps then the maximum flow.
Complexity
O(V * E^2 * C * U) where V is vertices, E is edges, C is max cost, and U is max capacity. In practice, often much faster due to early cycle detection.
Example
// ... build network with costs ...
auto [cycles, factor] = max_flow_min_cost_by_cycle_canceling(net);
double total_cost = net.flow_cost();
std::tuple< size_t, double > max_flow_min_cost_by_cycle_canceling(Net &net, double it_factor=0.4, size_t step=10)
Compute maximum flow at minimum cost using cycle canceling.
Capacitated flow network with costs associated to arcs.
Flow_Type flow_cost() const
Compute the total cost of flow circulating through the network.
See also
Max_Flow_Min_Cost_By_Cycle_Canceling

Definition at line 864 of file tpl_netcost.H.

References arcs_map(), build_residual_net(), cancel_cycle(), count(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), Aleph::net_detail::refuse_infinite_maximum_flow(), Aleph::net_detail::return_dust(), GraphCommon< GT, Node, Arc >::vsize(), and Aleph::net_detail::without_capacity().

Referenced by demo_compare_algorithms_on_logistics(), demo_mincost_maxflow(), TEST(), TEST(), TEST(), and TEST().

◆ max_flow_min_cost_by_network_simplex()

template<FlowNetwork Net, template< class > class Max_Flow_Algo = Ford_Fulkerson_Maximum_Flow>
size_t Aleph::max_flow_min_cost_by_network_simplex ( Net &  net)

Compute maximum flow at minimum cost using Network Simplex.

This algorithm first computes a maximum flow using a max-flow algorithm (Ford-Fulkerson by default), then optimizes cost using the Network Simplex algorithm with a two-phase approach:

  • Phase I: Establishes a valid basic feasible solution by forcing all arcs with partial flow (0 < flow < cap) into the spanning tree.
  • Phase II: Standard Network Simplex optimization that finds arcs with negative reduced cost and performs pivots until optimal.
Template Parameters
NetNetwork type (must be Net_Cost_Graph or compatible).
Max_Flow_AlgoMaximum flow algorithm template.
Parameters
[in,out]netThe network to compute max-flow min-cost on. Flow values are modified in place.
Returns
Number of simplex pivots performed (Phase I + Phase II).
Exceptions
bad_allocIf there is not enough memory.
domain_errorIf network is not single source and single sink, if the maximum flow is infinite, as through a path from the source to the sink of arcs of infinite capacity, which has no cost to minimize, and which the network keeps; if the flow that Max_Flow_Algo leaves is not feasible (see Network_Simplex::run()), which the maximum flows of the library do not leave; or if the program is unbounded: a cycle of negative cost through arcs without capacity.
runtime_errorIf the pivots reach their bound before the optimum (see Network_Simplex::run()).
Complexity
Expected O(n * m * log(n * C)) with good pivot rules, where n=nodes, m=arcs, C=max cost. Worst case is pseudo-polynomial.
Example
// ... build network with costs ...
double total_cost = net.flow_cost();
size_t max_flow_min_cost_by_network_simplex(Net &net)
Compute maximum flow at minimum cost using Network Simplex.
See also
max_flow_min_cost_by_cycle_canceling Network_Simplex

Definition at line 2601 of file tpl_netcost.H.

References Aleph::net_detail::refuse_infinite_maximum_flow(), and Aleph::Network_Simplex< Net >::run().

Referenced by demo_compare_algorithms_on_logistics(), and TEST().

◆ max_ptr()

template<class Container , class Cmp = std::less<typename Container::Item_Type>>
requires PredicateWith<Cmp &, const typename Container::Item_Type &, functional_detail::get_curr_cref_t<Container>>
const Container::Item_Type * Aleph::max_ptr ( const Container &  container,
Cmp  cmp = Cmp() 
)
inline

Find the maximum element in a container.

Parameters
containerSource container.
cmpComparator (defaults to std::less, finds max by reversing comparison).
Returns
Pointer to the maximum element, or nullptr if container is empty.

Definition at line 2567 of file ahFunctional.H.

References cmp().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ max_value()

template<typename Container >
auto Aleph::max_value ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute maximum value.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Maximum value
Exceptions
std::invalid_argumentif container is empty

Definition at line 294 of file stat_utils.H.

References ah_invalid_argument_if, and max_value().

Referenced by Aleph::CA::Reproductions::fit_log_log_histogram(), Aleph::FFT< Real >::max_abs_value(), max_value(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ mean()

template<typename Container >
auto Aleph::mean ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute the arithmetic mean.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Arithmetic mean
Exceptions
std::invalid_argumentif container is empty

Definition at line 190 of file stat_utils.H.

References ah_invalid_argument_if, and mean().

Referenced by coefficient_of_variation(), Aleph::FFT< Real >::demean_copy(), demo_practical(), example_parallel_aggregations(), Aleph::howard_detail::karp_by_component(), kurtosis(), mean(), monte_carlo_simulation(), Aleph::CA::Reproductions::morans_i_binary(), Aleph::FFT< Real >::overlap_profile_has_cola(), skewness(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TYPED_TEST(), and TYPED_TEST().

◆ median() [1/2]

template<typename Container >
auto Aleph::median ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute the median (50th percentile).

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container (will be copied and sorted)
Returns
Median value
Exceptions
std::invalid_argumentif container is empty

Definition at line 393 of file stat_utils.H.

References median(), and percentile().

◆ median() [2/2]

template<class T , class Compare = Aleph::less<T>>
const T * Aleph::median ( const T &  a,
const T &  b,
const T &  c,
const Compare &  cmp = Compare() 
)
inline

Return a pointer to the median value among three elements.

A pointer is returned to avoid copies and to allow pointer equality comparisons.

Definition at line 85 of file ahUtils.H.

References cmp(), and median().

Referenced by main(), Aleph::CA::Bench::measure(), median(), median(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::split_child(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ mem_fun() [1/4]

template<class _Ret , class _Tp >
const_mem_fun_t< _Ret, _Tp > Aleph::mem_fun ( _Ret(_Tp::*)() const  __f)
inline

Definition at line 936 of file ahFunction.H.

◆ mem_fun() [2/4]

template<class _Ret , class _Tp >
mem_fun_t< _Ret, _Tp > Aleph::mem_fun ( _Ret(_Tp::*)()  __f)
inline

Definition at line 930 of file ahFunction.H.

◆ mem_fun() [3/4]

template<class _Ret , class _Tp , class _Arg >
const_mem_fun1_t< _Ret, _Tp, _Arg > Aleph::mem_fun ( _Ret(_Tp::*)(_Arg) const  __f)
inline

Definition at line 960 of file ahFunction.H.

◆ mem_fun() [4/4]

template<class _Ret , class _Tp , class _Arg >
mem_fun1_t< _Ret, _Tp, _Arg > Aleph::mem_fun ( _Ret(_Tp::*)(_Arg)  __f)
inline

Definition at line 954 of file ahFunction.H.

◆ mem_fun_ref() [1/4]

template<class _Ret , class _Tp >
const_mem_fun_ref_t< _Ret, _Tp > Aleph::mem_fun_ref ( _Ret(_Tp::*)() const  __f)
inline

Definition at line 948 of file ahFunction.H.

◆ mem_fun_ref() [2/4]

template<class _Ret , class _Tp >
mem_fun_ref_t< _Ret, _Tp > Aleph::mem_fun_ref ( _Ret(_Tp::*)()  __f)
inline

Definition at line 942 of file ahFunction.H.

◆ mem_fun_ref() [3/4]

template<class _Ret , class _Tp , class _Arg >
const_mem_fun1_ref_t< _Ret, _Tp, _Arg > Aleph::mem_fun_ref ( _Ret(_Tp::*)(_Arg) const  __f)
inline

Definition at line 973 of file ahFunction.H.

◆ mem_fun_ref() [4/4]

template<class _Ret , class _Tp , class _Arg >
mem_fun1_ref_t< _Ret, _Tp, _Arg > Aleph::mem_fun_ref ( _Ret(_Tp::*)(_Arg)  __f)
inline

Definition at line 966 of file ahFunction.H.

◆ merge() [1/4]

template<class Itor1 , class Itor2 , class Itor3 >
Itor3 Aleph::merge ( Itor1  source1Beg,
Itor1  source1End,
Itor2  source2Beg,
Itor2  source2End,
Itor3  destBeg 
)
inline

Merge two sorted ranges.

Merges elements from [source1Beg, source1End) and [source2Beg, source2End) into a single sorted sequence starting at destBeg.

Template Parameters
Itor1First source iterator type.
Itor2Second source iterator type.
Itor3Destination iterator type.
Parameters
source1BegIterator to the first element of the first source.
source1EndIterator past the last element of the first source.
source2BegIterator to the first element of the second source.
source2EndIterator past the last element of the second source.
destBegIterator to the first destination position.
Returns
Iterator past the last merged element in destination.

Definition at line 1410 of file ahAlgo.H.

References and, and copy().

Referenced by Aleph::Gen_Reroot_DP< GT, T, SA >::Gen_Reroot_DP(), merge(), TEST(), TEST(), TEST(), validate_bytecode_module(), validate_cfg_module(), validate_ir_module(), and validate_ssa_module().

◆ merge() [2/4]

template<class Itor1 , class Itor2 , class Itor3 , class BinaryPredicate >
Itor3 Aleph::merge ( Itor1  source1Beg,
Itor1  source1End,
Itor2  source2Beg,
Itor2  source2End,
Itor3  destBeg,
BinaryPredicate  op 
)
inline

Merge two sorted ranges with custom comparison.

Merges elements from two sorted ranges into a single sorted sequence using the given comparison function.

Template Parameters
Itor1First source iterator type.
Itor2Second source iterator type.
Itor3Destination iterator type.
BinaryPredicateComparison predicate.
Parameters
source1BegIterator to the first element of the first source.
source1EndIterator past the last element of the first source.
source2BegIterator to the first element of the second source.
source2EndIterator past the last element of the second source.
destBegIterator to the first destination position.
opBinary comparison predicate.
Returns
Iterator past the last merged element in destination.

Definition at line 1452 of file ahAlgo.H.

References and, and copy().

◆ merge() [3/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::merge ( T *  a,
const long  l,
const long  m,
const long  r,
Array< T > &  buf,
const Compare &  cmp = Compare() 
)
inline

Merge two sorted partitions of an array using a buffer.

Merges the sorted subarrays [l..m] and [m+1..r] into a single sorted subarray [l..r]. Uses a provided buffer to avoid repeated allocations.

This is the core operation of merge sort. The first partition is moved to the buffer and merged back with the second, which is in place; with equal elements, those of the first partition go first, so that the merge is stable.

Time complexity: O(n), where n = r - l + 1 Space complexity: O(n) for the buffer, which needs room for the first partition

Template Parameters
TElement type (must be move-assignable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array containing both partitions.
[in]lLeft index of the first partition.
[in]mLast index of the first partition (m+1 is start of second).
[in]rRight index of the second partition.
[in,out]bufBuffer for temporary storage (cleared and reused).
cmpComparison functor.
Precondition
Both [l..m] and [m+1..r] must be sorted.
Postcondition
[l..r] is sorted.
See also
mergesort()

Definition at line 1150 of file tpl_sort_utils.H.

References and, Aleph::Array< T >::base(), cmp(), k, l, m, Aleph::Array< T >::putn(), r, and Aleph::Array< T >::size().

◆ merge() [4/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::merge ( T *  a,
const long  l,
const long  m,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Merges two ordered partitions stored in an array.

merge() assumes as input two partitions ordered between the ranges [l..m] and [m+1..r] and mixes them in an ordering between [l..r].

Parameters
[in]athe array
[in]lleft index of the array
[in]mcenter of the array, of the partition
[in]rright index of the array
cmpcomparison object.

Definition at line 1219 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create_reserved(), l, m, merge(), and r.

◆ merge_lists() [1/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::merge_lists ( Dnode< T > &  l1,
Dnode< T > &  l2,
Dnode< T > &  result,
const Compare &  cmp = Compare() 
)
inline

Merge two sorted Dnode-based lists.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]l1First sorted list.
[in,out]l2Second sorted list.
[out]resultEmpty list to receive merged result.
[in]cmpComparison functor.

Definition at line 1350 of file tpl_sort_utils.H.

References cmp(), l1, and l2.

◆ merge_lists() [2/2]

template<typename Tlist , class Compare >
void Aleph::merge_lists ( Tlist &  l1,
Tlist &  l2,
Tlist &  result,
const Compare &  cmp = Compare() 
)
inline

Merge two sorted lists into a single sorted list.

Takes two sorted lists and merges them into a single sorted list. The input lists are emptied and their nodes are transferred to the result list. This is an O(n) operation with O(1) extra space.

Time complexity: O(n + m), where n and m are the list sizes Space complexity: O(1) - nodes are moved, not copied

Template Parameters
TlistList type (e.g., Dlink, HTList).
CompareComparison functor for list elements.
Parameters
[in,out]l1First sorted list (will be emptied).
[in,out]l2Second sorted list (will be emptied).
[out]resultEmpty list to receive merged result.
cmpComparison functor.
Precondition
l1 and l2 must be sorted; result must be empty.
Postcondition
l1 and l2 are empty; result contains all elements in sorted order. With equal items, those of l1 go first, so that the merge is stable.
Warning
Does not verify that input lists are sorted.
See also
mergesort()

Definition at line 1321 of file tpl_sort_utils.H.

References and, cmp(), Aleph::DynList< T >::get_first_ne(), Aleph::HTList::is_empty(), l1, l2, and Aleph::DynList< T >::remove_first_ne().

◆ mergeinsertsort()

template<template< typename > class Tlist, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::mergeinsertsort ( Tlist< T > &  list,
const Compare &  cmp = Compare(),
const size_t  lsz = Aleph::Insertion_Threshold 
)
inline

Sort a list by mergesort combined with the insert method.

Sort a list using the mergesort method dynamic (DynList or DynDlist) according to comparison criteria Compare.

This method has a deterministic performance of \(O(n \; \lg n)\) and space consumption of \(O(\lg n)\) due to the recursive call stack. It is a very good method for lists.

Parameters
[in,out]listthe list to be sorted.
lszsize threshold to switch to insertion sort.
cmpcomparison object.
See also
mergesort(Dnode<T> & list)

Definition at line 1482 of file tpl_sort_utils.H.

References cmp(), l, and r.

Referenced by TEST(), and TEST_F().

◆ mergesort() [1/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::mergesort ( Dnode< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Merge sort for Dnode-based lists.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 1550 of file tpl_sort_utils.H.

References cmp().

◆ mergesort() [2/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::mergesort ( DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Merge sort for DynDlist.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 1563 of file tpl_sort_utils.H.

References cmp().

◆ mergesort() [3/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
DynList< T > Aleph::mergesort ( DynList< T > &&  list,
const Compare &  cmp = Compare() 
)
inline

Merge sort for DynList (rvalue overload).

Moves the input list into the sorted result.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort (rvalue).
[in]cmpComparison functor.
Returns
The sorted list.

Definition at line 1600 of file tpl_sort_utils.H.

References cmp().

◆ mergesort() [4/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::mergesort ( DynList< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Merge sort for DynList.

The nodes are linked again, so that nothing is allocated and the references to the items stay valid.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.
Exceptions
anythingthat cmp throws. Then list keeps all its items, in an unspecified order.

Definition at line 1581 of file tpl_sort_utils.H.

References cmp().

◆ mergesort() [5/8]

template<typename T , class Compare >
void Aleph::mergesort ( T *  a,
const long  l,
const long  r,
Array< T > &  buf,
Compare  cmp 
)

Sort an array using merge sort with a reusable buffer.

Parameters
aPointer to the array.
lLeft index (inclusive).
rRight index (inclusive).
bufReusable buffer for merging.
cmpComparison functor.

Definition at line 1233 of file tpl_sort_utils.H.

References cmp(), l, m, and r.

Referenced by benchmark_list_algorithms(), demonstrate_complexity(), in_place_multisort_arrays(), main(), mergesort(), Aleph::Random_Graph_Base< GT, Init_Node, Init_Arc >::sort_components(), TEST(), TEST_F(), and welsh_powell_coloring().

◆ mergesort() [6/8]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::mergesort ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Sort an array using merge sort.

Merge sort is a divide-and-conquer algorithm that recursively divides the array in half, sorts each half, and merges the sorted halves.

Algorithm

  1. If l >= r, the subarray is trivially sorted
  2. Find the midpoint m = l + (r - l) / 2
  3. Recursively sort [l..m] and [m+1..r]
  4. Merge the two sorted halves

Characteristics

  • Time complexity: O(n log n) - always (best, average, worst)
  • Space complexity: O(n) for the auxiliary buffer
  • Stability: Stable (equal elements maintain relative order)
  • Adaptive: Semi-adaptive (skips merge if already sorted)

When to Use

  • When guaranteed O(n log n) is required
  • When stability is needed
  • External sorting (large data on disk)
  • Linked lists (where it achieves O(1) space!)
Template Parameters
TElement type (must be move-assignable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array to sort.
[in]lLeft index (inclusive) of the range to sort.
[in]rRight index (inclusive) of the range to sort.
cmpComparison functor.
See also
quicksort(), heapsort(), merge()

Definition at line 1284 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create_reserved(), l, mergesort(), and r.

◆ mergesort() [7/8]

template<typename Tlist , class Compare >
void Aleph::mergesort ( Tlist &  list,
const Compare &  cmp = Compare() 
)
inline

Sort a linked list using merge sort.

Merge sort is particularly efficient for linked lists because:

  • Splitting a list at the midpoint is O(n) (vs O(1) for arrays)
  • But merging is O(1) space (just pointer manipulation)
  • Overall, we get O(n log n) time with O(log n) stack space

Algorithm

  1. If list has 0 or 1 elements, it's sorted
  2. Split the list into two halves
  3. Recursively sort each half
  4. Merge the sorted halves

Characteristics

  • Time complexity: O(n log n) - always
  • Space complexity: O(log n) for recursion stack
  • Stability: Stable
  • In-place: Yes (for lists)

This is often the best sorting algorithm for linked lists.

Template Parameters
TlistList type (e.g., Dlink, HTList).
CompareComparison functor type.
Parameters
[in,out]listThe list to sort.
cmpComparison functor.
Exceptions
anythingthat cmp throws. Then list keeps all its elements, in an unspecified order.
See also
merge_lists(), quicksort()

Definition at line 1388 of file tpl_sort_utils.H.

References cmp(), Aleph::DynList< T >::get_first_ne(), l, and r.

◆ mergesort() [8/8]

template<template< typename > class Tlist, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::mergesort ( Tlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Merge sort for generic list templates.

Template Parameters
TlistList template type.
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 1534 of file tpl_sort_utils.H.

References cmp().

◆ message()

◆ miller_rabin()

bool Aleph::miller_rabin ( uint64_t  n)
inlinenoexcept

Miller-Rabin primality test for 64-bit integers.

A deterministic primality test for any 64-bit unsigned integer. It uses a known sufficient set of 7 bases (Jim Sinclair's set) to guarantee correctness for all n < 2^64.

Parameters
nThe number to test for primality.
Returns
true if n is prime, false otherwise.

Definition at line 88 of file primality.H.

References Aleph::detail::check_composite().

Referenced by Aleph::Modular_Matrix< MatrixT >::Modular_Matrix(), Aleph::ModularCombinatorics::ModularCombinatorics(), demo_primality_factorization(), Aleph::detail::extract_prime_factors(), TEST(), and TEST().

◆ min_cut()

template<class Net , template< class > class Maxflow>
Net::Flow_Type Aleph::min_cut ( Net &  net,
DynSetTree< typename Net::Node * > &  vs,
DynSetTree< typename Net::Node * > &  vt,
DynList< typename Net::Arc * > &  cuts,
DynList< typename Net::Arc * > &  cutt 
)

Compute max flow and the corresponding minimum cut.

Parameters
[in,out]netFlow network (must have a single source and sink).
[out]vsSet of nodes in V_s.
[out]vtSet of nodes in V_t.
[out]cutsArcs from V_s to V_t (the cut).
[out]cuttArcs from V_t to V_s.
Returns
Max flow value (equal to min-cut capacity).

Definition at line 2790 of file tpl_net.H.

References and, Aleph::DynSetTree< Key, Tree, Compare >::contains(), Aleph::Net_Graph< NodeT, ArcT >::flow_value(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::DynList< T >::insert(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::DynSetTree< Key, Tree, Compare >::size(), and Unprocessed.

Referenced by Aleph::Karger_Min_Cut< GT, SA >::compute_min_cut_size(), example_network_reliability(), Aleph::Karger_Min_Cut< GT, SA >::karger_min_cut(), segment_image(), solve_project_selection(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_sw_chain_weighted(), test_sw_complete_k4(), test_sw_empty_graph(), test_sw_min_cut_weight_only(), test_sw_single_edge(), test_sw_triangle_weighted(), test_sw_two_heavy_clusters(), test_sw_unit_weight(), TYPED_TEST(), TYPED_TEST(), and verify_max_flow_min_cut().

◆ min_element()

template<class Itor , class CompFunc = Aleph::less<typename Itor::value_type>>
Itor Aleph::min_element ( Itor  beg,
const Itor &  end,
CompFunc  op = CompFunc() 
)
inline

Find the minimum element in a range.

Returns an iterator to the smallest element in the range [beg, end) according to the comparison function.

Template Parameters
ItorIterator type.
CompFuncComparison functor type.
Parameters
begIterator to the first element.
endIterator past the last element.
opComparison function (defaults to less-than).
Returns
Iterator to the minimum element.

Definition at line 148 of file ahAlgo.H.

References min().

Referenced by max_element(), TEST(), TEST(), TEST(), test_non_power_of_two_sizes(), test_performance_build_large(), and test_power_of_two_sizes().

◆ min_max()

template<typename Container >
auto Aleph::min_max ( const Container &  data) -> std::pair<std::decay_t<decltype(*std::begin(data))>, std::decay_t<decltype(*std::begin(data))>>

Compute minimum and maximum values in one pass.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Pair of (min, max)
Exceptions
std::invalid_argumentif container is empty

Definition at line 316 of file stat_utils.H.

References ah_invalid_argument_if, and min_max().

Referenced by compute_all_stats(), histogram(), min_max(), TEST(), TEST(), and TEST().

◆ min_ptr()

template<class Container , class Cmp = std::less<typename Container::Item_Type>>
requires PredicateWith<Cmp &, functional_detail::get_curr_cref_t<Container>, const typename Container::Item_Type &>
const Container::Item_Type * Aleph::min_ptr ( const Container &  container,
Cmp  cmp = Cmp() 
)
inline

Find the minimum element in a container.

Parameters
containerSource container.
cmpComparator (defaults to std::less).
Returns
Pointer to the minimum element, or nullptr if container is empty.

Definition at line 2541 of file ahFunctional.H.

References cmp().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ min_value()

template<typename Container >
auto Aleph::min_value ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute minimum value.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Minimum value
Exceptions
std::invalid_argumentif container is empty

Definition at line 272 of file stat_utils.H.

References ah_invalid_argument_if, and min_value().

Referenced by Aleph::CA::Reproductions::fit_log_log_histogram(), min_value(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ min_weighted_squared_distance_1d()

template<typename T >
Array< T > Aleph::min_weighted_squared_distance_1d ( const Array< T > &  xs,
const Array< T > &  weights 
)
inline

Weighted squared-distance lower envelope on a line.

For each query coordinate x_i, computes:

min_j ( (x_i - x_j)^2 + weight_j )

by transforming each site (x_j, weight_j) into a line: m = -2*x_j, b = x_j^2 + weight_j, then adding back x_i^2.

This is a geometric application of CHT/Li Chao (lower envelope of parabolas) and also a common DP optimization pattern.

Template Parameters
TSigned integral numeric type.
Parameters
[in]xsSigned integral coordinates.
[in]weightsAdditive weights per coordinate.
Returns
Array<T> with one minimum value per query coordinate.
Exceptions
ah_domain_errorif array sizes differ.

Definition at line 850 of file DP_Optimizations.H.

References Aleph::Li_Chao_Tree< T >::add_line(), ah_domain_error_if, and, Aleph::Array< T >::create(), m, Aleph::Li_Chao_Tree< T >::query(), and Aleph::Array< T >::size().

Referenced by TEST(), TEST(), and TEST().

◆ minmax_ptr()

template<class Container , class Cmp = std::less<typename Container::Item_Type>>
requires PredicateWith<Cmp &, functional_detail::get_curr_cref_t<Container>, const typename Container::Item_Type &>
and PredicateWith< Cmp &, const typename Container::Item_Type &, functional_detail::get_curr_cref_t< Container > > std::pair< const typename Container::Item_Type *, const typename Container::Item_Type * > Aleph::minmax_ptr ( const Container &  container,
Cmp  cmp = Cmp() 
)
inline

Find both min and max elements in a single pass.

Parameters
containerSource container.
cmpComparator (defaults to std::less).
Returns
Pair of pointers (min, max), or (nullptr, nullptr) if container is empty.

Definition at line 2595 of file ahFunctional.H.

References cmp().

Referenced by TEST(), and TEST().

◆ mismatch()

template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
std::pair< Itor1, Itor2 > Aleph::mismatch ( Itor1  beg,
const Itor1 &  end,
Itor2  cmpBeg,
BinaryPredicate  op = BinaryPredicate() 
)
inline

Find the first mismatching elements in two ranges.

Compares elements in the range [beg, end) with elements starting at cmpBeg and returns the first pair that differs.

Template Parameters
Itor1First range iterator type.
Itor2Second range iterator type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element of the first range.
endIterator past the last element of the first range.
cmpBegIterator to the first element of the second range.
opBinary predicate for comparison.
Returns
Pair of iterators to the first mismatching elements.

Definition at line 516 of file ahAlgo.H.

References and.

Referenced by TEST(), and TEST().

◆ mod_exp()

uint64_t Aleph::mod_exp ( uint64_t  base,
uint64_t  exp,
const uint64_t  m 
)
inline

Modular exponentiation.

Computes (base^exp) % m in O(log exp) time.

Parameters
baseThe base.
expThe exponent.
mThe modulus.
Returns
(base^exp) % m.
Exceptions
std::invalid_argumentif m == 0.

Definition at line 110 of file modular_arithmetic.H.

References ah_invalid_argument_if, exp(), m, and mod_mul().

Referenced by Aleph::detail::check_composite(), Aleph::Gen_Polynomial< Coefficient >::eval_mod_u64(), Aleph::NTT< MOD, ROOT >::Plan::initialize_bluestein_plan(), Aleph::NTT< MOD, ROOT >::poly_power(), TEST(), TEST_F(), and Aleph::NTT< MOD, ROOT >::tonelli_shanks().

◆ mod_inv()

uint64_t Aleph::mod_inv ( const uint64_t  a,
const uint64_t  m 
)
inline

Modular Inverse.

Computes the modular inverse of a modulo m using an iterative extended Euclidean algorithm that works entirely in unsigned arithmetic. Safe for all 64-bit values including m >= 2^63.

Requires gcd(a, m) == 1 (i.e., a and m must be coprime).

Parameters
aThe number to find the inverse of.
mThe modulus (must be > 0).
Returns
The modular inverse of a modulo m, in [0, m).
Exceptions
std::domain_errorif m == 0.
std::invalid_argumentif the inverse does not exist (a and m are not coprime, or a == 0 mod m).

Definition at line 169 of file modular_arithmetic.H.

References ah_domain_error_if, ah_invalid_argument_if, m, and mod_mul().

Referenced by Aleph::ModularCombinatorics::ModularCombinatorics(), Aleph::NTT< MOD, ROOT >::Plan::Plan(), crt(), Aleph::Modular_Matrix< MatrixT >::determinant(), Aleph::Gen_Polynomial< Coefficient >::hensel_lift(), Aleph::NTT< MOD, ROOT >::Plan::initialize_bluestein_plan(), Aleph::NTT< MOD, ROOT >::Plan::initialize_power_of_two_plan(), Aleph::NTT< MOD, ROOT >::Plan::initialize_twiddles(), Aleph::NTT< MOD, ROOT >::interpolate(), Aleph::Modular_Matrix< MatrixT >::inverse(), Aleph::NTT< MOD, ROOT >::negacyclic_multiply(), Aleph::NTT< MOD, ROOT >::poly_integral(), Aleph::NTT< MOD, ROOT >::poly_inverse(), Aleph::NTT< MOD, ROOT >::poly_power(), Aleph::NTT< MOD, ROOT >::poly_sqrt(), Aleph::NTTExact::reconstruct_coefficient(), and TEST().

◆ mod_mul()

◆ mode()

template<typename Container >
auto Aleph::mode ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute the mode (most frequent value).

For continuous data, consider discretizing first. If multiple values have the same frequency, returns the first one encountered.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Mode value
Exceptions
std::invalid_argumentif container is empty

Definition at line 447 of file stat_utils.H.

References ah_invalid_argument_if, StlAlephIterator< SetName >::begin(), count(), and mode().

Referenced by Aleph::detail::Pid_File_Lock::acquire(), main(), mode(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::open_storage(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::open_storage(), Aleph::detail::Pid_File_Lock::register_path(), Aleph::FFT< Real >::simd_preference(), Aleph::NTT< MOD, ROOT >::simd_preference(), TEST(), TEST(), TEST(), TEST(), TEST(), and Aleph::detail::Pid_File_Lock::unregister_path().

◆ monotone_queue_min_dp()

template<typename Cost >
Monotone_Queue_DP_Result< Cost > Aleph::monotone_queue_min_dp ( const Array< Cost > &  base_cost,
const size_t  window,
const Cost  inf = dp_optimization_detail::default_inf<Cost>() 
)
inline

Optimize windowed min-transition DP with a monotone queue.

Solves:

dp[0] = base_cost[0]
dp[i] = base_cost[i] + min(dp[j]) for j in [max(0, i-window), i-1]
__gmp_expr< typename __gmp_resolve_expr< T, V >::value_type, __gmp_binary_expr< __gmp_expr< T, U >, __gmp_expr< V, W >, __gmp_max_function > > max(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
Definition gmpfrxx.h:4188
__gmp_expr< typename __gmp_resolve_expr< T, V >::value_type, __gmp_binary_expr< __gmp_expr< T, U >, __gmp_expr< V, W >, __gmp_min_function > > min(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
Definition gmpfrxx.h:4189
Template Parameters
CostNumeric DP cost type.
Parameters
[in]base_costAdditive base cost per state.
[in]windowMaximum predecessor distance.
[in]infSentinel for unreachable states.
Returns
Monotone_Queue_DP_Result with dp and parent pointers.
Exceptions
ah_domain_errorif window == 0 and size > 1.
Note
Complexity: O(n).

Definition at line 779 of file DP_Optimizations.H.

References ah_domain_error_if, ah_runtime_error_if, and, Aleph::Array< T >::append(), Aleph::Array< T >::create(), Aleph::Array< T >::remove_last(), and Aleph::Array< T >::size().

◆ mul_xor_fold64()

static std::uint64_t Aleph::mul_xor_fold64 ( std::uint64_t  lhs,
std::uint64_t  rhs 
)
inlinestaticnoexcept

Definition at line 163 of file hash-fct.C.

References low().

Referenced by wyhash_mix().

◆ murmur3hash() [1/3]

size_t Aleph::murmur3hash ( const char *  key,
const std::uint32_t  seed 
)
inline

Definition at line 378 of file hash-fct.H.

References MurmurHash3_x64_128(), MurmurHash3_x86_32(), and seed.

◆ murmur3hash() [2/3]

◆ murmur3hash() [3/3]

size_t Aleph::murmur3hash ( const std::string &  key,
const std::uint32_t  seed 
)
inline

Definition at line 395 of file hash-fct.H.

References MurmurHash3_x64_128(), MurmurHash3_x86_32(), and seed.

◆ MurmurHash3_x64_128()

void Aleph::MurmurHash3_x64_128 ( const void *  key,
const int  len,
const uint32_t  seed,
void *  out 
)

Definition at line 556 of file hash-fct.C.

References BIG_CONSTANT, fmix64(), out, read_le64(), ROTL64, seed, and write_le64().

Referenced by murmur3hash(), murmur3hash(), and murmur3hash().

◆ MurmurHash3_x86_128()

void Aleph::MurmurHash3_x86_128 ( const void *  key,
const int  len,
uint32_t  seed,
void *  out 
)

Definition at line 452 of file hash-fct.C.

References fmix32(), out, read_le32(), ROTL32, seed, and write_le32().

◆ MurmurHash3_x86_32()

void Aleph::MurmurHash3_x86_32 ( const void *  key,
int  len,
uint32_t  seed,
void *  out 
)

Definition at line 399 of file hash-fct.C.

References fmix32(), out, read_le32(), ROTL32, seed, and write_le32().

Referenced by murmur3hash(), murmur3hash(), and murmur3hash().

◆ mutable_tolower()

std::string & Aleph::mutable_tolower ( std::string &  str)
inline

Convert a std::string to lower-case in-place.

Parameters
[in,out]strString to modify.
Returns
Reference to str.

Definition at line 352 of file ah-string-utils.H.

Referenced by TEST().

◆ mutable_toupper()

std::string & Aleph::mutable_toupper ( std::string &  str)
inline

Convert a std::string to upper-case in-place.

Parameters
[in,out]strString to modify.
Returns
Reference to str.

Definition at line 364 of file ah-string-utils.H.

Referenced by TEST().

◆ negamax_search() [1/6]

template<AdversarialGameDomain Domain>
auto Aleph::negamax_search ( Domain  domain,
typename Domain::State  initial_state,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for one-shot Negamax search.

Definition at line 1233 of file Negamax.H.

References negamax_search().

Referenced by main(), negamax_search(), negamax_search(), negamax_search(), negamax_search(), negamax_search(), negamax_search(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ negamax_search() [2/6]

template<AdversarialGameDomain Domain, typename Table >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > auto Aleph::negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Negamax search with domain-provided state key.

Definition at line 1289 of file Negamax.H.

References negamax_search().

◆ negamax_search() [3/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
auto Aleph::negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Negamax search with transposition table.

Definition at line 1258 of file Negamax.H.

References negamax_search().

◆ negamax_search() [4/6]

template<AdversarialGameDomain Domain, typename Table , typename Keyer , typename Tracer >
requires AdversarialSearchKeyer<Table, Keyer, typename Domain::State, typename Domain::Move, typename Domain::Score>
and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Keyer  keyer,
Tracer &  tracer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Negamax search with TT/keyer and tracing.

Definition at line 1273 of file Negamax.H.

References negamax_search().

◆ negamax_search() [5/6]

template<AdversarialGameDomain Domain, typename Table , typename Tracer >
requires SearchStateKeyProvider<Domain>
and AdversarialTranspositionMemo< Table, typename Domain::State_Key, typename Domain::Move, typename Domain::Score > and AdversarialSearchTracer< Tracer, typename Domain::Move, typename Domain::Score > auto Aleph::negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Table &  table,
Tracer &  tracer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for Negamax search with domain-provided key and tracing.

Definition at line 1304 of file Negamax.H.

References negamax_search().

◆ negamax_search() [6/6]

template<AdversarialGameDomain Domain, typename Tracer >
requires AdversarialSearchTracer<Tracer, typename Domain::Move, typename Domain::Score>
auto Aleph::negamax_search ( Domain  domain,
typename Domain::State  initial_state,
Tracer &  tracer,
ExplorationPolicy  policy = Negamax<Domain>::default_policy(),
SearchLimits  limits = {} 
)

Convenience wrapper for one-shot Negamax search with tracing.

Definition at line 1245 of file Negamax.H.

References negamax_search().

◆ network_to_dot_string()

template<class Net >
std::string Aleph::network_to_dot_string ( const Net &  net,
const DotExportOptions &  options = DotExportOptions() 
)

◆ network_to_json_string()

◆ next()

void Aleph::next ( )

Advance all underlying iterators (bounds-checked).

Definition at line 236 of file ah-zip.H.

Referenced by Aleph::DynSlist< T >::DynSlist(), Aleph::Johnson< GT, Distance, Ait, NAit, SA >::Johnson(), Aleph::MpscQueue< T >::~MpscQueue(), adjacent_find(), Aleph::CA::Sequential_Update< Order >::apply(), Aleph::CA::Random_Asynchronous_Update< Engine_Type >::apply(), Aleph::eulerian_detail::arcs_are_together(), Aleph::dry_detail::assign_fold(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::augment_matching(), Aleph::random_detail::bounded(), Aleph::random_detail::bounded_after_a_low_product(), Aleph::Aho_Corasick::build(), Aleph::Bounded_Cycle_Index< GT >::build(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_combinatorial_embedding_linear_lr(), build_cycle_graph(), build_level_graph(), Aleph::k_shortest_paths_detail::build_suffix_state(), capacity_scaling_maximum_flow(), Aleph::MonotonePolygonTriangulation::classify_vertex(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::compute_faces_from_rotation(), Aleph::Suffix_Automaton::contains(), Aleph::Aho_Corasick::contains_any(), Aleph::negative_cycles_detail::cyclic_core(), Aleph::Fibonacci_Heap< T, Compare >::delete_all_nodes(), delete_tree(), demo_practical(), RandomTreeTest::destroy_tree(), Aleph::tree_node_detail::detach_tree(), dinic_blocking_flow(), Aleph::Gen_Polynomial< Coefficient >::divide_by_monic_linear_mod(), Aleph::SpscQueue< T >::emplace_impl(), Aleph::DynSkipList< Key, Compare >::empty(), Aleph::howard_detail::Solver< Cost_Type >::evaluate(), Aleph::Suffix_Automaton::extend(), Aleph::Fenwick_Tree< T >::find_kth(), Aleph::Find_Path_Depth_First< GT, Itor, SA >::find_path(), Aleph::BinTreeXt_Operation< Node, Cmp >::find_position(), Aleph::Testing::LayeredNetworkGenerator< Net >::generate(), Aleph::SkipList< Key, Type >::Node::get_next(), Aleph::Find_Eulerian_Path< GT, SN, SA >::hierholzer_directed(), Aleph::Find_Eulerian_Path< GT, SN, SA >::hierholzer_undirected(), hlpp_maximum_flow(), hopcroft_karp_dfs(), Aleph::CuttingEarsTriangulation::init_ears(), Aleph::SkipList< Key, Type >::Iterator::is_last(), Aleph::MonotonePolygonTriangulation::is_y_monotone(), Aleph::Suffix_Automaton::longest_common_substring(), main(), Aleph::random_detail::masked(), Aleph::Stoer_Wagner_Min_Cut< GT, Distance, SA >::minimum_cut_phase(), next_combination_mask(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::next_target(), Aleph::cancellation_detail::Exact_State::notify_locked_observers(), Aleph::GiftWrappingConvexHull::operator()(), Aleph::CA::History_Rule< Depth, F >::operator()(), Aleph::CuttingEarsTriangulation::operator()(), Aleph::CA::Continuous_Rule< F, Kernel >::operator()(), Aleph::DynSlist< T >::operator=(), Aleph::Network_Simplex< Net >::pivot_tree(), planar_dual_metadata(), Aleph::FFT< Real >::polynomial_from_roots_complex(), Aleph::MpscQueue< T >::pop_node(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::remove_bucket(), Aleph::CA::ca_checkpoint_detail::restore_frame_from_bytes(), Aleph::net_detail::return_dust(), Aleph::Aho_Corasick::search(), Aleph::VisvalingamWhyattSimplification::simplify_open_array(), Aleph::VisvalingamWhyattSimplification::simplify_polygon(), skip_whitespace_and_comments(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::step(), Aleph::howard_detail::Arithmetic< Cost_Type, false >::step(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::Test_For_Path< GT, SA >::test_path(), TimeoutQueue::triggerEvent(), TYPED_TEST(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::verify_leaf_chain(), Aleph::df_tree_detail::Df_Low_Builder< GT, Node_Label, SA >::visit(), and Aleph::Johnson< GT, Distance, Ait, NAit, SA >::wide_arcs().

◆ next_combination_indices() [1/2]

bool Aleph::next_combination_indices ( Array< size_t > &  idx,
const size_t  n,
const bool  reset_on_last = true 
)
inline

Advance an index-combination [i0 < i1 < ... < i(k-1)] to the next one.

idx must contain valid strictly increasing indices in [0, n).

Parameters
[in,out]idxCurrent combination indices.
[in]nUniverse size.
[in]reset_on_lastWhether to reset to {0,1,...,k-1} at the end.
Returns
true if advanced; false if idx was already the last one.
Exceptions
ah_domain_errorif idx is not strictly increasing.
ah_out_of_range_errorif an index is outside [0, n).
Note
Complexity: O(k) per step.

Definition at line 878 of file ah-comb.H.

Referenced by lazy_combinations(), TEST(), TEST(), TEST(), and TEST().

◆ next_combination_indices() [2/2]

bool Aleph::next_combination_indices ( DynArray< size_t > &  idx,
const size_t  n,
const bool  reset_on_last = true 
)
inline

Overload of next_combination_indices for DynArray<size_t>.

Definition at line 885 of file ah-comb.H.

◆ next_combination_mask()

bool Aleph::next_combination_mask ( uint64_t &  mask,
const size_t  n,
const bool  reset_on_last = true 
)
inline

Advance a fixed-popcount bitmask to the next combination (Gosper hack).

The mask is interpreted over the low n bits.

Parameters
[in,out]maskCurrent mask.
[in]nNumber of active low bits (domain size).
[in]reset_on_lastWhether to reset to the first mask when done.
Returns
true if advanced; false if already last within n bits.
Exceptions
ah_out_of_range_errorif n > 64.
ah_domain_errorif mask has bits outside the low n bits.
Note
Complexity: O(1) arithmetic operations.

Definition at line 919 of file ah-comb.H.

References ah_domain_error_if, ah_out_of_range_error_if, first_combination_mask(), k, next(), and r.

Referenced by TEST(), and TEST().

◆ next_ne()

void Aleph::next_ne ( )
noexcept

Advance all underlying iterators (unchecked variant).

Requires has_curr().

Exceptions
whatnext_ne() of the underlying iterators throws; nothing with most of them. The inorder iterator of a binary tree (Aleph::BinNodeInfixIterator) throws std::bad_alloc if the tree is deeper than its inline capacity and the pending nodes cannot be moved to the heap.

Requires has_curr().

Exceptions
whatnext_ne() of the underlying iterators throws, as ZipIterator::next_ne() does.

Definition at line 252 of file ah-zip.H.

Referenced by Aleph::SkipList< Key, Type >::Iterator::next(), Aleph::SkipList< Key, Type >::Iterator::operator++(), Aleph::SkipList< Key, Type >::Iterator::operator++(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ next_permutation() [1/2]

template<typename T , class Compare = Aleph::less<T>>
bool Aleph::next_permutation ( Array< T > &  a,
Compare  cmp = Compare(),
const bool  reset_on_last = true 
)
inline

Compute the next lexicographic permutation of an Array.

This function follows the classical linear-time pivot/successor/suffix algorithm.

  • If a next permutation exists, it is written in-place and true is returned.
  • If the input is already the last permutation:
    • when reset_on_last == true, the array is reset to the first permutation and false is returned;
    • when reset_on_last == false, the array is left unchanged and false is returned.

Duplicate values are fully supported. Starting from a sorted array yields each distinct permutation exactly once.

Template Parameters
TElement type.
CompareStrict weak ordering comparator.
Parameters
[in,out]aSequence to transform.
[in]cmpOrdering relation.
[in]reset_on_lastWhether to reset to the first permutation.
Returns
true if advanced to a new permutation; false otherwise.
Note
Complexity: O(n) per step.

Definition at line 800 of file ah-comb.H.

References cmp().

Referenced by lazy_permutations(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ next_permutation() [2/2]

template<typename T , class Compare = Aleph::less<T>>
bool Aleph::next_permutation ( DynArray< T > &  a,
Compare  cmp = Compare(),
const bool  reset_on_last = true 
)
inline

Overload of next_permutation for DynArray.

Definition at line 808 of file ah-comb.H.

References cmp().

◆ next_power_of_2()

size_t Aleph::next_power_of_2 ( size_t  x)
inline

Return the smallest power of 2 that is not less than x.

Parameters
[in]xvalue to round up; 0 gives 1.
Returns
x if it is a power of 2, otherwise the next power of 2.
Exceptions
std::overflow_errorif x is greater than the largest power of 2 that a size_t can hold.

Definition at line 243 of file ahUtils.H.

References ah_overflow_error_if, and is_power_of_2().

Referenced by Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::Compact_Cuckoo_Filter(), Aleph::Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::Cuckoo_Filter(), and TEST().

◆ next_value()

double Aleph::next_value ( const double  val)
inline

Return the next representable floating-point value to val

Definition at line 445 of file ahUtils.H.

Referenced by TEST(), and TEST().

◆ nibble_to_char()

char Aleph::nibble_to_char ( const int  i)
inline

Convert a 4-bit nibble stored in an int to its hex character.

Valid values are 0..15; the result is in 0..9A..F.

Definition at line 126 of file ahUtils.H.

References and.

Referenced by hexadecimalize(), and TEST().

◆ no_equals() [1/2]

template<class T , class Compare >
bool Aleph::no_equals ( const T &  op1,
const T &  op2,
Compare &&  cmp = Compare() 
)
inline

Determines if operands are not equal using a comparison operator.

Parameters
op1First operand
op2Second operand
cmpComparison functor
Returns
true if op1 != op2 according to cmp

Definition at line 1102 of file ahFunction.H.

References cmp().

◆ no_equals() [2/2]

template<class T , class Compare >
bool Aleph::no_equals ( const T &  op1,
const T &  op2,
Compare &  cmp 
)
inline

See no_equals().

Definition at line 1112 of file ahFunction.H.

References cmp().

◆ node_height()

template<class Net >
static long & Aleph::node_height ( typename Net::Node *  p)
inlinestatic

Access the height label stored in NODE_COUNTER.

Definition at line 2371 of file tpl_net.H.

References NODE_COUNTER.

◆ none() [1/2]

template<class Container , class Operation >
bool Aleph::none ( const Container &  container,
Operation &&  operation = Operation() 
)
inline

Overload of none.

Definition at line 2196 of file ahFunctional.H.

◆ none() [2/2]

◆ none_of_tuple()

template<class Pred , class Tuple >
bool Aleph::none_of_tuple ( Pred &&  pred,
const Tuple &  t 
)

Return true if no tuple element satisfies pred.

This is the complement of any_of_tuple. Returns true if the predicate returns false for all elements in the tuple.

Template Parameters
PredPredicate type (must be callable with each tuple element type).
TupleTuple type to check.
Parameters
predPredicate to test on each element.
tTuple to check.
Returns
true if pred returns false for all elements.
Example:
auto t = std::make_tuple(1, 2, 3);
bool no_negatives = none_of_tuple([](auto x) { return x < 0; }, t);
// no_negatives is true (no element is negative)
bool none_of_tuple(Pred &&pred, const Tuple &t)
Return true if no tuple element satisfies pred.
Definition ah-zip.H:2042

Definition at line 2042 of file ah-zip.H.

References any_of_tuple(), and pred.

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ none_perm() [1/2]

template<typename T , class Pred >
bool Aleph::none_perm ( const DynList< DynList< T > > &  l,
Pred &&  pred 
)

Convenience overload accepting an rvalue callable.

Definition at line 703 of file ah-comb.H.

References l, none_perm(), and pred.

◆ none_perm() [2/2]

template<typename T , class Pred >
bool Aleph::none_perm ( const DynList< DynList< T > > &  l,
Pred &  pred 
)

Check if no permutation satisfies a predicate.

Equivalent to !exists_perm(l, pred).

Template Parameters
TElement type.
PredCallable with signature bool(const DynList<T>&).
Parameters
[in]lList of lists.
[in]predPredicate to test.
Returns
true if no permutation satisfies pred.

Definition at line 694 of file ah-comb.H.

References exists_perm(), l, and pred.

Referenced by demo_perm_predicates(), none_perm(), TEST(), TEST(), and TEST().

◆ not1()

template<class _Predicate >
unary_negate< _Predicate > Aleph::not1 ( const _Predicate &  __pred)
inline

Definition at line 411 of file ahFunction.H.

◆ not2()

template<class _Predicate >
binary_negate< _Predicate > Aleph::not2 ( const _Predicate &  __pred)
inline

Definition at line 441 of file ahFunction.H.

◆ nrange()

template<typename T = int, template< typename > class Container = DynList>
Container< T > Aleph::nrange ( const T  start,
const T  end,
const size_t  n 
)
inline

Generate exactly n values evenly spaced between [start, end].

Template Parameters
TNumeric type.
ContainerContainer type (defaults to DynList).
Parameters
startStart value.
endEnd value.
nNumber of values to generate.
Returns
Container with n values.
Exceptions
std::domain_errorif n < 1.

Definition at line 315 of file ahFunctional.H.

References ah_domain_error_if.

Referenced by demo_ranges(), TEST(), and TEST().

◆ oat_hash() [1/3]

size_t Aleph::oat_hash ( const char *  key)
inlinenoexcept

Definition at line 713 of file hash-fct.H.

References h.

◆ oat_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::oat_hash ( const Key &  key)
inlinenoexcept

Definition at line 586 of file hash-fct.H.

References oat_hash().

◆ oat_hash() [3/3]

size_t Aleph::oat_hash ( const std::string &  key)
inlinenoexcept

Definition at line 816 of file hash-fct.H.

References oat_hash().

◆ on_segment()

bool Aleph::on_segment ( const Segment &  s,
const Point &  p 
)
inline

◆ only_alpha()

std::string Aleph::only_alpha ( const std::string &  str)
inline

Extract alphanumeric ASCII characters and normalize letters to lower-case.

  • Keeps digits 0..9
  • Keeps letters a..z as-is
  • Converts letters A..Z to lower-case
  • Drops any other character
Parameters
[in]strInput std::string.
Returns
Normalized std::string.

Definition at line 381 of file ah-string-utils.H.

References and.

Referenced by demo_filtering(), and TEST().

◆ open_gap()

template<class Tarray >
void Aleph::open_gap ( Tarray &  ptr,
size_t  n,
size_t  pos = 0,
size_t  num_entries = 1 
)
inline

Open a gap in an array by shifting elements right.

Moves elements from [pos, n-num_entries) to [pos+num_entries, n), creating space for num_entries new elements at position pos.

Template Parameters
TarrayArray-like type with operator[]
Parameters
ptrArray to modify
nCurrent number of elements
posPosition where to open gap (default 0)
num_entriesNumber of positions to open (default 1)
Exceptions
std::out_of_rangeif pos >= n or num_entries > available space
Note
Uses move semantics for efficiency

Definition at line 96 of file array_utils.H.

References ah_out_of_range_error_if, and k.

Referenced by Aleph::DynArray< T >::insert(), Aleph::DynArray< T >::insert(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_at(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::insert_at(), main(), Aleph::MemArray< T >::open_gap(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ operator*() [1/6]

template<typename C , class M >
Gen_MultiPolynomial< C, M > Aleph::operator* ( const C &  s,
const Gen_MultiPolynomial< C, M > &  p 
)

Scalar * polynomial (commutative).

Parameters
[in]sScalar.
[in]pPolynomial.
Returns
Scaled polynomial.

Definition at line 4554 of file tpl_multi_polynomial.H.

◆ operator*() [2/6]

template<typename C >
Gen_Polynomial< C > Aleph::operator* ( const C &  s,
const Gen_Polynomial< C > &  p 
)

Scalar times polynomial (commutative form).

Definition at line 2900 of file tpl_polynomial.H.

◆ operator*() [3/6]

Point Aleph::operator* ( const Geom_Number &  s,
const Point &  p 
)
inline

Scalar multiplication with commutative order.

Definition at line 713 of file point.H.

◆ operator*() [4/6]

template<typename Trow , typename Tcol , typename NumType >
requires AlMultiplicativeNumber<NumType>
Matrix< Trow, Tcol, NumType > Aleph::operator* ( const NumType &  scalar,
const Matrix< Trow, Tcol, NumType > &  m 
)
inline

Scalar-matrix multiplication (scalar * matrix).

Definition at line 1228 of file al-matrix.H.

References m, and Aleph::Matrix< Trow, Tcol, NumType >::mult_by_scalar().

◆ operator*() [5/6]

template<typename T , typename NumType >
requires AlMultiplicativeNumber<NumType>
Vector< T, NumType > Aleph::operator* ( const NumType &  scalar,
const Vector< T, NumType > &  v 
)
inline

The vector v multiplied by scalar.

Definition at line 903 of file al-vector.H.

References Aleph::Vector< T, NumType >::product_by_scalar().

◆ operator*() [6/6]

template<typename Trow , typename Tcol , typename NumType >
requires AlAdditiveNumber<NumType>
and AlMultiplicativeNumber< NumType > Vector< Tcol, NumType > Aleph::operator* ( const Vector< Trow, NumType > &  vec,
const Matrix< Trow, Tcol, NumType > &  m 
)
inline

Vector-matrix multiplication (vector * matrix).

Definition at line 1239 of file al-matrix.H.

References m.

◆ operator+() [1/2]

template<typename C , class M >
Gen_MultiPolynomial< C, M > Aleph::operator+ ( const C &  s,
const Gen_MultiPolynomial< C, M > &  p 
)

Scalar + polynomial (commutative).

Parameters
[in]sScalar.
[in]pPolynomial.
Returns
Constant polynomial s plus p.

Definition at line 4565 of file tpl_multi_polynomial.H.

◆ operator+() [2/2]

template<typename C >
Gen_Polynomial< C > Aleph::operator+ ( const C &  s,
const Gen_Polynomial< C > &  p 
)

Scalar plus polynomial (commutative form).

Definition at line 2907 of file tpl_polynomial.H.

◆ operator-() [1/2]

template<typename C , class M >
Gen_MultiPolynomial< C, M > Aleph::operator- ( const C &  s,
const Gen_MultiPolynomial< C, M > &  p 
)

Scalar - polynomial.

Parameters
[in]sScalar minuend.
[in]pPolynomial subtrahend.
Returns
Constant polynomial s minus p.

Definition at line 4576 of file tpl_multi_polynomial.H.

References Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::num_vars().

◆ operator-() [2/2]

template<typename C >
Gen_Polynomial< C > Aleph::operator- ( const C &  s,
const Gen_Polynomial< C > &  p 
)

Scalar minus polynomial.

Definition at line 2914 of file tpl_polynomial.H.

◆ operator<<() [1/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Ellipse &  e 
)
inline

Definition at line 3731 of file point.H.

References Aleph::Ellipse::to_string().

◆ operator<<() [2/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Point &  p 
)
inline

Definition at line 3707 of file point.H.

References Aleph::Point::get_x(), and Aleph::Point::get_y().

◆ operator<<() [3/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Point3D &  p 
)
inline

◆ operator<<() [4/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Polygon &  p 
)
inline

Output stream operator for Polygon.

Parameters
oThe output stream.
pThe polygon to output.
Returns
A reference to the output stream.

Definition at line 1428 of file polygon.H.

References count(), Aleph::Dlink::Iterator::has_curr(), Aleph::Polygon::is_closed(), and Aleph::Polygon::size().

◆ operator<<() [5/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Rectangle &  r 
)
inline

Definition at line 3725 of file point.H.

References r.

◆ operator<<() [6/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Regular_Polygon &  p 
)
inline

Output stream operator for Regular_Polygon.

Parameters
oThe output stream.
pThe regular polygon to output.
Returns
A reference to the output stream.

Definition at line 1449 of file polygon.H.

References Aleph::Regular_Polygon::get_center(), Aleph::Regular_Polygon::radius(), and Aleph::Regular_Polygon::size().

◆ operator<<() [7/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const RotatedEllipse &  e 
)
inline

Definition at line 3737 of file point.H.

References Aleph::RotatedEllipse::to_string().

◆ operator<<() [8/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Segment &  s 
)
inline

Definition at line 3713 of file point.H.

References Aleph::Segment::get_src_point(), and Aleph::Segment::get_tgt_point().

◆ operator<<() [9/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Segment3D &  s 
)
inline

Definition at line 3749 of file point.H.

References Aleph::Segment3D::get_src(), and Aleph::Segment3D::get_tgt().

◆ operator<<() [10/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Tetrahedron &  t 
)
inline

◆ operator<<() [11/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Triangle &  t 
)
inline

◆ operator<<() [12/18]

std::ostream & Aleph::operator<< ( std::ostream &  o,
const Triangle3D &  t 
)
inline

◆ operator<<() [13/18]

template<class T >
std::ostream & Aleph::operator<< ( std::ostream &  osObject,
const Field< T > &  rightOp 
)

Definition at line 121 of file ahField.H.

References Aleph::Field< Dtype >::get_value().

◆ operator<<() [14/18]

template<typename C , class M >
std::ostream & Aleph::operator<< ( std::ostream &  out,
const Gen_MultiPolynomial< C, M > &  p 
)

Stream insertion.

Parameters
[out]outOutput stream.
[in]pPolynomial.
Returns
Reference to out.

Definition at line 4587 of file tpl_multi_polynomial.H.

References out, and Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::to_str().

◆ operator<<() [15/18]

template<typename C >
std::ostream & Aleph::operator<< ( std::ostream &  out,
const Gen_Polynomial< C > &  p 
)

Stream output.

Definition at line 2921 of file tpl_polynomial.H.

References out, and Aleph::Gen_Polynomial< Coefficient >::to_str().

◆ operator<<() [16/18]

template<typename T >
requires AlOrderedDomainKey<T>
and AlStreamable< T > std::ostream & Aleph::operator<< ( std::ostream &  s,
const AlDomain< T > &  dom 
)
inline

Output stream operator for AlDomain.

Template Parameters
TElement type
Parameters
sOutput stream
domDomain to output
Returns
Reference to output stream

Definition at line 289 of file al-domain.H.

References Aleph::AlDomain< T >::to_str().

◆ operator<<() [17/18]

template<typename Trow , typename Tcol , typename NumType >
requires AlOrderedDomainKey<Trow>
and AlOrderedDomainKey< Tcol > and AlStreamable< Trow > and AlStreamable< Tcol > and AlStreamable< NumType > std::ostream & Aleph::operator<< ( std::ostream &  s,
const Matrix< Trow, Tcol, NumType > &  m 
)
inline

Stream output operator for Matrix.

Definition at line 1254 of file al-matrix.H.

References m.

◆ operator<<() [18/18]

std::ostream & Aleph::operator<< ( std::ostream &  s,
const Vector< T, NumType > &  vec 
)
inline

Definition at line 915 of file al-vector.H.

References Aleph::Vector< T, NumType >::to_str().

◆ operator==()

template<typename T >
bool Aleph::operator== ( const DynList< T > &  l1,
const DynList< T > &  l2 
)
inline

Equality operator for DynList.

Definition at line 1243 of file ahFunctional.H.

References eq(), l1, and l2.

◆ optimal_merge_knuth()

Knuth_Optimization_Result< size_t > Aleph::optimal_merge_knuth ( const Array< size_t > &  weights)
inline

Optimal adjacent merge cost via Knuth optimization.

Given item weights, computes minimum total merge cost when only adjacent groups can be merged (optimal alphabetic merge / interval merge DP).

Parameters
[in]weightsAtomic interval weights.
Returns
Knuth_Optimization_Result<size_t> for the full interval [0, n).
Exceptions
ah_runtime_erroron prefix-sum overflow.

Definition at line 342 of file DP_Optimizations.H.

References ah_runtime_error_if, Aleph::Array< T >::create(), prefix(), and Aleph::Array< T >::size().

Referenced by TEST(), and TEST().

◆ orientation()

Orientation Aleph::orientation ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Return the orientation of the triple (a, b, c).

Based on the sign of the cross product (b-a)x(c-a).

Definition at line 2902 of file point.H.

References area_of_parallelogram(), CCW, COLLINEAR, and CW.

Referenced by Aleph::DelaunayTriangulationBowyerWatson::all_collinear(), Aleph::RegularTriangulationBowyerWatson::all_collinear(), Aleph::ConvexPolygonDecomposition::can_merge(), check_delaunay_for_non_constrained(), Aleph::MonotonePolygonTriangulation::classify_vertex(), Aleph::DelaunayTriangulationRandomizedIncremental::in_cc(), in_circle(), Aleph::ConvexPolygonIntersectionBasic::inside_half_plane(), Aleph::ConstrainedDelaunayTriangulation::is_convex_quad(), Aleph::ConstrainedDelaunayTriangulation::lawson_flip(), Aleph::ConvexPolygonIntersectionBasic::line_intersection(), Aleph::Polygon::locate_point(), Aleph::VoronoiDiagramFromDelaunay::operator()(), Aleph::DelaunayTriangulationRandomizedIncremental::operator()(), Aleph::GiftWrappingConvexHull::operator()(), Aleph::ConstrainedDelaunayTriangulation::operator()(), Aleph::ConvexPolygonDecomposition::operator()(), Aleph::HalfPlaneIntersection::HalfPlane::outside(), Aleph::DelaunayTriangulationBowyerWatson::point_in_circumcircle(), Aleph::RegularTriangulationBowyerWatson::point_in_power_circle(), Aleph::DelaunayTriangulationRandomizedIncremental::point_in_tri(), Aleph::ShortestPathInPolygon::point_in_triangle(), proper_intersection(), Aleph::ConvexPolygonIntersectionBasic::push_clean(), Aleph::HalfPlaneIntersection::push_clean(), scenario_orientation(), Aleph::detail::spp_point_in_triangle(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and Aleph::GeomBowyerWatsonUtils::triangulate().

◆ outer_product()

template<typename Trow , typename Tcol , typename NumType = double>
requires AlMultiplicativeNumber<NumType>
Matrix< Trow, Tcol, NumType > Aleph::outer_product ( const Vector< Trow, NumType > &  v1,
const Vector< Tcol, NumType > &  v2 
)
inline

Compute the outer product of two vectors.

Template Parameters
TrowRow domain type (from first vector)
TcolColumn domain type (from second vector)
NumTypeNumeric type
Parameters
v1First vector (becomes rows)
v2Second vector (becomes columns)
Returns
Matrix where entry (i,j) = v1[i] * v2[j]

Definition at line 1270 of file al-matrix.H.

References Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::Vector< T, NumType >::get_domain_ptr(), and Aleph::Matrix< Trow, Tcol, NumType >::set_entry().

Referenced by demo_outer_product(), and TEST().

◆ paint_arc()

template<AlephGraph GT>
static void Aleph::paint_arc ( typename GT::Arc *  a,
const long &  color 
)
inlinestatic

Set the arc color (stored in ARC_COUNTER).

Definition at line 1864 of file tpl_graph_utils.H.

References ARC_COUNTER, and color().

◆ paint_node()

template<AlephGraph GT>
static void Aleph::paint_node ( typename GT::Node *  p,
const long &  color 
)
inlinestatic

Set the node color (stored in NODE_COUNTER).

Definition at line 1857 of file tpl_graph_utils.H.

References color(), and NODE_COUNTER.

◆ pair_dft_hash_fct()

template<typename K1 , typename K2 >
requires requires(const K1 & k1, const K2 & k2) { dft_hash_fct(k1); dft_hash_fct(k2); }
size_t Aleph::pair_dft_hash_fct ( const std::pair< K1, K2 > &  p)
inlinenoexcept

Definition at line 1169 of file hash-fct.H.

References dft_hash_fct(), hash_combine(), and seed.

Referenced by fst_unit_pair_hash(), pair_dft_hash_ptr_fct(), TEST(), TEST(), and TEST().

◆ pair_dft_hash_ptr_fct()

template<typename K1 , typename K2 >
size_t Aleph::pair_dft_hash_ptr_fct ( const std::pair< K1, K2 > &  p)
inlinenoexcept
Note
Pair hash combiners are also compatibility-sensitive. Map*Hash adaptors hash only pair.first, while generic pair hashing folds both elements with hash_combine(). Do not change this behavior casually: it affects lookup compatibility and collision structure in existing tables.

Definition at line 1197 of file hash-fct.H.

References pair_dft_hash_fct().

◆ pair_ranks() [1/4]

template<typename T >
auto Aleph::pair_ranks ( const Array< T > &  c)

Computes (value, rank) pairs for each element in an Array.

Similar to ranks(), but returns pairs containing both the original value and its rank for convenience.

Template Parameters
TElement type
Parameters
cThe array to compute ranks for
Returns
An Array of pairs where result[i] = (c[i], rank of c[i])
Example
Array<int> arr = {30, 10, 20};
auto pr = pair_ranks(arr);
// pr[0] = {30, 2}
// pr[1] = {10, 0}
// pr[2] = {20, 1}
auto pair_ranks(const Array< T > &c)
Computes (value, rank) pairs for each element in an Array.
Definition ahSort.H:759
See also
ranks() for getting only the ranks

Definition at line 759 of file ahSort.H.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ pair_ranks() [2/4]

template<typename T >
auto Aleph::pair_ranks ( const DynArray< T > &  c)

Computes (value, rank) pairs for each element in a DynArray.

Similar to ranks(), but returns pairs containing both the original value and its rank for convenience.

Template Parameters
TElement type
Parameters
cThe array to compute ranks for
Returns
An Array of pairs where result[i] = (c[i], rank of c[i])
Example
Array<int> arr = {30, 10, 20};
auto pr = pair_ranks(arr);
// pr[0] = {30, 2}
// pr[1] = {10, 0}
// pr[2] = {20, 1}
See also
ranks() for getting only the ranks

Definition at line 768 of file ahSort.H.

◆ pair_ranks() [3/4]

template<typename T >
auto Aleph::pair_ranks ( const DynDlist< T > &  l)

Computes (value, rank) pairs for each element in a DynDlist.

Template Parameters
TElement type
Parameters
lThe list to compute ranks for
Returns
A DynArray of pairs

Definition at line 793 of file ahSort.H.

References l.

◆ pair_ranks() [4/4]

template<typename T >
auto Aleph::pair_ranks ( const DynList< T > &  l)

Computes (value, rank) pairs for each element in a DynList.

Template Parameters
TElement type
Parameters
lThe list to compute ranks for
Returns
A DynArray of pairs

Definition at line 780 of file ahSort.H.

References l.

◆ pair_snd_hash_fct()

template<typename K1 , typename K2 >
requires requires(const K1 & k1, const K2 & k2) { dft_hash_fct(k1); snd_hash_fct(k2); }
size_t Aleph::pair_snd_hash_fct ( const std::pair< K1, K2 > &  p)
inlinenoexcept

Definition at line 1182 of file hash-fct.H.

References dft_hash_fct(), hash_combine(), seed, and snd_hash_fct().

Referenced by pair_snd_hash_ptr_fct(), snd_unit_pair_hash(), TEST(), TEST(), and TEST().

◆ pair_snd_hash_ptr_fct()

template<typename K1 , typename K2 >
size_t Aleph::pair_snd_hash_ptr_fct ( const std::pair< K1, K2 > &  p)
inlinenoexcept

Definition at line 1203 of file hash-fct.H.

References pair_snd_hash_fct().

◆ pall() [1/2]

template<typename Container , typename Pred >
bool Aleph::pall ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 783 of file ah-parallel.H.

References pall().

◆ pall() [2/2]

template<typename Container , typename Pred >
bool Aleph::pall ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel all predicate (short-circuit).

Tests if all elements satisfy a predicate. Stops early if any chunk finds a non-satisfying element.

Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
true if all elements satisfy pred, false otherwise.

Example

std::vector<int> nums = {2, 4, 6, 8, 10};
bool all_even = pall(pool, nums, [](int x) { return x % 2 == 0; });
// all_even = true
bool pall(ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
Parallel all predicate (short-circuit).

Definition at line 773 of file ah-parallel.H.

References options, pall(), Aleph::ParallelOptions::pool, and pred.

Referenced by example_parallel_predicates(), pall(), pall(), TEST_F(), TEST_F(), and TEST_F().

◆ parallel_default_pool()

ThreadPool & Aleph::parallel_default_pool ( )
inline

Global default pool for parallel operations.

Uses the default ThreadPool for operations when no pool is specified.

Returns
Reference to the default pool.

Definition at line 3486 of file ah-parallel.H.

References default_pool(), and parallel_default_pool().

Referenced by parallel_default_pool().

◆ parallel_for() [1/2]

template<typename Iterator , typename F >
void Aleph::parallel_for ( Iterator  begin,
Iterator  end,
F &&  f,
const ParallelOptions &  options = {} 
)

Execute a function in parallel over a range with explicit options.

Definition at line 1725 of file thread_pool.H.

◆ parallel_for() [2/2]

template<typename Iterator , typename F >
void Aleph::parallel_for ( ThreadPool &  pool,
Iterator  begin,
Iterator  end,
F &&  f,
size_t  chunk_size = 0 
)

Execute a function in parallel over a range.

Divides the range [begin, end) into chunks and executes the function on each chunk in parallel using the thread pool.

Template Parameters
IteratorRandom access iterator type.
FFunction type: void(Iterator begin, Iterator end) or void(T&).
Parameters
poolThread pool to use.
beginStart of range.
endEnd of range.
fFunction to apply. Can be:
  • void(Iterator, Iterator) - receives chunk bounds
  • void(T&) - receives each element by reference
chunk_sizeNumber of elements per chunk (0 = auto-calculate).

Example

std::vector<int> data(10000);
// Per-element function
parallel_for(pool, data.begin(), data.end(), [](int& x) { x *= 2; });
// Chunk function
parallel_for(pool, data.begin(), data.end(),
[](auto begin, auto end) {
for (auto it = begin; it != end; ++it) *it *= 2;
});
void parallel_for(ThreadPool &pool, Iterator begin, Iterator end, F &&f, size_t chunk_size=0)
Execute a function in parallel over a range.

Definition at line 1714 of file thread_pool.H.

References options, parallel_for(), and Aleph::ParallelOptions::pool.

Referenced by parallel_for(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ parallel_for_index() [1/2]

template<typename F >
void Aleph::parallel_for_index ( size_t  start,
size_t  end,
F &&  f,
const ParallelOptions &  options = {} 
)

Parallel index loop with explicit options.

Definition at line 2047 of file thread_pool.H.

References parallel_for_index().

◆ parallel_for_index() [2/2]

template<typename F >
void Aleph::parallel_for_index ( ThreadPool &  pool,
size_t  start,
size_t  end,
F &&  f,
size_t  chunk_size = 0 
)

Apply a function to each element in parallel (index-based).

Convenience function for parallel loops with index access.

Parameters
poolThread pool to use.
startStart index (inclusive).
endEnd index (exclusive).
fFunction: void(size_t index).
chunk_sizeIterations per chunk (0 = auto).

Example

std::vector<int> data(1000);
parallel_for_index(pool, 0, data.size(), [&data](size_t i) {
data[i] = expensive_compute(i);
});
void parallel_for_index(ThreadPool &pool, size_t start, size_t end, F &&f, size_t chunk_size=0)
Apply a function to each element in parallel (index-based).

Definition at line 2036 of file thread_pool.H.

References options, parallel_for_index(), and Aleph::ParallelOptions::pool.

Referenced by Aleph::FFT< Real >::Plan::apply_bluestein_transform(), Aleph::FFT< Real >::Plan::apply_butterflies(), Aleph::NTT< MOD, ROOT >::Plan::for_each_index(), Aleph::FFT< Real >::inverse_transform_real_optimized_impl(), Aleph::FFT< Real >::multiply_complex_impl(), Aleph::FFT< Real >::multiply_real_optimized(), parallel_for_index(), parallel_for_index(), Aleph::FFT< Real >::pbatched_sosfilt(), Aleph::FFT< Real >::pbatched_stft(), Aleph::FFT< Real >::LFilterBank::pfilter(), Aleph::FFT< Real >::SOSFilterBank::pfilter(), Aleph::FFT< Real >::BatchedSTFTProcessor::pflush(), Aleph::FFT< Real >::BatchedISTFTProcessor::pflush(), Aleph::FFT< Real >::OverlapAddBank::pflush(), Aleph::FFT< Real >::Plan::pinverse_transform_real_batch(), Aleph::FFT< Real >::OverlapAdd::pointwise_multiply(), Aleph::FFT< Real >::OverlapAddBank::pointwise_multiply_batch(), Aleph::FFT< Real >::BatchedISTFTProcessor::pprocess_block(), Aleph::FFT< Real >::BatchedSTFTProcessor::pprocess_block(), Aleph::FFT< Real >::Plan::ptransform_batch(), Aleph::NTT< MOD, ROOT >::Plan::ptransform_batch(), Aleph::NTTExact::reconstruct_product(), TEST_F(), TEST_F(), TEST_F(), Aleph::FFT< Real >::transform_axis_impl(), Aleph::FFT< Real >::transform_impl(), Aleph::FFT< Real >::transform_real_optimized(), and Aleph::FFT< Real >::transform_stft_frames().

◆ parallel_invoke() [1/2]

template<typename... Fs>
void Aleph::parallel_invoke ( const ParallelOptions &  options,
Fs &&...  fs 
)

parallel_invoke with explicit options.

Definition at line 2112 of file thread_pool.H.

References Aleph::ThreadPool::enqueue(), options, and parallel_invoke().

◆ parallel_invoke() [2/2]

template<typename... Fs>
void Aleph::parallel_invoke ( ThreadPool &  pool,
Fs &&...  fs 
)

Invoke a small set of related callables in parallel.

This is a low-level building block for divide-and-conquer and orchestration code. All callables are launched, then the function waits for completion and rethrows the first exception observed.

Definition at line 2103 of file thread_pool.H.

References options, parallel_invoke(), and Aleph::ParallelOptions::pool.

Referenced by example_parallel_building_blocks(), parallel_invoke(), parallel_invoke(), TEST_F(), TEST_F(), and TEST_F().

◆ parallel_reduce() [1/2]

template<typename Iterator , typename T , typename BinaryOp >
T Aleph::parallel_reduce ( Iterator  first,
Iterator  last,
T  init,
BinaryOp  op,
const ParallelOptions &  options = {} 
)

Parallel reduce with explicit options.

Definition at line 1958 of file thread_pool.H.

References parallel_reduce().

◆ parallel_reduce() [2/2]

template<typename Iterator , typename T , typename BinaryOp >
T Aleph::parallel_reduce ( ThreadPool &  pool,
Iterator  first,
Iterator  last,
T  init,
BinaryOp  op,
size_t  chunk_size = 0 
)

Reduce elements in parallel.

Computes a reduction (like std::reduce) but parallelized. The binary operation must be associative and commutative.

Template Parameters
IteratorIterator type.
TValue type for result.
BinaryOpBinary operation type.
Parameters
poolThread pool to use.
firstStart of range.
lastEnd of range.
initInitial value.
opBinary operation (must be associative & commutative).
chunk_sizeElements per chunk (0 = auto).
Returns
Reduction result.

Example

std::vector<int> data = {1, 2, 3, 4, 5};
// Sum
int sum = parallel_reduce(pool, data.begin(), data.end(), 0,
std::plus<int>());
// sum = 15
// Product
int prod = parallel_reduce(pool, data.begin(), data.end(), 1,
std::multiplies<int>());
// prod = 120
T parallel_reduce(ThreadPool &pool, Iterator first, Iterator last, T init, BinaryOp op, size_t chunk_size=0)
Reduce elements in parallel.

Definition at line 1947 of file thread_pool.H.

References options, parallel_reduce(), and Aleph::ParallelOptions::pool.

Referenced by parallel_reduce(), parallel_reduce(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ parallel_transform() [1/2]

template<typename InputIt , typename OutputIt , typename F >
OutputIt Aleph::parallel_transform ( InputIt  first,
InputIt  last,
OutputIt  d_first,
F &&  f,
const ParallelOptions &  options = {} 
)

Parallel transform with explicit options.

Definition at line 1847 of file thread_pool.H.

References parallel_transform().

◆ parallel_transform() [2/2]

template<typename InputIt , typename OutputIt , typename F >
OutputIt Aleph::parallel_transform ( ThreadPool &  pool,
InputIt  first,
InputIt  last,
OutputIt  d_first,
F &&  f,
size_t  chunk_size = 0 
)

Transform elements in parallel and store results.

Applies a transformation function to each element and stores the result. Similar to std::transform but parallelized.

Template Parameters
InputItInput iterator type.
OutputItOutput iterator type.
FTransformation function type.
Parameters
poolThread pool to use.
firstStart of input range.
lastEnd of input range.
d_firstStart of output range.
fTransformation function.
chunk_sizeElements per chunk (0 = auto).
Returns
Iterator to end of output range.

Example

std::vector<int> input = {1, 2, 3, 4, 5};
std::vector<int> output(5);
parallel_transform(pool, input.begin(), input.end(), output.begin(),
[](int x) { return x * x; });
// output = {1, 4, 9, 16, 25}
OutputIt parallel_transform(ThreadPool &pool, InputIt first, InputIt last, OutputIt d_first, F &&f, size_t chunk_size=0)
Transform elements in parallel and store results.
ofstream output
Definition writeHeap.C:215

Definition at line 1836 of file thread_pool.H.

References options, parallel_transform(), and Aleph::ParallelOptions::pool.

Referenced by parallel_transform(), parallel_transform(), TEST_F(), TEST_F(), and TEST_F().

◆ partial_sum() [1/2]

template<class Itor1 , class Itor2 >
Itor2 Aleph::partial_sum ( Itor1  sourceBeg,
Itor1  sourceEnd,
Itor2  destBeg 
)
inline

Compute partial sums of a range.

Computes cumulative sums of elements in [sourceBeg, sourceEnd) and writes them to the range starting at destBeg.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
Returns
Iterator past the last computed element in destination.

Definition at line 1596 of file ahAlgo.H.

References sum().

Referenced by TEST(), TEST(), and TEST().

◆ partial_sum() [2/2]

template<class Itor1 , class Itor2 , class BinaryFunc >
Itor2 Aleph::partial_sum ( Itor1  sourceBeg,
Itor1  sourceEnd,
Itor2  destBeg,
BinaryFunc  op 
)
inline

Compute partial sums with custom operation.

Computes cumulative sums using the binary operation op.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
BinaryFuncBinary operation type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
opBinary operation for combining values.
Returns
Iterator past the last computed element in destination.

Definition at line 1631 of file ahAlgo.H.

References sum().

◆ partition() [1/3]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::partition ( C< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Partition a container using the last element as pivot.

Template Parameters
CContainer template (must support random access).
Parameters
aThe container.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the pivot in its final position.

Definition at line 3857 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ partition() [2/3]

template<class SrcContainer , template< typename > class TgtContainer = Aleph::DynList>
std::pair< TgtContainer< typename SrcContainer::Item_Type >, TgtContainer< typename SrcContainer::Item_Type > > Aleph::partition ( const SrcContainer &  c,
std::function< bool(const typename SrcContainer::Item_Type &)>  operation 
)
inline

Partition a container into two based on a predicate.

Parameters
cSource container.
operationPredicate (true goes to first list, false to second).
Returns
Pair of containers.

Definition at line 1461 of file ahFunctional.H.

References for_each(), and Type.

Referenced by Aleph::FFT< Real >::PartitionedConvolver::PartitionedConvolver(), demo_grouping(), introsort_loop(), print_partition(), quicksort(), quicksort_rec(), random_search(), TEST(), and TEST_F().

◆ partition() [3/3]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::partition ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inlinenoexcept

Partition an array range [l, r] around a pivot.

Rearranges elements such that all elements less than the pivot are on the left, and elements greater or equal are on the right.

Time complexity: O(n). Space complexity: O(1).

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]aPointer to the array.
[in]lLeft index.
[in]rRight index.
[in]cmpComparison functor.
Returns
The final index of the pivot.

Move the pivot to the end so the sweep below only handles [l, r-1].

At this point there is an inversion a[i] > pivot > a[j].

Place the pivot in its final sorted position.

Definition at line 1635 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ partition_op() [1/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::partition_op ( Array< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Partition an Array using operator().

Parameters
aThe array.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the pivot in its final position.

Definition at line 3163 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ partition_op() [2/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::partition_op ( DynArray< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Partition a DynArray using operator().

Parameters
aThe dynamic array.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the pivot in its final position.

Definition at line 3150 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ partition_op_impl()

template<typename T , class Compare , typename Container >
long Aleph::partition_op_impl ( Container &  a,
const long  l,
const long  r,
const Compare &  cmp 
)
inline

Implementation of partitioning using operator().

Template Parameters
ContainerContainer type.
Parameters
aThe container.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the pivot in its final position.

Restore the pivot to its final sorted position at index i.

Definition at line 3109 of file tpl_sort_utils.H.

References cmp(), l, Aleph::sort_utils_detail::median_of_three_to_last(), and r.

◆ partition_three_way()

template<typename T , class Compare >
static std::pair< long, long > Aleph::partition_three_way ( T *  a,
long  l,
long  r,
const Compare &  cmp 
)
inlinestatic

Move the pivot to the end so the sweep below only handles [l, r-1].

Restore the pivot (parked at r) to its final sorted position.

Definition at line 2914 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ partition_three_way_op()

template<class Container , typename T , class Compare >
static std::pair< long, long > Aleph::partition_three_way_op ( Container &  a,
long  l,
long  r,
const Compare &  cmp 
)
inlinestatic

Move the pivot to the end so the sweep below only handles [l, r-1].

Restore the pivot (parked at r) to its final sorted position.

Definition at line 2945 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ pcount_if() [1/2]

template<typename Container , typename Pred >
size_t Aleph::pcount_if ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 1010 of file ah-parallel.H.

References pcount_if().

◆ pcount_if() [2/2]

template<typename Container , typename Pred >
size_t Aleph::pcount_if ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel count_if operation.

Counts elements satisfying a predicate using multiple threads.

Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
Number of elements satisfying pred.

Example

std::vector<int> nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
size_t evens = pcount_if(pool, nums, [](int x) { return x % 2 == 0; });
// evens = 5
size_t pcount_if(ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
Parallel count_if operation.

Definition at line 1000 of file ah-parallel.H.

References options, pcount_if(), Aleph::ParallelOptions::pool, and pred.

Referenced by example_parallel_predicates(), pcount_if(), pcount_if(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ peek_char()

int Aleph::peek_char ( std::ifstream &  input_stream)
inline

Peek at the next character without consuming it.

Returns the next character in the stream without advancing the stream position. Useful for lookahead decisions.

Parameters
input_streamThe input file stream
Returns
The next character, or EOF if at end of file
Example
if (peek_char(input) == '(') {
// Handle parenthesized expression
}
int peek_char(std::ifstream &input_stream)
Peek at the next character without consuming it.

Definition at line 744 of file parse_utils.H.

References peek_char().

Referenced by peek_char(), skip_whitespace_and_comments(), and TEST_F().

◆ penumerate_for_each() [1/4]

template<typename Container , typename Op >
void Aleph::penumerate_for_each ( const Container &  c,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 3319 of file ah-parallel.H.

References penumerate_for_each().

◆ penumerate_for_each() [2/4]

template<typename Container , typename Op >
void Aleph::penumerate_for_each ( Container &  c,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 3246 of file ah-parallel.H.

References penumerate_for_each().

◆ penumerate_for_each() [3/4]

template<typename Container , typename Op >
void Aleph::penumerate_for_each ( ThreadPool &  pool,
const Container &  c,
Op  op,
size_t  chunk_size = 0 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Parallel enumerate_for_each for const containers.

Template Parameters
ContainerContainer type.
OpOperation type: void(size_t index, const T&).
Parameters
poolThread pool to use.
cContainer.
opFunction: void(size_t index, const T& element).
chunk_sizeElements per chunk (0 = auto).
See also
penumerate_for_each(ThreadPool&, Container&, Op, size_t) For the non-const version.

Definition at line 3309 of file ah-parallel.H.

References options, penumerate_for_each(), and Aleph::ParallelOptions::pool.

◆ penumerate_for_each() [4/4]

template<typename Container , typename Op >
void Aleph::penumerate_for_each ( ThreadPool &  pool,
Container &  c,
Op  op,
size_t  chunk_size = 0 
)

Parallel for_each with index (enumerate).

Applies a function to each element along with its index, in parallel.

Template Parameters
ContainerContainer type.
OpOperation type: void(size_t index, const T&) or void(size_t, T&).
Parameters
poolThread pool to use.
cContainer.
opFunction: void(size_t index, const T& element).
chunk_sizeElements per chunk (0 = auto).

Example

std::vector<int> data(1000);
penumerate_for_each(pool, data, [](size_t i, int& x) {
x = static_cast<int>(i * 2);
});
// data[i] = i * 2
void penumerate_for_each(ThreadPool &pool, Container &c, Op op, size_t chunk_size=0)
Parallel for_each with index (enumerate).

Definition at line 3236 of file ah-parallel.H.

References options, penumerate_for_each(), and Aleph::ParallelOptions::pool.

Referenced by example_parallel_enumerate(), penumerate_for_each(), penumerate_for_each(), penumerate_for_each(), penumerate_for_each(), TEST_F(), TEST_F(), and TEST_F().

◆ penumerate_maps() [1/2]

template<typename Container , typename Op >
auto Aleph::penumerate_maps ( const Container &  c,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 3411 of file ah-parallel.H.

References penumerate_maps().

◆ penumerate_maps() [2/2]

template<typename Container , typename Op >
auto Aleph::penumerate_maps ( ThreadPool &  pool,
const Container &  c,
Op  op,
size_t  chunk_size = 0 
)

Parallel enumerate with map.

Maps each element along with its index to a result.

Template Parameters
ContainerContainer type.
OpOperation type: R(size_t index, const T&).
Parameters
poolThread pool to use.
cContainer.
opFunction: R(size_t index, const T& element).
chunk_sizeElements per chunk (0 = auto).
Returns
std::vector<R> with results.

Example

std::vector<std::string> words = {"hello", "world"};
auto indexed = penumerate_maps(pool, words,
[](size_t i, const std::string& s) {
return std::to_string(i) + ": " + s;
});
// indexed = {"0: hello", "1: world"}
auto penumerate_maps(ThreadPool &pool, const Container &c, Op op, size_t chunk_size=0)
Parallel enumerate with map.

Definition at line 3401 of file ah-parallel.H.

References options, penumerate_maps(), and Aleph::ParallelOptions::pool.

Referenced by example_parallel_enumerate(), penumerate_maps(), penumerate_maps(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ percentile()

template<typename Container >
auto Aleph::percentile ( const Container &  data,
double  p 
) -> std::decay_t<decltype(*std::begin(data))>

Compute a percentile value.

Uses linear interpolation between data points.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container (will be copied and sorted)
pPercentile (0-100)
Returns
Percentile value
Exceptions
std::invalid_argumentif container is empty or p is out of range

Definition at line 352 of file stat_utils.H.

References ah_invalid_argument_if, Aleph::Array< T >::append(), in_place_sort(), Aleph::Array< T >::is_empty(), percentile(), and Aleph::Array< T >::size().

Referenced by compute_all_stats(), iqr(), median(), percentile(), quartiles(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ perm_count()

template<typename T >
size_t Aleph::perm_count ( const DynList< DynList< T > > &  l)

Count the total number of permutations from a list of lists.

The result is the product of all list sizes. If the input is empty, returns 1 (there is exactly one empty permutation).

Template Parameters
TElement type.
Parameters
[in]lList of lists.
Returns
Total permutation count.

Definition at line 601 of file ah-comb.H.

References count(), LocateFunctions< Container, Type >::get_it(), and l.

Referenced by demo_permutations(), demo_practical(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ pexclusive_scan() [1/4]

template<typename Container , typename T , typename BinaryOp >
auto Aleph::pexclusive_scan ( const Container &  c,
T  init,
BinaryOp  op,
const ParallelOptions &  options = {} 
)

Parallel exclusive scan over a container with explicit options.

Overload that accepts a fully specified ParallelOptions instead of a bare ThreadPool.

Parameters
cInput container. Must be non-mutating during the call.
initInitial value (identity for op); sets accumulator type.
opAssociative binary operation.
optionsParallel execution options (pool, chunk_size, cancel token…).
Returns
std::vector<T> of exclusive prefix values.
Exceptions
Anyexception propagated from Aleph::pexclusive_scan, from op, or from element move/copy construction into the result vector.
Aleph::operation_canceledif the token inside the options is canceled before or during execution.
Note
Complexity: Total work O(n), parallelized across the threads in the pool and chunks.
Thread Safety: Does not modify c. Safe to call concurrently on different containers. The pool in options must be a properly synchronized shared ThreadPool if shared.

Definition at line 2298 of file ah-parallel.H.

References pexclusive_scan().

◆ pexclusive_scan() [2/4]

template<typename InputIt , typename OutputIt , typename T , typename BinaryOp >
OutputIt Aleph::pexclusive_scan ( InputIt  first,
InputIt  last,
OutputIt  d_first,
T  init,
BinaryOp  op,
const ParallelOptions &  options = {} 
)

Exclusive prefix scan with explicit options.

Definition at line 2341 of file thread_pool.H.

References pexclusive_scan().

◆ pexclusive_scan() [3/4]

template<typename Container , typename T , typename BinaryOp >
auto Aleph::pexclusive_scan ( ThreadPool &  pool,
const Container &  c,
T  init,
BinaryOp  op,
size_t  chunk_size = 0 
)

Parallel exclusive scan over a container.

Computes an exclusive prefix scan of c starting from init and returns the result as a std::vector<T>. Element result[0] is init; element result[i] (i > 0) equals op(init, op(...op(c[0], c[1])..., c[i-1])).

Parameters
poolThread pool to use for parallel execution.
cInput container. Must be non-mutating during the call.
initInitial value (identity for op). Also determines the accumulator/result type T.
opAssociative binary operation.
chunk_sizeOptional override for the number of elements per chunk; 0 (default) lets the implementation choose. When set it overrides ParallelOptions::chunk_size.
Returns
std::vector<T> of exclusive prefix values. Empty if c is empty.
Exceptions
Anyexception propagated from Aleph::pexclusive_scan, from op, or from element move/copy construction into the result vector.
Aleph::operation_canceledif the token inside the derived ParallelOptions is canceled before or during execution.
Note
Complexity: Total work O(n), parallelized across pool threads and chunks.
Thread Safety: Does not modify c. Safe to call concurrently on different containers. pool must be a properly synchronized shared ThreadPool if shared.

Definition at line 2268 of file ah-parallel.H.

References options, pexclusive_scan(), and Aleph::ParallelOptions::pool.

Referenced by example_parallel_building_blocks(), example_parallel_scan_merge_partition(), pexclusive_scan(), pexclusive_scan(), pexclusive_scan(), pexclusive_scan(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pexclusive_scan() [4/4]

template<typename InputIt , typename OutputIt , typename T , typename BinaryOp >
OutputIt Aleph::pexclusive_scan ( ThreadPool &  pool,
InputIt  first,
InputIt  last,
OutputIt  d_first,
T  init,
BinaryOp  op,
size_t  chunk_size = 0 
)

Exclusive prefix scan over a range.

Computes prefixes such that out[0] = init and out[i] = op(init, x0, ..., x{i-1}) for i > 0.

Definition at line 2329 of file thread_pool.H.

References options, pexclusive_scan(), and Aleph::ParallelOptions::pool.

◆ pexists() [1/2]

template<typename Container , typename Pred >
bool Aleph::pexists ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 881 of file ah-parallel.H.

References pexists().

◆ pexists() [2/2]

template<typename Container , typename Pred >
bool Aleph::pexists ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel exists predicate (short-circuit).

Tests if any element satisfies a predicate. Stops early when found.

Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
true if any element satisfies pred, false otherwise.

Example

std::vector<int> nums = {1, 2, 3, 4, 5};
bool has_three = pexists(pool, nums, [](int x) { return x == 3; });
// has_three = true
bool pexists(ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
Parallel exists predicate (short-circuit).

Definition at line 871 of file ah-parallel.H.

References options, pexists(), Aleph::ParallelOptions::pool, and pred.

Referenced by example_parallel_predicates(), pexists(), pexists(), pnone(), TEST_F(), TEST_F(), and TEST_F().

◆ pfilter() [1/2]

template<typename Container , typename Pred >
auto Aleph::pfilter ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 397 of file ah-parallel.H.

References pfilter().

◆ pfilter() [2/2]

template<typename Container , typename Pred >
auto Aleph::pfilter ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel filter operation.

Filters elements that satisfy a predicate, processing in parallel. The relative order of elements is preserved.

Template Parameters
ContainerInput container type.
PredPredicate type.
Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
std::vector with elements satisfying the predicate.

Example

std::vector<int> nums = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
auto evens = pfilter(pool, nums, [](int x) { return x % 2 == 0; });
// evens = {2, 4, 6, 8, 10}
auto pfilter(ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
Parallel filter operation.
Note
Order is preserved by processing chunks sequentially at the merge stage.

Definition at line 387 of file ah-parallel.H.

References options, pfilter(), Aleph::ParallelOptions::pool, and pred.

Referenced by example_parallel_filter(), pfilter(), pfilter(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pfind() [1/2]

template<typename Container , typename Pred >
std::optional< size_t > Aleph::pfind ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 1110 of file ah-parallel.H.

References pfind().

◆ pfind() [2/2]

template<typename Container , typename Pred >
std::optional< size_t > Aleph::pfind ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel find operation (returns index).

Searches for an element satisfying a predicate in parallel. Returns the index of the first match (by position in container).

Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
Index of first element satisfying pred, or std::nullopt if not found.
Note
"First" refers to the element with the smallest index, not necessarily the first one found by any thread.

Example

std::vector<int> nums = {1, 2, 3, 4, 5};
auto idx = pfind(pool, nums, [](int x) { return x > 3; });
// idx = 3 (value 4)
std::optional< size_t > pfind(ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
Parallel find operation (returns index).

Definition at line 1100 of file ah-parallel.H.

References options, pfind(), Aleph::ParallelOptions::pool, and pred.

Referenced by example_parallel_find(), pfind(), pfind(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pfind_value() [1/2]

template<typename Container , typename Pred >
auto Aleph::pfind_value ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 1222 of file ah-parallel.H.

References pfind_value().

◆ pfind_value() [2/2]

template<typename Container , typename Pred >
auto Aleph::pfind_value ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel find with value return.

Like pfind, but returns an optional containing the found value.

Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
Optional with first matching element, or nullopt if not found.

Example

std::vector<std::string> words = {"apple", "banana", "cherry"};
auto found = pfind_value(pool, words, [](const auto& s) {
return s.length() > 5;
});
// found = "banana"
auto pfind_value(ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
Parallel find with value return.

Definition at line 1212 of file ah-parallel.H.

References options, pfind_value(), Aleph::ParallelOptions::pool, and pred.

Referenced by example_parallel_find(), pfind_value(), pfind_value(), and TEST_F().

◆ pfoldl() [1/2]

template<typename T , typename Container , typename BinaryOp >
T Aleph::pfoldl ( const Container &  c,
T  init,
BinaryOp  op,
const ParallelOptions &  options = {} 
)

Definition at line 518 of file ah-parallel.H.

References pfoldl().

◆ pfoldl() [2/2]

template<typename T , typename Container , typename BinaryOp >
T Aleph::pfoldl ( ThreadPool &  pool,
const Container &  c,
T  init,
BinaryOp  op,
size_t  chunk_size = 0 
)

Parallel left fold (reduce).

Computes a reduction over the container using multiple threads. The binary operation must be associative for correct results.

Template Parameters
TAccumulator type.
ContainerContainer type.
BinaryOpBinary operation type.
Parameters
poolThread pool to use.
cSource container.
initInitial accumulator value.
opBinary operation: T op(T acc, const ElemT&).
chunk_sizeElements per chunk (0 = auto).
Returns
Reduced value.
Warning
The operation must be associative: op(op(a,b),c) == op(a,op(b,c)). Non-associative operations will produce incorrect results.

Example

std::vector<int> nums = {1, 2, 3, 4, 5};
// Sum
int sum = pfoldl(pool, nums, 0, std::plus<int>());
// sum = 15
// String concatenation (associative)
std::vector<std::string> words = {"Hello", " ", "World"};
auto msg = pfoldl(pool, words, std::string{}, std::plus<std::string>());
// msg = "Hello World"
T pfoldl(ThreadPool &pool, const Container &c, T init, BinaryOp op, size_t chunk_size=0)
Parallel left fold (reduce).

Definition at line 508 of file ah-parallel.H.

References options, pfoldl(), and Aleph::ParallelOptions::pool.

Referenced by example_parallel_fold(), pfoldl(), pfoldl(), pproduct(), psum(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pfor_each() [1/4]

template<typename Container , typename Op >
void Aleph::pfor_each ( const Container &  c,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 694 of file ah-parallel.H.

References pfor_each().

◆ pfor_each() [2/4]

template<typename Container , typename Op >
void Aleph::pfor_each ( Container &  c,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 623 of file ah-parallel.H.

References pfor_each().

◆ pfor_each() [3/4]

template<typename Container , typename Op >
void Aleph::pfor_each ( ThreadPool &  pool,
const Container &  c,
Op  op,
size_t  chunk_size = 0 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Parallel for_each for const containers.

Template Parameters
ContainerContainer type.
OpOperation type.
Parameters
poolThread pool to use.
cContainer (elements accessed by const reference).
opFunction to apply: void op(const T&).
chunk_sizeElements per chunk (0 = auto).
See also
pfor_each(ThreadPool&, Container&, Op, size_t) For the non-const version.

Definition at line 685 of file ah-parallel.H.

References options, pfor_each(), and Aleph::ParallelOptions::pool.

◆ pfor_each() [4/4]

template<typename Container , typename Op >
void Aleph::pfor_each ( ThreadPool &  pool,
Container &  c,
Op  op,
size_t  chunk_size = 0 
)

Parallel for_each operation.

Applies a function to each element in parallel. Use this for side effects; for transformations, prefer pmaps.

Template Parameters
ContainerContainer type.
OpOperation type.
Parameters
poolThread pool to use.
cContainer (elements accessed by non-const reference).
opFunction to apply: void op(T&) or void op(const T&).
chunk_sizeElements per chunk (0 = auto).

Example

std::vector<int> nums(1000000);
// Initialize in parallel
pfor_each(pool, nums, [](int& x) { x = 42; });
// With index (using capturing)
std::atomic<int> count{0};
pfor_each(pool, nums, [&count](const int& x) {
if (x > 0) ++count;
});
void pfor_each(ThreadPool &pool, Container &c, Op op, size_t chunk_size=0)
Parallel for_each operation.

Definition at line 614 of file ah-parallel.H.

References options, pfor_each(), and Aleph::ParallelOptions::pool.

Referenced by pfor_each(), pfor_each(), pfor_each(), pfor_each(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pitag()

Geom_Number Aleph::pitag ( const Geom_Number &  x,
const Geom_Number &  y 
)
inline
Deprecated:
Use euclidean_distance() instead.

Definition at line 167 of file point.H.

References euclidean_distance(), and y.

◆ pmaps() [1/2]

template<typename ResultT = void, typename Container , typename Op >
auto Aleph::pmaps ( const Container &  c,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 279 of file ah-parallel.H.

◆ pmaps() [2/2]

template<typename ResultT = void, typename Container , typename Op >
auto Aleph::pmaps ( ThreadPool &  pool,
const Container &  c,
Op  op,
size_t  chunk_size = 0 
)

Parallel map operation.

Applies a function to each element in parallel and returns a new container with the results.

Template Parameters
ResultTResult element type (deduced from Op if not specified).
ContainerInput container type.
OpMapping operation type.
Parameters
poolThread pool to use.
cSource container.
opFunction to apply: ResultT op(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
std::vector<ResultT> with mapped elements.

Example

std::vector<int> nums = {1, 2, 3, 4, 5};
auto squares = pmaps<int>(pool, nums, [](int x) { return x * x; });
// squares = {1, 4, 9, 16, 25}
// Type deduction:
auto strings = pmaps(pool, nums, [](int x) { return std::to_string(x); });
// strings = {"1", "2", "3", "4", "5"}
auto pmaps(ThreadPool &pool, const Container &c, Op op, size_t chunk_size=0)
Parallel map operation.

Definition at line 269 of file ah-parallel.H.

References options, and Aleph::ParallelOptions::pool.

Referenced by example_parallel_map(), example_performance_comparison(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::fit_parallel(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pmax() [1/2]

template<typename Container >
auto Aleph::pmax ( const Container &  c,
const ParallelOptions &  options = {} 
)

Definition at line 1408 of file ah-parallel.H.

References pmax().

◆ pmax() [2/2]

template<typename Container >
auto Aleph::pmax ( ThreadPool &  pool,
const Container &  c,
size_t  chunk_size = 0 
)

Parallel maximum element.

Parameters
poolThread pool to use.
cSource container.
chunk_sizeElements per chunk (0 = auto).
Returns
Optional with maximum element, or nullopt if empty.

Definition at line 1399 of file ah-parallel.H.

References options, pmax(), and Aleph::ParallelOptions::pool.

Referenced by K2Tree< T >::build(), example_parallel_aggregations(), pmax(), pmax(), K2Tree< T >::Node::set_rect(), TEST_F(), and TEST_F().

◆ pmerge() [1/4]

template<typename Container1 , typename Container2 , typename Compare = std::less<>>
auto Aleph::pmerge ( const Container1 &  c1,
const Container2 &  c2,
Compare  comp = Compare{},
const ParallelOptions &  options = {} 
)

Parallel merge of two sorted containers with explicit options.

Overload that accepts a fully specified ParallelOptions instead of a bare ThreadPool.

Parameters
c1First sorted input container.
c2Second sorted input container.
compStrict-weak-order comparator.
optionsParallel execution options (pool, chunk_size, cancel token…).
Returns
std::vector with all elements merged in sorted order.
Exceptions
Anyexception propagated from Aleph::pmerge, from comp, or from element move/copy construction into the result vector.
Aleph::operation_canceledif the token inside the options is canceled before or during execution.
Note
Complexity: Total work O(n), parallelized across the threads in the pool and chunks.
Thread Safety: Does not modify c1 or c2. Safe to call concurrently on different container pairs. The pool in options must be a properly synchronized shared ThreadPool if shared.

Definition at line 2372 of file ah-parallel.H.

References pmerge().

◆ pmerge() [2/4]

template<typename InputIt1 , typename InputIt2 , typename OutputIt , typename Compare = std::less<>>
OutputIt Aleph::pmerge ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  d_first,
Compare  comp = Compare{},
const ParallelOptions &  options = {} 
)

Parallel merge with explicit options.

Definition at line 2404 of file thread_pool.H.

References pmerge().

◆ pmerge() [3/4]

template<typename Container1 , typename Container2 , typename Compare = std::less<>>
auto Aleph::pmerge ( ThreadPool &  pool,
const Container1 &  c1,
const Container2 &  c2,
Compare  comp = Compare{},
size_t  chunk_size = 0 
)

Parallel merge of two sorted containers.

Merges two sorted ranges c1 and c2 into a single sorted std::vector using comparator comp. Both containers must already be sorted in ascending order according to comp.

Parameters
poolThread pool to use for parallel execution.
c1First sorted input container.
c2Second sorted input container.
compStrict-weak-order comparator (default: std::less<>).
chunk_sizeOptional override for the merge task granularity; 0 (default) lets the implementation choose. When set it overrides ParallelOptions::chunk_size.
Returns
std::vector with element type std::common_type_t<T1,T2> containing all elements from c1 and c2 in sorted order. Size equals c1.size() + c2.size().
Exceptions
Anyexception propagated from Aleph::pmerge, from comp, or from element move/copy construction into the result vector.
Aleph::operation_canceledif the token inside the derived ParallelOptions is canceled before or during execution.
Note
Complexity: Total work O(n), parallelized across pool threads and chunks.
Thread Safety: Does not modify c1 or c2. Safe to call concurrently on different container pairs. pool must be a properly synchronized shared ThreadPool if shared.

Definition at line 2342 of file ah-parallel.H.

References pmerge().

Referenced by example_parallel_building_blocks(), example_parallel_scan_merge_partition(), pmerge(), pmerge(), pmerge(), pmerge(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pmerge() [4/4]

template<typename InputIt1 , typename InputIt2 , typename OutputIt , typename Compare = std::less<>>
OutputIt Aleph::pmerge ( ThreadPool &  pool,
InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  d_first,
Compare  comp = Compare{},
size_t  chunk_size = 0 
)

Merge two sorted ranges in parallel.

The input ranges must already be sorted according to comp. The output range must have room for distance(first1, last1) + distance(first2, last2) elements.

Definition at line 2389 of file thread_pool.H.

References pmerge().

◆ pmin() [1/2]

template<typename Container >
auto Aleph::pmin ( const Container &  c,
const ParallelOptions &  options = {} 
)

Definition at line 1321 of file ah-parallel.H.

References pmin().

◆ pmin() [2/2]

template<typename Container >
auto Aleph::pmin ( ThreadPool &  pool,
const Container &  c,
size_t  chunk_size = 0 
)

Parallel minimum element.

Parameters
poolThread pool to use.
cSource container.
chunk_sizeElements per chunk (0 = auto).
Returns
Optional with minimum element, or nullopt if empty.

Definition at line 1312 of file ah-parallel.H.

References options, pmin(), and Aleph::ParallelOptions::pool.

Referenced by K2Tree< T >::build(), example_parallel_aggregations(), pmin(), pmin(), K2Tree< T >::Node::set_rect(), TEST_F(), and TEST_F().

◆ pminmax()

template<typename Container >
auto Aleph::pminmax ( ThreadPool &  pool,
const Container &  c,
size_t  chunk_size = 0 
)

Parallel min and max elements.

Parameters
poolThread pool to use.
cSource container.
chunk_sizeElements per chunk (0 = auto).
Returns
Optional pair (min, max), or nullopt if empty.

Definition at line 1486 of file ah-parallel.H.

References Aleph::ThreadPool::enqueue(), Aleph::ThreadPool::num_threads(), offset, and pminmax().

Referenced by example_parallel_aggregations(), pminmax(), TEST_F(), TEST_F(), and TEST_F().

◆ pnone() [1/2]

template<typename Container , typename Pred >
bool Aleph::pnone ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 968 of file ah-parallel.H.

References pnone().

◆ pnone() [2/2]

template<typename Container , typename Pred >
bool Aleph::pnone ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel none predicate.

Tests if no element satisfies a predicate.

Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
true if no element satisfies pred, false otherwise.

Definition at line 961 of file ah-parallel.H.

References pexists(), pnone(), and pred.

Referenced by example_parallel_predicates(), pnone(), pnone(), TEST_F(), and TEST_F().

◆ pointers_list() [1/2]

template<class Container >
DynList< const typename Container::Item_Type * > Aleph::pointers_list ( const Container &  c)

Const container overload.

Returns
DynList of const pointers.

Definition at line 580 of file ahFunctional.H.

References Aleph::DynList< T >::append().

◆ pointers_list() [2/2]

template<class Container >
DynList< typename Container::Item_Type * > Aleph::pointers_list ( Container &  c)

Create a list of pointers to items in a container.

Traverses the container and collects pointers to each element. Useful for algorithms that need to modify elements in-place or for creating indirect access patterns.

Template Parameters
ContainerContainer type with Item_Type and iterator.
Parameters
cSource container.
Returns
DynList of pointers to each element.
Warning
The returned pointers are only valid while the original container exists and the elements are not removed.
Example:
DynList<int> nums = {1, 2, 3};
auto ptrs = pointers_list(nums);
*ptrs.get_first() = 10; // modifies nums[0]
DynList< typename Container::Item_Type * > pointers_list(Container &c)
Create a list of pointers to items in a container.

Definition at line 567 of file ahFunctional.H.

References Aleph::DynList< T >::append().

Referenced by TEST_F().

◆ points_are_colinear()

bool Aleph::points_are_colinear ( const Point &  a,
const Point &  b,
const Point &  c 
)
inline

Definition at line 62 of file point_utils.H.

References area_of_parallelogram(), and points_are_colinear().

Referenced by points_are_colinear().

◆ pollard_rho()

Array< uint64_t > Aleph::pollard_rho ( uint64_t  n)
inline

Compute the prime factorization of a number using Pollard's rho.

Computes all prime factors of a 64-bit integer n using recursive application of Pollard's rho algorithm combined with the Miller-Rabin primality test.

Parameters
nThe number to factor.
Returns
A sorted array containing the prime factors of n (multiset).
Exceptions
std::invalid_argumentif n < 2 (cannot factor numbers < 2).
std::runtime_errorif the algorithm fails to find a factor after the maximum number of attempts (extremely unlikely).
Precondition
n >= 2.
Postcondition
The product of all returned factors equals n.
All returned factors are prime.
The returned array is sorted in ascending order.
Note
Expected complexity: O(n^1/4) average-case (probabilistic).
Worst-case: O(n^1/4) steps per factor extraction.

Definition at line 184 of file pollard_rho.H.

References ah_invalid_argument_if, Aleph::detail::extract_prime_factors(), and in_place_sort().

Referenced by demo_primality_factorization(), TEST(), and TEST().

◆ polygon_from_vertex_indices()

Polygon Aleph::polygon_from_vertex_indices ( const Array< Point > &  vertices,
const DynList< size_t > &  indices,
const bool  close = true 
)
inline

Constructs a Polygon from a list of indices into a vertex array.

This is useful for algorithms that return faces or boundaries as lists of indices (e.g., SegmentArrangement).

Parameters
verticesThe master array of Point vertices.
indicesThe indices of the vertices that form this polygon.
closeIf true, closes the polygon.
Returns
The constructed Polygon.

Definition at line 550 of file tikzgeom_algorithms.H.

References Aleph::Polygon::add_vertex(), and, Aleph::Polygon::close(), LocateFunctions< Container, Type >::get_it(), Aleph::Polygon::size(), and Aleph::Array< T >::size().

Referenced by put_segment_arrangement_result().

◆ polygon_from_vertices()

Polygon Aleph::polygon_from_vertices ( const Array< Point > &  vertices,
const bool  close = true 
)
inline

Constructs a Polygon from an ordered array of vertices.

Parameters
verticesAn array of Points in the desired order.
closeIf true, closes the polygon by adding an edge from the last vertex back to the first.
Returns
The constructed Polygon.

Definition at line 528 of file tikzgeom_algorithms.H.

References Aleph::Polygon::add_vertex(), and, Aleph::Polygon::close(), Aleph::Polygon::size(), and Aleph::Array< T >::size().

Referenced by put_power_diagram_result(), and put_voronoi_result().

◆ postorder_rec_helper()

template<BinNodeLike Node>
void Aleph::postorder_rec_helper ( Node *  node,
const int &  level,
int &  position,
void(*)(Node *, int, int)  visitFct 
)
inline

Definition at line 253 of file tpl_binNodeUtils.H.

References LLINK, postorder_rec_helper(), and RLINK.

Referenced by postorder_rec_helper(), and postOrderRec().

◆ pow2()

double Aleph::pow2 ( const double  x)
inline

Return x^2.

Definition at line 404 of file ahUtils.H.

Referenced by LFit::LFit(), main(), pow3(), and TEST().

◆ pow3()

double Aleph::pow3 ( const double  x)
inline

Return x^3.

Definition at line 412 of file ahUtils.H.

References pow2().

Referenced by main(), and TEST().

◆ ppartition() [1/2]

template<typename Container , typename Pred >
auto Aleph::ppartition ( const Container &  c,
Pred  pred,
const ParallelOptions &  options = {} 
)

Definition at line 2033 of file ah-parallel.H.

References ppartition().

◆ ppartition() [2/2]

template<typename Container , typename Pred >
auto Aleph::ppartition ( ThreadPool &  pool,
const Container &  c,
Pred  pred,
size_t  chunk_size = 0 
)

Parallel partition (stable).

Partitions elements based on a predicate, preserving relative order.

Parameters
poolThread pool to use.
cSource container.
predPredicate: bool pred(const T&).
chunk_sizeElements per chunk (0 = auto).
Returns
Pair of vectors: (elements satisfying pred, elements not satisfying).

Example

std::vector<int> nums = {1, 2, 3, 4, 5, 6};
auto [evens, odds] = ppartition(pool, nums, [](int x) { return x % 2 == 0; });
// evens = {2, 4, 6}, odds = {1, 3, 5}
auto ppartition(ThreadPool &pool, const Container &c, Pred pred, size_t chunk_size=0)
Parallel partition (stable).

Definition at line 2023 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, ppartition(), and pred.

Referenced by example_parallel_scan_merge_partition(), ppartition(), ppartition(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pproduct() [1/2]

template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T Aleph::pproduct ( const Container &  c,
T  init,
const ParallelOptions &  options 
)

Definition at line 1296 of file ah-parallel.H.

References options, pfoldl(), and pproduct().

◆ pproduct() [2/2]

template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T Aleph::pproduct ( ThreadPool &  pool,
const Container &  c,
T  init = T{1},
size_t  chunk_size = 0 
)

Parallel product of elements.

Parameters
poolThread pool to use.
cSource container.
initInitial value (default 1).
chunk_sizeElements per chunk (0 = auto).
Returns
Product of all elements times init.

Definition at line 1288 of file ah-parallel.H.

References pproduct().

Referenced by pproduct(), pproduct(), TEST_F(), and TEST_F().

◆ prefix()

template<BinNodeLike Node>
static void Aleph::prefix ( Node *  root,
DynList< Node * > &  acc 
)
static

Definition at line 491 of file tpl_binNodeUtils.H.

References Aleph::DynList< T >::append(), LLINK, prefix(), RLINK, and root().

Referenced by Aleph::Gen_Reroot_DP< GT, T, SA >::Gen_Reroot_DP(), Aleph::Compiler_Driver_Detail::artifact_label(), compute_optimal_costs(), demo_grouping(), demo_performance(), demo_prefix_search(), demo_spell_checker(), deway(), deway(), draw_children(), export_variant(), is_prefix(), Aleph::RadixTree< T, Char >::keys_with_prefix(), Aleph::Huffman_Encoder_Engine::load_tree(), load_tree(), load_tree_from_array(), main(), main(), mat_to_latex(), mat_to_latex(), mat_to_latex_simple(), optimal_merge_knuth(), prefix(), prefix(), put_point_labels(), put_point_labels(), Aleph::Gen_Fenwick_Tree< T, Plus, Minus >::query(), remove_prefix(), Aleph::Compiler_Typed_Semantic_Analyzer::require_unify(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::rstar_split(), save_tree(), Aleph::Huffman_Encoder_Engine::save_tree(), save_tree_in_array_of_chars(), Aleph::Cnode::search_prefix(), Aleph::Prefix_Tree_Map< T >::Node::search_prefix(), Aleph::Cnode::search_prefix(), Aleph::Prefix_Tree_Map< T >::Node::search_prefix(), Aleph::Cnode::search_prefix_impl(), Aleph::Prefix_Tree_Map< T >::Node::search_prefix_impl(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST(), TYPED_TEST_P(), Aleph::Prefix_Tree_Map< T >::words_with_prefix(), Aleph::Cnode::words_with_prefix(), Aleph::Prefix_Tree::words_with_prefix(), write_avl(), write_bin(), write_rand(), write_rb(), write_splay(), and write_treap().

◆ prefix_for_each()

template<BinNodeLike Node, class Op >
void Aleph::prefix_for_each ( Node *  root,
Op  op 
)

Traverse in preorder all the container and performs an operation on each element.

prefix_for_each(operation) traverses the container and on each element item is performed operation(item).

operation must have the following signature:

void operation(Node * p)

Overloading of this method allow that the signature can be lightly different; for example, remove the reference or the const.

Parameters
root
opoperation to be performed on each item
Exceptions
anythingthat can throw operation

Definition at line 2963 of file tpl_binNodeUtils.H.

References Aleph::BinNodePrefixIterator< Node >::has_curr(), and root().

◆ preflow_create_residual_net()

template<class Net >
std::tuple< PP_Res_Net< Net >, typename PP_Res_Net< Net >::Node *, typename PP_Res_Net< Net >::Node * > Aleph::preflow_create_residual_net ( Net &  net)
inline

Build the residual network for preflow-push algorithms.

Returns the residual network and the mapped source/sink nodes.

Definition at line 2195 of file tpl_net.H.

References create_residual_arc(), Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), NODE_COOKIE, and GraphCommon< GT, Node, Arc >::reset_nodes().

Referenced by TEST(), and TYPED_TEST().

◆ preorder_rec_helper()

template<BinNodeLike Node>
void Aleph::preorder_rec_helper ( Node *  p,
const int &  level,
int &  position,
void(*)(Node *, int, int)  visitFct 
)
inline

Definition at line 208 of file tpl_binNodeUtils.H.

References LLINK, preorder_rec_helper(), and RLINK.

Referenced by preorder_rec_helper(), and preOrderRec().

◆ prev_value()

double Aleph::prev_value ( const double  val)
inline

Return the next representable floating-point value of val towards the smallest positive normal number.

Definition at line 458 of file ahUtils.H.

Referenced by TEST().

◆ print()

template<class Net >
void Aleph::print ( const DynList< Parc< Net > > &  sp)
inline

Print a semi-path to stdout.

Definition at line 1202 of file tpl_net.H.

Referenced by main(), and test_map_tree().

◆ print_benchmark_results()

template<typename Flow_Type >
void Aleph::print_benchmark_results ( const std::vector< MaxFlowBenchmarkResult< Flow_Type > > &  results)

Print benchmark results.

Definition at line 990 of file net_utils.H.

References r.

Referenced by TEST_F().

◆ print_net_cost()

template<class Net >
void Aleph::print_net_cost ( const Net &  net,
std::ostream &  out 
)

Output a flow network to Graphviz format.

Generates a DOT format representation of the network showing flow/capacity/cost labels on arcs.

Template Parameters
NetNetwork type.
Parameters
[in]netThe network to output.
[out]outOutput stream.

Definition at line 994 of file tpl_netcost.H.

References Aleph::To_Graphviz< GT, Node_Attr, Arc_Attr, SN, SA >::digraph(), NODE_COUNTER, GraphCommon< GT, Node, Arc >::nodes(), and out.

◆ print_parse_error_and_exit()

void Aleph::print_parse_error_and_exit ( const std::string &  str)
inline

Print a parse error message and terminate the program.

Outputs a formatted error message including the current file position (line:column) and the last token that was scanned, then exits with status code 1.

Parameters
strThe error message to display
Note
This function does not return; it terminates the program.
Example
if (unexpected_token)
print_parse_error_and_exit("Expected 'begin' keyword");
// Output: Parse error 15:23 Expected 'begin' keyword
// Last token seen is: foo
void print_parse_error_and_exit(const std::string &str)
Print a parse error message and terminate the program.

Definition at line 500 of file parse_utils.H.

References previous_col_number, previous_line_number, print_parse_error_and_exit(), and token_instance.

Referenced by generate_tree(), load_tag_option(), parse_arc(), parse_connexion(), parse_dashed_arc(), parse_deway_number(), parse_first_root_definition(), parse_graph_definition(), parse_tag(), parse_tag_definition(), parse_without_arc(), print_parse_error_and_exit(), read_input_and_build_graph(), and read_input_and_build_tree().

◆ print_parse_warning()

void Aleph::print_parse_warning ( const std::string &  str)
inline

Print a parse warning message.

Outputs a formatted warning message including the current file position (line:column) and the last token that was scanned. Unlike print_parse_error_and_exit(), this function returns normally.

Parameters
strThe warning message to display
Example
if (deprecated_syntax)
print_parse_warning("Deprecated syntax, use new format");
// Continues execution after printing warning
void print_parse_warning(const std::string &str)
Print a parse warning message.

Definition at line 524 of file parse_utils.H.

References previous_col_number, previous_line_number, print_parse_warning(), and token_instance.

Referenced by parse_arc(), and print_parse_warning().

◆ print_residual_net()

template<class Net >
void Aleph::print_residual_net ( const Residual_Net< typename Net::Flow_Type > &  net,
std::ostream &  out 
)

Output a residual network to Graphviz format.

Generates a DOT format representation showing residual arcs in red.

Template Parameters
NetOriginal network type (used for Flow_Type).
Parameters
[in]netThe residual network to output.
[out]outOutput stream.

Definition at line 1032 of file tpl_netcost.H.

References NODE_COUNTER, GraphCommon< GT, Node, Arc >::nodes(), and out.

◆ print_rule()

void Aleph::print_rule ( )
inline

Prints a horizontal rule for example output separation.

Definition at line 39 of file print_rule.H.

Referenced by demo_modular_arithmetic(), demo_modular_combinatorics(), demo_modular_linalg(), demo_ntt(), demo_primality_factorization(), and main().

◆ process_escape()

char Aleph::process_escape ( const int  c)
inline

Process an escape sequence.

Given a character after a backslash, returns the corresponding escaped character.

Parameters
cThe character after the backslash
Returns
The unescaped character
Supported escapes
  • \\n → newline
  • \\t → tab
  • \\r → carriage return
  • \\\\ → backslash
  • \\\" → double quote
  • ‘\’→ single quote -\0` → null

Definition at line 1362 of file parse_utils.H.

References process_escape().

Referenced by load_char_literal(), load_escaped_string(), process_escape(), TEST(), and TEST().

◆ product()

template<class Container , typename T = typename Container::Item_Type>
T Aleph::product ( const Container &  container,
const T &  init = T{1} 
)
inline

◆ proper_intersection()

bool Aleph::proper_intersection ( const Point &  a,
const Point &  b,
const Point &  c,
const Point &  d 
)
inline

Definition at line 88 of file point_utils.H.

References and, COLLINEAR, orientation(), and proper_intersection().

Referenced by proper_intersection().

◆ pscan() [1/4]

template<typename Container , typename BinaryOp >
auto Aleph::pscan ( const Container &  c,
BinaryOp  op,
const ParallelOptions &  options = {} 
)

Parallel inclusive scan over a container with explicit options.

Overload that accepts a fully specified ParallelOptions instead of a bare ThreadPool.

Parameters
cInput container. Must be non-mutating during the call.
opAssociative binary operation.
optionsParallel execution options (pool, chunk_size, cancel token…).
Returns
std::vector of the same value type as c, containing the inclusive prefix sums. Empty if c is empty.
Exceptions
Anyexception propagated from Aleph::pscan, from op, or from element move/copy construction into the result vector.
Aleph::operation_canceledif the token inside the options is canceled before or during execution.
Note
Complexity: Total work O(n), parallelized across the threads in the pool and chunks.
Thread Safety: Does not modify c. Safe to call concurrently on different containers. The pool in options must be a properly synchronized shared ThreadPool if shared.

Definition at line 2222 of file ah-parallel.H.

References pscan().

◆ pscan() [2/4]

template<typename InputIt , typename OutputIt , typename BinaryOp >
OutputIt Aleph::pscan ( InputIt  first,
InputIt  last,
OutputIt  d_first,
BinaryOp  op,
const ParallelOptions &  options = {} 
)

Inclusive prefix scan with explicit options.

Definition at line 2197 of file thread_pool.H.

References pscan().

◆ pscan() [3/4]

template<typename Container , typename BinaryOp >
auto Aleph::pscan ( ThreadPool &  pool,
const Container &  c,
BinaryOp  op,
size_t  chunk_size = 0 
)

Parallel inclusive scan over a container.

Computes an inclusive prefix scan of c using binary operation op and returns the result as a std::vector. Element result[i] equals op(op(...op(c[0], c[1])...), c[i]).

Parameters
poolThread pool to use for parallel execution.
cInput container. Must be non-mutating during the call.
opAssociative binary operation.
chunk_sizeOptional override for the number of elements per chunk; 0 (default) lets the implementation choose. When set it overrides ParallelOptions::chunk_size.
Returns
std::vector of the same value type as c, containing the inclusive prefix sums. Empty if c is empty.
Exceptions
Anyexception propagated from Aleph::pscan, from op, or from element move/copy construction into the result vector.
Aleph::operation_canceledif the token inside the derived ParallelOptions is canceled before or during execution.
Note
Complexity: Total work O(n), parallelized across pool threads and chunks.
Thread Safety: Does not modify c. Safe to call concurrently on different containers. pool must be a properly synchronized shared ThreadPool if shared.

Definition at line 2192 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, and pscan().

Referenced by example_parallel_building_blocks(), example_parallel_scan_merge_partition(), pscan(), pscan(), pscan(), pscan(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pscan() [4/4]

template<typename InputIt , typename OutputIt , typename BinaryOp >
OutputIt Aleph::pscan ( ThreadPool &  pool,
InputIt  first,
InputIt  last,
OutputIt  d_first,
BinaryOp  op,
size_t  chunk_size = 0 
)

Inclusive prefix scan over a range.

Computes partial prefixes such that out[i] = op(x0, x1, ..., xi). Requires random-access iterators, matching the rest of the low-level parallel primitives in this header.

Definition at line 2186 of file thread_pool.H.

References options, Aleph::ParallelOptions::pool, and pscan().

◆ psort() [1/2]

template<typename Container , typename Compare = std::less<>>
void Aleph::psort ( Container &  c,
Compare  cmp = Compare{},
const ParallelOptions &  options = {} 
)

Definition at line 1577 of file ah-parallel.H.

References psort().

◆ psort() [2/2]

template<typename Container , typename Compare = std::less<>>
void Aleph::psort ( ThreadPool &  pool,
Container &  c,
Compare  cmp = Compare{},
const size_t  min_parallel_size = 1024 
)

Parallel sort (in-place).

Sorts a container using multiple threads for the comparison work. Uses a parallel merge sort approach.

Template Parameters
ContainerContainer with random access iterators.
CompareComparison function type.
Parameters
poolThread pool to use.
cContainer to sort.
cmpComparison function (default: std::less<>).
min_parallel_sizeMinimum size for parallel recursion.

Example

std::vector<int> nums = {5, 2, 8, 1, 9, 3};
psort(pool, nums);
// nums = {1, 2, 3, 5, 8, 9}
// Custom comparison
psort(pool, nums, std::greater<int>());
// nums = {9, 8, 5, 3, 2, 1}
void psort(ThreadPool &pool, Container &c, Compare cmp=Compare{}, const size_t min_parallel_size=1024)
Parallel sort (in-place).

Definition at line 1567 of file ah-parallel.H.

References psort().

Referenced by example_parallel_sort(), psort(), psort(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ psum() [1/2]

template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T Aleph::psum ( const Container &  c,
T  init,
const ParallelOptions &  options 
)

Definition at line 1270 of file ah-parallel.H.

References options, pfoldl(), and psum().

◆ psum() [2/2]

template<typename Container , typename T = std::decay_t<decltype(*std::begin(std::declval<Container>()))>>
T Aleph::psum ( ThreadPool &  pool,
const Container &  c,
T  init = T{},
size_t  chunk_size = 0 
)

Parallel sum of elements.

Parameters
poolThread pool to use.
cSource container.
initInitial value (default 0).
chunk_sizeElements per chunk (0 = auto).
Returns
Sum of all elements plus init.

Example

std::vector<int> nums = {1, 2, 3, 4, 5};
auto total = psum(pool, nums);
// total = 15
T psum(ThreadPool &pool, const Container &c, T init=T{}, size_t chunk_size=0)
Parallel sum of elements.

Definition at line 1262 of file ah-parallel.H.

References psum().

Referenced by example_parallel_aggregations(), example_parallel_fold(), psum(), psum(), TEST_F(), TEST_F(), and TEST_F().

◆ ptr_fun() [1/2]

template<class _Arg , class _Result >
pointer_to_unary_function< _Arg, _Result > Aleph::ptr_fun ( _Result(*)(_Arg)  __x)
inline

Definition at line 548 of file ahFunction.H.

◆ ptr_fun() [2/2]

template<class _Arg1 , class _Arg2 , class _Result >
pointer_to_binary_function< _Arg1, _Arg2, _Result > Aleph::ptr_fun ( _Result(*)(_Arg1, _Arg2)  __x)
inline

Definition at line 578 of file ahFunction.H.

◆ push2()

template<class Stack , class A , class B >
void Aleph::push2 ( Stack &  stack,
const A &  a,
const B &  b 
)
inline

Push two values onto a stack.

Convenience helper for iterative quicksort implementations.

Template Parameters
StackStack container type.
AFirst value type.
BSecond value type.
Parameters
stackThe stack to push onto.
aFirst value.
bSecond value.

Definition at line 3927 of file tpl_sort_utils.H.

Referenced by quicksort(), and quicksort_op().

◆ put_aabb_tree_result()

void Aleph::put_aabb_tree_result ( Tikz_Plane &  plane,
const AABBTree::DebugSnapshot &  snapshot,
const Rectangle *  query_rect = nullptr,
const Array< size_t > *  query_hit_ids = nullptr,
const Tikz_Style &  node_bbox_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  leaf_bbox_style = tikz_wire_style("blue!70"),
const Tikz_Style &  query_rect_style = tikz_wire_style("red", true),
const Tikz_Style &  query_hit_style = tikz_wire_style("red"),
const int  node_layer = Tikz_Plane::Layer_Default,
const int  query_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw AABB tree hierarchy and optional query results.

Definition at line 1035 of file tikzgeom_algorithms.H.

References Aleph::Tikz_Style::draw_color, adaptive_huffman_demo::Snapshot::nodes, put_in_plane(), and Aleph::detail::tikz_palette_color().

Referenced by visualize_aabb_tree(), and visualize_aabb_tree_query().

◆ put_alpha_shape_result()

void Aleph::put_alpha_shape_result ( Tikz_Plane &  plane,
const AlphaShape::Result &  alpha_shape,
const bool  draw_kept_triangles = false,
const Tikz_Style &  triangle_style = tikz_wire_style("gray!55"),
const Tikz_Style &  boundary_style = tikz_path_style("orange!90!black"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black"),
const int  triangle_layer = Tikz_Plane::Layer_Background,
const int  boundary_layer = Tikz_Plane::Layer_Foreground,
const int  site_layer = Tikz_Plane::Layer_Overlay 
)
inline

Insert alpha-shape structures (kept triangles, boundary, sites).

Definition at line 1539 of file tikzgeom_algorithms.H.

References Aleph::AlphaShape::Result::boundary_edges, k, put_in_plane(), put_points(), Aleph::AlphaShape::Result::sites, and Aleph::AlphaShape::Result::triangles.

◆ put_cdt_result()

void Aleph::put_cdt_result ( Tikz_Plane &  plane,
const ConstrainedDelaunayTriangulation::Result &  cdt,
const Tikz_Style &  triangle_style = tikz_wire_style("blue!60"),
const Tikz_Style &  constraint_style = tikz_path_style("red"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black"),
const int  triangle_layer = Tikz_Plane::Layer_Default,
const int  constraint_layer = Tikz_Plane::Layer_Foreground,
const int  site_layer = Tikz_Plane::Layer_Overlay 
)
inline

Insert constrained Delaunay triangulation result.

Draws all triangles in wire style, constrained edges in a distinct foreground style, and optionally sites as points.

Definition at line 1822 of file tikzgeom_algorithms.H.

References Aleph::ConstrainedDelaunayTriangulation::Result::constrained_edges, put_in_plane(), put_points(), Aleph::ConstrainedDelaunayTriangulation::Result::sites, and Aleph::ConstrainedDelaunayTriangulation::Result::triangles.

◆ put_char_in_buffer()

void Aleph::put_char_in_buffer ( char *&  start_addr,
const char *  end_addr,
int  c 
)
inline

Append a character to a buffer with bounds checking.

Safely adds a character to a buffer, checking that the buffer has not been exceeded. If the buffer is full, an error is raised.

Parameters
start_addrReference to the current write position; incremented after write
end_addrPointer to one past the end of the buffer
cCharacter to append
Exceptions
Terminatesprogram if buffer overflow would occur
Example
char buffer[100];
char* ptr = buffer;
char* end = buffer + 100;
put_char_in_buffer(ptr, end, 'H');
put_char_in_buffer(ptr, end, 'i');
put_char_in_buffer(ptr, end, '\0');
// buffer now contains "Hi"
void put_char_in_buffer(char *&start_addr, const char *end_addr, int c)
Append a character to a buffer with bounds checking.

Definition at line 204 of file parse_utils.H.

References AH_ERROR, and put_char_in_buffer().

Referenced by close_token_scanning(), get_token(), load_binary_number(), load_deway_number(), load_double(), load_escaped_string(), load_hex_number(), load_identifier(), load_number(), load_octal_number(), load_string(), put_char_in_buffer(), TEST(), TEST(), and TEST().

◆ put_closest_pair_result()

void Aleph::put_closest_pair_result ( Tikz_Plane &  plane,
const DynList< Point > &  points,
const ClosestPairDivideAndConquer::Result &  result,
const Tikz_Style &  points_style = tikz_points_style("black"),
const Tikz_Style &  pair_style = tikz_path_style("red"),
const Tikz_Style &  pair_points_style = tikz_points_style("red"),
const int  points_layer = Tikz_Plane::Layer_Default,
const int  pair_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw closest-pair result over the full point set.

Definition at line 1616 of file tikzgeom_algorithms.H.

References Aleph::ClosestPairDivideAndConquer::Result::first, put_in_plane(), put_points(), and Aleph::ClosestPairDivideAndConquer::Result::second.

◆ put_convex_decomposition_result()

void Aleph::put_convex_decomposition_result ( Tikz_Plane &  plane,
const Array< Polygon > &  parts,
const bool  color_parts_by_index = true,
const Tikz_Style &  part_style = tikz_area_style("blue!60!black", "blue!15", 0.40),
const int  part_layer = Tikz_Plane::Layer_Default 
)
inline

Insert convex decomposition polygons.

Each convex part can be colored using a repeating palette.

Definition at line 1499 of file tikzgeom_algorithms.H.

References Aleph::Tikz_Style::draw_color, Aleph::Tikz_Style::fill, Aleph::Tikz_Style::fill_color, put_in_plane(), Aleph::Array< T >::size(), and Aleph::detail::tikz_palette_color().

◆ put_cubic_bezier_in_plane()

void Aleph::put_cubic_bezier_in_plane ( Tikz_Plane &  plane,
const Point &  p0,
const Point &  p1,
const Point &  p2,
const Point &  p3,
const size_t  subdivisions = 64,
const Tikz_Style &  style = {},
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Approximate and insert a cubic Bézier as an open polyline.

Definition at line 1556 of file tikzgeom.H.

Referenced by TEST().

◆ put_cubic_bezier_native_in_plane()

void Aleph::put_cubic_bezier_native_in_plane ( Tikz_Plane &  plane,
const Point &  p0,
const Point &  p1,
const Point &  p2,
const Point &  p3,
const Tikz_Style &  style = {},
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Insert a cubic Bézier using native TikZ controls syntax.

Definition at line 1603 of file tikzgeom.H.

Referenced by main(), and TEST().

◆ put_delaunay_result()

void Aleph::put_delaunay_result ( Tikz_Plane &  plane,
const DelaunayTriangulationBowyerWatson::Result &  dt,
const Tikz_Style &  triangle_style = tikz_wire_style("blue"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black"),
const int  triangle_layer = Tikz_Plane::Layer_Default,
const int  site_layer = Tikz_Plane::Layer_Foreground 
)
inline

Insert Delaunay triangulation as triangle outlines.

Optionally draws sites as points on top.

Definition at line 680 of file tikzgeom_algorithms.H.

References put_in_plane(), put_points(), Aleph::DelaunayTriangulationBowyerWatson::Result::sites, and Aleph::DelaunayTriangulationBowyerWatson::Result::triangles.

Referenced by main().

◆ put_funnel_trace_step()

void Aleph::put_funnel_trace_step ( Tikz_Plane &  plane,
const Polygon &  polygon,
const Point &  source,
const Point &  target,
const FunnelTraceResult &  trace,
size_t  step_index,
const Tikz_Style &  polygon_style = tikz_area_style("black", "gray!15", 0.22),
const Tikz_Style &  source_style = tikz_points_style("green!50!black"),
const Tikz_Style &  target_style = tikz_points_style("blue"),
const Tikz_Style &  all_portals_style = tikz_wire_style("purple", true),
const Tikz_Style &  active_portal_style = tikz_path_style("purple"),
const Tikz_Style &  funnel_leg_style = tikz_path_style("orange!90!black"),
const Tikz_Style &  committed_style = tikz_path_style("red"),
const bool  draw_waypoints = true,
const Tikz_Style &  waypoint_style = tikz_points_style("red"),
const int  polygon_layer = Tikz_Plane::Layer_Default,
const int  portal_layer = Tikz_Plane::Layer_Foreground,
const int  highlight_layer = Tikz_Plane::Layer_Overlay 
)
inline

◆ put_half_plane_intersection_result()

void Aleph::put_half_plane_intersection_result ( Tikz_Plane &  plane,
const Array< HalfPlaneIntersection::HalfPlane > &  halfplanes,
const Polygon &  intersection,
const Tikz_Style &  boundary_style = tikz_wire_style("gray!60", true, true),
const Tikz_Style &  result_style = tikz_area_style("red", "red!25", 0.50),
const int  boundary_layer = Tikz_Plane::Layer_Default,
const int  result_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw half-plane boundaries and their bounded intersection polygon.

Definition at line 1683 of file tikzgeom_algorithms.H.

References put_in_plane(), Aleph::Polygon::size(), and Aleph::Array< T >::size().

◆ put_in_active_queue()

template<class Q_Type >
static void Aleph::put_in_active_queue ( Q_Type &  q,
typename Q_Type::Item_Type &  p 
)
inlinestatic

Enqueue an active node if it is not already enqueued.

Definition at line 2391 of file tpl_net.H.

References Maximum_Flow, and NODE_BITS.

Referenced by generic_preflow_vertex_push_maximum_flow().

◆ put_in_plane() [1/2]

template<TikzDrawable Geom>
void Aleph::put_in_plane ( Tikz_Plane &  plane,
const Geom &  geom_obj 
)
inline

Insert any supported geometry type in a Tikz_Plane.

Definition at line 1511 of file tikzgeom.H.

References Aleph::Tikz_Plane::put().

Referenced by Aleph::Tikz_Scene::add(), Aleph::Tikz_Scene::add(), main(), main(), process_arc(), process_node(), process_tag_node(), process_text_arc(), put_aabb_tree_result(), put_alpha_shape_result(), put_cdt_result(), put_closest_pair_result(), put_convex_decomposition_result(), put_delaunay_result(), put_funnel_trace_step(), put_half_plane_intersection_result(), put_kdtree_partitions_result(), put_line_sweep_result(), put_mec_result(), put_minkowski_sum_result(), put_monotone_triangulation_result(), put_offset_result(), put_path(), put_path(), put_point_label_in_plane(), put_points(), put_points(), put_polygon_vertices(), put_polygon_vertices(), put_polygons(), put_portals(), put_power_diagram_result(), put_range_tree_result(), put_regular_triangulation_result(), put_rotating_calipers_result(), put_rtree_result(), put_segment_arrangement_result(), put_simplification_result(), put_smoothing_result(), put_trapezoidal_map_result(), put_visibility_polygon_result(), put_voronoi_result(), TextVariantsTest::SetUp(), CoordinateTransformTest::SetUp(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and visualize_convex_hull().

◆ put_in_plane() [2/2]

template<TikzDrawable Geom>
void Aleph::put_in_plane ( Tikz_Plane &  plane,
const Geom &  geom_obj,
const Tikz_Style &  style,
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Insert any supported geometry type with style/layer.

Definition at line 1518 of file tikzgeom.H.

References Aleph::Tikz_Plane::put().

◆ put_kdtree_partitions_result()

void Aleph::put_kdtree_partitions_result ( Tikz_Plane &  plane,
const KDTreePointSearch::DebugSnapshot &  snapshot,
const bool  draw_partition_boxes = false,
const bool  draw_points = true,
const Tikz_Style &  partition_style = tikz_wire_style("gray!55", true),
const Tikz_Style &  split_style = tikz_wire_style("blue!70"),
const Tikz_Style &  point_style = tikz_points_style("red"),
const int  partition_layer = Tikz_Plane::Layer_Background,
const int  split_layer = Tikz_Plane::Layer_Default,
const int  point_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw KD-tree partitions from a debug snapshot.

Definition at line 901 of file tikzgeom_algorithms.H.

References Aleph::Tikz_Style::draw_color, put_in_plane(), put_points(), Aleph::detail::tikz_palette_color(), y0(), and y1().

Referenced by visualize_kdtree_partitions().

◆ put_line_sweep_result()

void Aleph::put_line_sweep_result ( Tikz_Plane &  plane,
const Array< Segment > &  segments,
const Array< SweepLineSegmentIntersection::Intersection > &  intersections,
const Tikz_Style &  segment_style = tikz_wire_style("blue!60"),
const Tikz_Style &  intersection_style = tikz_points_style("red"),
const int  segment_layer = Tikz_Plane::Layer_Default,
const int  intersection_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw line segments and all sweep-line intersection points.

Definition at line 1791 of file tikzgeom_algorithms.H.

References put_in_plane(), and Aleph::Array< T >::size().

◆ put_mec_result()

void Aleph::put_mec_result ( Tikz_Plane &  plane,
const MinimumEnclosingCircle::Circle &  circle,
const DynList< Point > &  points,
const Tikz_Style &  circle_style = tikz_wire_style("blue!70"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black"),
const int  circle_layer = Tikz_Plane::Layer_Default,
const int  site_layer = Tikz_Plane::Layer_Overlay 
)
inline

Draw a precomputed minimum enclosing circle result.

Draws the enclosing circle as an Ellipse and optionally the input points on top.

Definition at line 1870 of file tikzgeom_algorithms.H.

References Aleph::MinimumEnclosingCircle::Circle::center, put_in_plane(), put_points(), r, and Aleph::MinimumEnclosingCircle::Circle::radius().

◆ put_minkowski_sum_result()

void Aleph::put_minkowski_sum_result ( Tikz_Plane &  plane,
const Polygon &  first,
const Polygon &  second,
const Polygon &  result,
const Tikz_Style &  first_style = tikz_area_style("blue", "blue!14", 0.30),
const Tikz_Style &  second_style = tikz_area_style("green!60!black", "green!16", 0.30),
const Tikz_Style &  result_style = tikz_area_style("red", "red!26", 0.60),
const int  input_layer = Tikz_Plane::Layer_Default,
const int  result_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw input polygons and their Minkowski sum result.

Definition at line 1711 of file tikzgeom_algorithms.H.

References put_in_plane(), and Aleph::Polygon::size().

◆ put_monotone_triangulation_result()

void Aleph::put_monotone_triangulation_result ( Tikz_Plane &  plane,
const Polygon &  polygon,
const DynList< Triangle > &  triangles,
const Tikz_Style &  polygon_style = tikz_wire_style("black"),
const Tikz_Style &  triangle_style = tikz_wire_style("blue!65"),
const int  polygon_layer = Tikz_Plane::Layer_Default,
const int  triangle_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw a monotone triangulation result plus polygon boundary.

Definition at line 1739 of file tikzgeom_algorithms.H.

References LocateFunctions< Container, Type >::get_it(), and put_in_plane().

◆ put_offset_result()

void Aleph::put_offset_result ( Tikz_Plane &  plane,
const Polygon &  original,
const PolygonOffset::Result &  result,
const Tikz_Style &  original_style = tikz_wire_style("gray!50"),
const Tikz_Style &  offset_style = tikz_bold_wire_style("blue!80"),
const bool  draw_vertices = true,
const Tikz_Style &  vertex_style = tikz_points_style("red") 
)
inline

Draw a polygon offset result overlaid on the original polygon.

Parameters
planeTarget TikZ canvas.
originalThe original polygon (drawn faded).
resultThe offset result (one or more polygons).
original_styleStyle for the original polygon.
offset_styleStyle for offset polygon(s).
draw_verticesWhether to draw vertices of offset polygon(s).
vertex_styleStyle for offset polygon vertices.

Definition at line 1978 of file tikzgeom_algorithms.H.

References Aleph::PolygonOffset::Result::polygons, put_in_plane(), and put_polygon_vertices().

◆ put_path() [1/2]

void Aleph::put_path ( Tikz_Plane &  plane,
const Array< Point > &  path,
const Tikz_Style &  segment_style = tikz_path_style("red"),
const bool  draw_waypoints = true,
const Tikz_Style &  waypoint_style = tikz_points_style("red"),
const int  segment_layer = Tikz_Plane::Layer_Foreground,
const int  waypoint_layer = Tikz_Plane::Layer_Overlay 
)
inline

Insert an Array<Point> path as connected segments and waypoints.

Definition at line 1220 of file tikzgeom_algorithms.H.

References put_in_plane(), put_points(), and Aleph::Array< T >::size().

◆ put_path() [2/2]

void Aleph::put_path ( Tikz_Plane &  plane,
const DynList< Point > &  path,
const Tikz_Style &  segment_style = tikz_path_style("red"),
const bool  draw_waypoints = true,
const Tikz_Style &  waypoint_style = tikz_points_style("red"),
const int  segment_layer = Tikz_Plane::Layer_Foreground,
const int  waypoint_layer = Tikz_Plane::Layer_Overlay 
)
inline

Insert a point path as connected segments and optional waypoints.

Definition at line 1195 of file tikzgeom_algorithms.H.

References LocateFunctions< Container, Type >::get_it(), put_in_plane(), and put_points().

Referenced by put_funnel_trace_step().

◆ put_point_label_in_plane()

void Aleph::put_point_label_in_plane ( Tikz_Plane &  plane,
const Point &  point,
const std::string &  label,
const std::string &  placement = "above",
const Tikz_Style &  style = make_tikz_draw_style("black"),
const int  layer = Tikz_Plane::Layer_Overlay 
)
inline

Insert a point label with configurable placement (above, etc.).

Definition at line 1616 of file tikzgeom.H.

References put_in_plane(), and Aleph::Tikz_Style::text_placement.

Referenced by main(), put_point_labels(), and put_point_labels().

◆ put_point_labels() [1/2]

void Aleph::put_point_labels ( Tikz_Plane &  plane,
const Array< Point > &  pts,
const std::string &  prefix = "p",
const std::string &  placement = "above right",
const Tikz_Style &  style = make_tikz_draw_style("black"),
const int  layer = Tikz_Plane::Layer_Overlay 
)
inline

Adds a text label to each point in an Array<Point>.

Labels are generated as prefix + index. For example, p0, p1, etc.

Parameters
planeThe target TikZ plane.
ptsThe array of points to label.
prefixA string prefix for each label.
placementThe TikZ placement string (e.g., "above", "below left").
styleThe style for the text labels.
layerThe layer on which to draw the labels.

Definition at line 443 of file tikzgeom_algorithms.H.

References prefix(), put_point_label_in_plane(), and Aleph::Array< T >::size().

◆ put_point_labels() [2/2]

void Aleph::put_point_labels ( Tikz_Plane &  plane,
const DynList< Point > &  pts,
const std::string &  prefix = "p",
const std::string &  placement = "above right",
const Tikz_Style &  style = make_tikz_draw_style("black"),
const int  layer = Tikz_Plane::Layer_Overlay 
)
inline

Adds a text label to each point in a DynList<Point>.

Labels are generated as prefix + index based on iteration order.

Parameters
planeThe target TikZ plane.
ptsThe list of points to label.
prefixA string prefix for each label.
placementThe TikZ placement string (e.g., "above", "below left").
styleThe style for the text labels.
layerThe layer on which to draw the labels.

Definition at line 464 of file tikzgeom_algorithms.H.

References LocateFunctions< Container, Type >::get_it(), prefix(), and put_point_label_in_plane().

◆ put_points() [1/2]

void Aleph::put_points ( Tikz_Plane &  plane,
const Array< Point > &  pts,
const Tikz_Style &  style = tikz_points_style(),
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Inserts all points from an Array<Point> into the plane.

Parameters
planeThe target TikZ plane.
ptsAn array of points to insert.
styleThe style to apply to each point.
layerThe layer on which to draw the points.

Definition at line 409 of file tikzgeom_algorithms.H.

References put_in_plane(), and Aleph::Array< T >::size().

Referenced by Aleph::Tikz_Scene::add_points(), Aleph::Tikz_Scene::add_points(), main(), put_alpha_shape_result(), put_cdt_result(), put_closest_pair_result(), put_delaunay_result(), put_kdtree_partitions_result(), put_mec_result(), put_path(), put_path(), put_range_tree_result(), put_segment_arrangement_result(), put_voronoi_result(), and visualize_convex_hull().

◆ put_points() [2/2]

void Aleph::put_points ( Tikz_Plane &  plane,
const DynList< Point > &  pts,
const Tikz_Style &  style = tikz_points_style(),
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Inserts all points from a DynList<Point> into the plane.

Parameters
planeThe target TikZ plane.
ptsA dynamic list of points to insert.
styleThe style to apply to each point.
layerThe layer on which to draw the points.

Definition at line 424 of file tikzgeom_algorithms.H.

References LocateFunctions< Container, Type >::get_it(), and put_in_plane().

◆ put_polygon_vertices() [1/2]

void Aleph::put_polygon_vertices ( Tikz_Plane &  plane,
const Polygon &  poly,
const Tikz_Style &  style = tikz_points_style(),
const int  layer = Tikz_Plane::Layer_Overlay 
)
inline

Inserts the vertices of a polygon as styled points.

Parameters
planeThe target TikZ plane.
polyThe polygon whose vertices are to be drawn.
styleThe style for the vertex points.
layerThe layer on which to draw the points.

Definition at line 498 of file tikzgeom_algorithms.H.

References Aleph::Dlink::Iterator::has_curr(), and put_in_plane().

Referenced by main(), put_offset_result(), put_simplification_result(), put_smoothing_result(), and visualize_convex_hull().

◆ put_polygon_vertices() [2/2]

void Aleph::put_polygon_vertices ( Tikz_Plane &  plane,
const Regular_Polygon &  poly,
const Tikz_Style &  style = tikz_points_style(),
const int  layer = Tikz_Plane::Layer_Overlay 
)
inline

Inserts the vertices of a regular polygon as styled points.

Parameters
planeThe target TikZ plane.
polyThe regular polygon whose vertices are to be drawn.
styleThe style for the vertex points.
layerThe layer on which to draw the points.

Definition at line 513 of file tikzgeom_algorithms.H.

References Aleph::Regular_Polygon::get_vertex(), put_in_plane(), and Aleph::Regular_Polygon::size().

◆ put_polygons()

void Aleph::put_polygons ( Tikz_Plane &  plane,
const Array< Polygon > &  polys,
const Tikz_Style &  style = tikz_wire_style(),
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Inserts all polygons from an Array<Polygon> into the plane.

Parameters
planeThe target TikZ plane.
polysAn array of polygons to insert.
styleThe style to apply to each polygon.
layerThe layer on which to draw the polygons.

Definition at line 483 of file tikzgeom_algorithms.H.

References put_in_plane(), and Aleph::Array< T >::size().

Referenced by Aleph::Tikz_Scene::add_polygons().

◆ put_portals()

void Aleph::put_portals ( Tikz_Plane &  plane,
const Array< FunnelPortal > &  portals,
const bool  skip_degenerate = true,
const Tikz_Style &  portal_style = tikz_wire_style("purple", true),
const int  portal_layer = Tikz_Plane::Layer_Default 
)
inline

Insert funnel portals as segment connectors.

Definition at line 1240 of file tikzgeom_algorithms.H.

References and, put_in_plane(), and Aleph::Array< T >::size().

Referenced by put_funnel_trace_step().

◆ put_power_diagram_result()

void Aleph::put_power_diagram_result ( Tikz_Plane &  plane,
const PowerDiagram::Result &  pd,
const bool  draw_cells = true,
const Tikz_Style &  cell_style = tikz_area_style("violet", "violet!18", 0.35),
const Tikz_Style &  edge_style = tikz_wire_style("violet"),
const Tikz_Style &  site_style = tikz_points_style("purple"),
const int  cell_layer = Tikz_Plane::Layer_Background,
const int  edge_layer = Tikz_Plane::Layer_Default,
const int  site_layer = Tikz_Plane::Layer_Foreground 
)
inline

Insert Power diagram structures (cells, edges, weighted sites).

Definition at line 786 of file tikzgeom_algorithms.H.

References cell(), Aleph::PowerDiagram::Result::cells, Aleph::PowerDiagram::Result::edges, polygon_from_vertices(), put_in_plane(), and Aleph::PowerDiagram::Result::sites.

◆ put_quadratic_bezier_in_plane()

void Aleph::put_quadratic_bezier_in_plane ( Tikz_Plane &  plane,
const Point &  p0,
const Point &  p1,
const Point &  p2,
const size_t  subdivisions = 64,
const Tikz_Style &  style = {},
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Approximate and insert a quadratic Bézier as an open polyline.

Definition at line 1526 of file tikzgeom.H.

Referenced by TEST().

◆ put_quadratic_bezier_native_in_plane()

void Aleph::put_quadratic_bezier_native_in_plane ( Tikz_Plane &  plane,
const Point &  p0,
const Point &  p1,
const Point &  p2,
const Tikz_Style &  style = {},
const int  layer = Tikz_Plane::Layer_Default 
)
inline

Insert a quadratic Bézier using native TikZ controls syntax.

Definition at line 1591 of file tikzgeom.H.

Referenced by TEST().

◆ put_range_tree_result()

void Aleph::put_range_tree_result ( Tikz_Plane &  plane,
const RangeTree2D::DebugSnapshot &  snapshot,
const bool  draw_points = true,
const Rectangle *  query_rect = nullptr,
const DynList< Point > *  query_hits = nullptr,
const Tikz_Style &  split_style = tikz_wire_style("purple"),
const Tikz_Style &  point_style = tikz_points_style("black"),
const Tikz_Style &  query_rect_style = tikz_wire_style("red", true),
const Tikz_Style &  query_hit_style = tikz_points_style("red"),
const int  split_layer = Tikz_Plane::Layer_Default,
const int  point_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw range-tree X-axis hierarchy and optional query highlights.

Definition at line 951 of file tikzgeom_algorithms.H.

References Aleph::Tikz_Style::draw_color, adaptive_huffman_demo::Snapshot::nodes, put_in_plane(), put_points(), and Aleph::detail::tikz_palette_color().

Referenced by visualize_range_tree(), and visualize_range_tree_query().

◆ put_regular_triangulation_result()

void Aleph::put_regular_triangulation_result ( Tikz_Plane &  plane,
const RegularTriangulationBowyerWatson::Result &  rt,
const Tikz_Style &  triangle_style = tikz_wire_style("blue!60"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black"),
const int  triangle_layer = Tikz_Plane::Layer_Default,
const int  site_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw regular (weighted Delaunay) triangulation output.

Definition at line 1584 of file tikzgeom_algorithms.H.

References put_in_plane(), Aleph::RegularTriangulationBowyerWatson::Result::sites, and Aleph::RegularTriangulationBowyerWatson::Result::triangles.

◆ put_rotating_calipers_result()

void Aleph::put_rotating_calipers_result ( Tikz_Plane &  plane,
const Polygon &  polygon,
const RotatingCalipersResult &  result,
const Tikz_Style &  polygon_style = tikz_wire_style("gray!55"),
const Tikz_Style &  diameter_style = tikz_path_style("red"),
const Tikz_Style &  width_style = tikz_path_style("blue"),
const Tikz_Style &  witness_style = tikz_points_style("orange!90!black"),
const int  polygon_layer = Tikz_Plane::Layer_Default,
const int  witness_layer = Tikz_Plane::Layer_Foreground 
)
inline

◆ put_rtree_result()

template<typename Snapshot >
void Aleph::put_rtree_result ( Tikz_Plane &  plane,
const Snapshot &  snapshot,
const Rectangle *  query_rect = nullptr,
const Array< Rectangle > *  query_hit_boxes = nullptr,
const Tikz_Style &  node_bbox_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  leaf_bbox_style = tikz_wire_style("blue!70"),
const Tikz_Style &  entry_bbox_style = tikz_wire_style("gray!55"),
const Tikz_Style &  query_rect_style = tikz_wire_style("red", true),
const Tikz_Style &  query_hit_style = tikz_wire_style("red"),
const int  node_layer = Tikz_Plane::Layer_Default,
const int  entry_layer = Tikz_Plane::Layer_Default,
const int  query_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw every node MBR (colored by depth) of an R-tree/R*-tree snapshot, plus its leaf entry boxes, an optional query rectangle, and its optional hit boxes.

Note
Hits are matched by bbox equality rather than by payload/index: RTree::DebugSnapshot deliberately omits Payload (see RTree::DebugSnapshot), so this stays usable for any payload type, including move-only ones.

Definition at line 1113 of file tikzgeom_algorithms.H.

References Aleph::Tikz_Style::draw_color, adaptive_huffman_demo::Snapshot::nodes, put_in_plane(), and Aleph::detail::tikz_palette_color().

Referenced by visualize_rtree(), and visualize_rtree_query().

◆ put_segment_arrangement_result()

void Aleph::put_segment_arrangement_result ( Tikz_Plane &  plane,
const SegmentArrangement::Result &  arrangement,
const bool  draw_faces = true,
const bool  draw_vertices = true,
const bool  draw_unbounded_face = false,
const Tikz_Style &  face_style = tikz_area_style("teal!60!black", "teal!12", 0.30),
const Tikz_Style &  edge_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  vertex_style = tikz_points_style("teal!70!black"),
const int  face_layer = Tikz_Plane::Layer_Background,
const int  edge_layer = Tikz_Plane::Layer_Default,
const int  vertex_layer = Tikz_Plane::Layer_Foreground,
const bool  color_faces_by_index = false 
)
inline

◆ put_simplification_result()

void Aleph::put_simplification_result ( Tikz_Plane &  plane,
const Polygon &  original,
const Polygon &  simplified,
const Tikz_Style &  original_style = tikz_wire_style("gray!50"),
const Tikz_Style &  simplified_style = tikz_bold_wire_style("blue!80"),
const bool  draw_vertices = true,
const Tikz_Style &  vertex_style = tikz_points_style("red") 
)
inline

Draw original and simplified polygons overlaid.

Parameters
planeTarget TikZ canvas.
originalThe original polygon (drawn faded).
simplifiedThe simplified polygon (drawn bold).
original_styleStyle for the original polygon.
simplified_styleStyle for the simplified polygon.
draw_verticesWhether to draw vertices of the simplified polygon.
vertex_styleStyle for simplified polygon vertices.

Definition at line 1915 of file tikzgeom_algorithms.H.

References put_in_plane(), and put_polygon_vertices().

Referenced by main().

◆ put_smoothing_result()

void Aleph::put_smoothing_result ( Tikz_Plane &  plane,
const Polygon &  original,
const Polygon &  smoothed,
const Tikz_Style &  original_style = tikz_wire_style("gray!50"),
const Tikz_Style &  smoothed_style = tikz_bold_wire_style("violet!80"),
const bool  draw_vertices = true,
const Tikz_Style &  vertex_style = tikz_points_style("red") 
)
inline

Draw original and smoothed polygons overlaid.

Parameters
planeTarget TikZ canvas.
originalThe original polygon (drawn faded).
smoothedThe smoothed polygon (drawn bold).
original_styleStyle for the original polygon.
smoothed_styleStyle for the smoothed polygon.
draw_verticesWhether to draw vertices of the smoothed polygon.
vertex_styleStyle for smoothed polygon vertices.

Definition at line 2027 of file tikzgeom_algorithms.H.

References put_in_plane(), and put_polygon_vertices().

Referenced by main(), and visualize_chaikin_smoothing().

◆ put_trapezoidal_map_result()

void Aleph::put_trapezoidal_map_result ( Tikz_Plane &  plane,
const TrapezoidalMapPointLocation::Result &  res,
const Tikz_Style &  segment_style = tikz_path_style("red"),
const Tikz_Style &  extension_style = tikz_wire_style("gray!60", true),
const bool  draw_trapezoids = true,
const double  trapezoid_opacity = 0.3,
const int  trap_layer = Tikz_Plane::Layer_Background,
const int  seg_layer = Tikz_Plane::Layer_Foreground,
const int  ext_layer = Tikz_Plane::Layer_Default 
)
inline

◆ put_tree_keys_in_array()

template<BinNodeLike Node, class Get_Key >
void Aleph::put_tree_keys_in_array ( Node *  root,
std::ostream &  out 
)
inline

Definition at line 1516 of file tpl_binNodeUtils.H.

References LLINK, out, RLINK, and root().

◆ put_visibility_polygon_result()

void Aleph::put_visibility_polygon_result ( Tikz_Plane &  plane,
const Polygon &  polygon,
const Point &  query_point,
const Polygon &  visibility_polygon,
const Tikz_Style &  polygon_style = tikz_wire_style("black"),
const Tikz_Style &  visibility_style = tikz_area_style("orange!90!black", "orange!25", 0.50),
const Tikz_Style &  query_style = tikz_points_style("red"),
const int  polygon_layer = Tikz_Plane::Layer_Default,
const int  visibility_layer = Tikz_Plane::Layer_Foreground 
)
inline

Draw visibility polygon with source polygon and query point.

Definition at line 1763 of file tikzgeom_algorithms.H.

References put_in_plane(), and Aleph::Polygon::size().

◆ put_voronoi_result()

template<typename VoronoiResult >
void Aleph::put_voronoi_result ( Tikz_Plane &  plane,
const VoronoiResult &  vor,
const bool  draw_cells = false,
const Tikz_Style &  cell_style = tikz_area_style("gray!50!black", "gray!15",                                                                       0.35),
const Tikz_Style &  edge_style = tikz_wire_style("black"),
const Tikz_Style &  unbounded_edge_style = tikz_wire_style("black", true, true),
const Tikz_Style &  site_style = tikz_points_style("red"),
const Geom_Number &  unbounded_ray_length = Geom_Number(50),
const int  cell_layer = Tikz_Plane::Layer_Background,
const int  edge_layer = Tikz_Plane::Layer_Default,
const int  site_layer = Tikz_Plane::Layer_Foreground 
)

Insert Voronoi diagram structures (cells, edges, sites).

Works with VoronoiDiagram::Result and VoronoiDiagramFromDelaunay::Result.

Definition at line 731 of file tikzgeom_algorithms.H.

References cell(), polygon_from_vertices(), put_in_plane(), put_points(), and ray_endpoint().

◆ pzip_all_n() [1/2]

template<typename Pred , typename... Containers>
bool Aleph::pzip_all_n ( Pred  pred,
const ParallelOptions &  options,
const Containers &...  cs 
)

◆ pzip_all_n() [2/2]

template<typename Pred , typename... Containers>
bool Aleph::pzip_all_n ( ThreadPool &  pool,
Pred  pred,
const Containers &...  cs 
)

Parallel all predicate over N zipped containers (variadic).

Tests if a predicate holds for all corresponding tuples of elements. Short-circuits when a false result is found.

Template Parameters
PredPredicate type: bool(const T1&, ..., const TN&)
ContainersContainer types (variadic).
Parameters
poolThread pool to use.
predPredicate to test.
csContainers to zip (2 or more).
Returns
true if pred returns true for all tuples.

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {2, 3, 4};
bool all_less = pzip_all_n(pool, [](int x, int y) {
return x < y;
}, a, b);
// all_less = true
bool pzip_all_n(ThreadPool &pool, Pred pred, const Containers &... cs)
Parallel all predicate over N zipped containers (variadic).

Definition at line 2900 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, pred, and pzip_all_n().

Referenced by example_variadic_zip(), pzip_all_n(), pzip_all_n(), TEST_F(), TEST_F(), and TEST_F().

◆ pzip_count_if_n() [1/2]

template<typename Pred , typename... Containers>
size_t Aleph::pzip_count_if_n ( Pred  pred,
const ParallelOptions &  options,
const Containers &...  cs 
)

◆ pzip_count_if_n() [2/2]

template<typename Pred , typename... Containers>
size_t Aleph::pzip_count_if_n ( ThreadPool &  pool,
Pred  pred,
const Containers &...  cs 
)

Parallel count over N zipped containers (variadic).

Counts tuples that satisfy a predicate.

Template Parameters
PredPredicate type: bool(const T1&, ..., const TN&)
ContainersContainer types (variadic).
Parameters
poolThread pool to use.
predPredicate to test.
csContainers to zip (2 or more).
Returns
Number of tuples satisfying pred.

Definition at line 3122 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, pred, and pzip_count_if_n().

Referenced by example_variadic_zip(), pzip_count_if_n(), pzip_count_if_n(), TEST_F(), TEST_F(), and TEST_F().

◆ pzip_exists_n() [1/2]

template<typename Pred , typename... Containers>
bool Aleph::pzip_exists_n ( Pred  pred,
const ParallelOptions &  options,
const Containers &...  cs 
)

◆ pzip_exists_n() [2/2]

template<typename Pred , typename... Containers>
bool Aleph::pzip_exists_n ( ThreadPool &  pool,
Pred  pred,
const Containers &...  cs 
)

Parallel exists predicate over N zipped containers (variadic).

Tests if a predicate holds for any corresponding tuple of elements. Short-circuits when a true result is found.

Template Parameters
PredPredicate type: bool(const T1&, ..., const TN&)
ContainersContainer types (variadic).
Parameters
poolThread pool to use.
predPredicate to test.
csContainers to zip (2 or more).
Returns
true if pred returns true for any tuple.

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {2, 2, 4};
bool any_equal = pzip_exists_n(pool, [](int x, int y) {
return x == y;
}, a, b);
// any_equal = true (2 == 2)
bool pzip_exists_n(ThreadPool &pool, Pred pred, const Containers &... cs)
Parallel exists predicate over N zipped containers (variadic).

Definition at line 3018 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, pred, and pzip_exists_n().

Referenced by pzip_exists_n(), pzip_exists_n(), TEST_F(), TEST_F(), and TEST_F().

◆ pzip_foldl() [1/2]

template<typename Container1 , typename Container2 , typename T , typename Op >
T Aleph::pzip_foldl ( const Container1 &  c1,
const Container2 &  c2,
T  init,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 1922 of file ah-parallel.H.

References pzip_foldl().

◆ pzip_foldl() [2/2]

template<typename Container1 , typename Container2 , typename T , typename Op >
T Aleph::pzip_foldl ( ThreadPool &  pool,
const Container1 &  c1,
const Container2 &  c2,
T  init,
Op  op,
size_t  chunk_size = 0 
)

Parallel zip + fold.

Reduces corresponding elements of two containers using a ternary function.

Parameters
poolThread pool to use.
c1First container.
c2Second container.
initInitial value.
opTernary function: R op(R acc, const T1&, const T2&).
chunk_sizeElements per chunk (0 = auto).
Returns
Reduced value.
Warning
The operation must be associative for correct parallel results.

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {4, 5, 6};
int dot_product = pzip_foldl(pool, a, b, 0,
[](int acc, int x, int y) { return acc + x * y; });
// dot_product = 32
T pzip_foldl(ThreadPool &pool, const Container1 &c1, const Container2 &c2, T init, Op op, size_t chunk_size=0)
Parallel zip + fold.

Definition at line 1911 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, and pzip_foldl().

Referenced by example_parallel_zip(), pzip_foldl(), pzip_foldl(), and TEST_F().

◆ pzip_foldl_n() [1/2]

template<typename T , typename Op , typename Combiner , typename... Containers>
T Aleph::pzip_foldl_n ( T  init,
Op  op,
Combiner  combiner,
const ParallelOptions &  options,
const Containers &...  cs 
)

◆ pzip_foldl_n() [2/2]

template<typename T , typename Op , typename Combiner , typename... Containers>
T Aleph::pzip_foldl_n ( ThreadPool &  pool,
T  init,
Op  op,
Combiner  combiner,
const Containers &...  cs 
)

Parallel fold/reduce over N zipped containers (variadic).

Reduces corresponding elements from multiple containers using a function, processing in parallel. Requires a binary combiner for merging partial results.

Template Parameters
TAccumulator type.
OpOperation type: T(T acc, const T1&, ..., const TN&)
CombinerBinary combiner: T(T, T)
ContainersContainer types (variadic).
Parameters
poolThread pool to use.
initInitial accumulator value.
opFunction: T op(T acc, const T1&, ..., const TN&).
combinerBinary function to combine partial results: T(T, T).
csContainers to zip (2 or more).
Returns
Reduced value.
Warning
Both op and combiner must be associative for correct parallel results.

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {4, 5, 6};
// Dot product: accumulate with x*y, combine partial sums with +
int dot = pzip_foldl_n(pool, 0,
[](int acc, int x, int y) { return acc + x * y; },
std::plus<int>(),
a, b);
// dot = 1*4 + 2*5 + 3*6 = 32
T pzip_foldl_n(ThreadPool &pool, T init, Op op, Combiner combiner, const Containers &... cs)
Parallel fold/reduce over N zipped containers (variadic).
Note
Use pzip_foldl for 2 containers, pzip_foldl_n for 3+.

Definition at line 2767 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, and pzip_foldl_n().

Referenced by pzip_foldl_n(), pzip_foldl_n(), TEST_F(), and TEST_F().

◆ pzip_for_each() [1/2]

template<typename Container1 , typename Container2 , typename Op >
void Aleph::pzip_for_each ( const Container1 &  c1,
const Container2 &  c2,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 1711 of file ah-parallel.H.

References pzip_for_each().

◆ pzip_for_each() [2/2]

template<typename Container1 , typename Container2 , typename Op >
void Aleph::pzip_for_each ( ThreadPool &  pool,
const Container1 &  c1,
const Container2 &  c2,
Op  op,
size_t  chunk_size = 0 
)

Parallel zip + for_each.

Applies a function to corresponding elements of two containers in parallel.

Parameters
poolThread pool to use.
c1First container.
c2Second container.
opFunction: void op(const T1&, const T2&).
chunk_sizeElements per chunk (0 = auto).
Note
Stops at the shorter container.

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {4, 5, 6};
std::atomic<int> sum{0};
pzip_for_each(pool, a, b, [&sum](int x, int y) {
sum += x * y;
});
// sum = 1*4 + 2*5 + 3*6 = 32
void pzip_for_each(ThreadPool &pool, const Container1 &c1, const Container2 &c2, Op op, size_t chunk_size=0)
Parallel zip + for_each.

Definition at line 1701 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, and pzip_for_each().

Referenced by example_parallel_zip(), pzip_for_each(), pzip_for_each(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pzip_for_each_n() [1/2]

template<typename Op , typename... Containers>
void Aleph::pzip_for_each_n ( Op  op,
const ParallelOptions &  options,
const Containers &...  cs 
)

◆ pzip_for_each_n() [2/2]

template<typename Op , typename... Containers>
void Aleph::pzip_for_each_n ( ThreadPool &  pool,
Op  op,
const Containers &...  cs 
)

Parallel for_each over N zipped containers (variadic).

Applies a function to corresponding elements from multiple containers in parallel. Stops at the shortest container.

Template Parameters
OpOperation type: void(const T1&, const T2&, ..., const TN&)
ContainersContainer types (variadic).
Parameters
poolThread pool to use.
opFunction to apply to each tuple of elements.
csContainers to zip (2 or more).

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {4, 5, 6};
std::vector<int> c = {7, 8, 9};
std::atomic<int> sum{0};
pzip_for_each_n(pool, [&sum](int x, int y, int z) {
sum += x + y + z;
}, a, b, c);
// sum = (1+4+7) + (2+5+8) + (3+6+9) = 45
void pzip_for_each_n(ThreadPool &pool, Op op, const Containers &... cs)
Parallel for_each over N zipped containers (variadic).
Note
The operation receives individual elements, not a tuple. Use std::apply if you need tuple access.
Use pzip_for_each for 2 containers, pzip_for_each_n for 3+.

Definition at line 2532 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, and pzip_for_each_n().

Referenced by pzip_for_each_n(), pzip_for_each_n(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pzip_maps() [1/2]

template<typename Container1 , typename Container2 , typename Op >
auto Aleph::pzip_maps ( const Container1 &  c1,
const Container2 &  c2,
Op  op,
const ParallelOptions &  options = {} 
)

Definition at line 1807 of file ah-parallel.H.

References pzip_maps().

◆ pzip_maps() [2/2]

template<typename Container1 , typename Container2 , typename Op >
auto Aleph::pzip_maps ( ThreadPool &  pool,
const Container1 &  c1,
const Container2 &  c2,
Op  op,
size_t  chunk_size = 0 
)

Parallel zip + map.

Maps corresponding elements of two containers using a binary function.

Parameters
poolThread pool to use.
c1First container.
c2Second container.
opFunction: R op(const T1&, const T2&).
chunk_sizeElements per chunk (0 = auto).
Returns
Vector of results.

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {4, 5, 6};
auto products = pzip_maps(pool, a, b, [](int x, int y) { return x * y; });
// products = {4, 10, 18}
auto pzip_maps(ThreadPool &pool, const Container1 &c1, const Container2 &c2, Op op, size_t chunk_size=0)
Parallel zip + map.

Definition at line 1797 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, and pzip_maps().

Referenced by example_parallel_zip(), pzip_maps(), pzip_maps(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ pzip_maps_n() [1/2]

template<typename Op , typename... Containers>
auto Aleph::pzip_maps_n ( Op  op,
const ParallelOptions &  options,
const Containers &...  cs 
)

◆ pzip_maps_n() [2/2]

template<typename Op , typename... Containers>
auto Aleph::pzip_maps_n ( ThreadPool &  pool,
Op  op,
const Containers &...  cs 
)

Parallel map over N zipped containers (variadic).

Maps corresponding elements from multiple containers using a function, processing in parallel.

Template Parameters
OpOperation type: R(const T1&, const T2&, ..., const TN&)
ContainersContainer types (variadic).
Parameters
poolThread pool to use.
opFunction to apply to each tuple of elements.
csContainers to zip (2 or more).
Returns
std::vector<R> with mapped results.

Example

std::vector<int> a = {1, 2, 3};
std::vector<int> b = {4, 5, 6};
std::vector<int> c = {7, 8, 9};
auto sums = pzip_maps_n(pool, [](int x, int y, int z) {
return x + y + z;
}, a, b, c);
// sums = {12, 15, 18}
auto pzip_maps_n(ThreadPool &pool, Op op, const Containers &... cs)
Parallel map over N zipped containers (variadic).
Note
Use pzip_maps for 2 containers, pzip_maps_n for 3+.

Definition at line 2638 of file ah-parallel.H.

References options, Aleph::ParallelOptions::pool, and pzip_maps_n().

Referenced by example_variadic_zip(), pzip_maps_n(), pzip_maps_n(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ quartiles()

template<typename Container >
auto Aleph::quartiles ( const Container &  data) -> std::tuple<std::decay_t<decltype(*std::begin(data))>, std::decay_t<decltype(*std::begin(data))>, std::decay_t<decltype(*std::begin(data))>>

Compute quartiles (Q1, Q2, Q3).

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Tuple of (Q1, Q2/median, Q3)

Definition at line 406 of file stat_utils.H.

References percentile(), and quartiles().

Referenced by quartiles(), TEST(), and TEST().

◆ quicksort() [1/6]

template<class Compare >
void Aleph::quicksort ( Dlink &  list,
const Compare &  cmp = Compare() 
)

Sorts a linked list by the quicksort method.

quicksort(list) sorts a list according to the quicksort method according to comparison criteria Compare.

This method has an expected performance of \(O(n \; \lg n)\) and is considered the fastest ordering method.

Parameters
[in,out]listthe list to sort.
cmpComparison functor defining "less than" relationship.

Definition at line 2523 of file tpl_sort_utils.H.

References Aleph::Dlink::append(), cmp(), Aleph::Dlink::concat_list(), Aleph::Dlink::is_empty(), Aleph::Dlink::is_unitarian_or_empty(), and Aleph::Dlink::remove_next().

◆ quicksort() [2/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort ( Dnode< T > &  list,
const Compare &  cmp = Compare() 
)

Sorts a list by the quicksort method.

quicksort(list) sorts a list using the method quicksort according to comparison criteria Compare.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.

This method has an expected performance of \(O(n \; \lg n)\) and is considered the fastest ordering method.

This primitive can be used for lists of type Dlist and DynDlist.

Parameters
[in,out]listthe list to sort.
cmpComparison functor defining "less than" relationship.
See also
Dnode Dlist DynDlist

Definition at line 2567 of file tpl_sort_utils.H.

References cmp().

◆ quicksort() [3/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Sorts a dynamic array by the quicksort method without recursion.

quicksort(a) sorts the dynamic array according to the method quicksort according to comparison criteria Compare.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.

This method has an expected performance of \(O(n \; \lg n)\) and is considered the fastest ordering method.

This version of quicksort takes up maximum space of \(O(\lg n)\).

The pivot is the median of the first, the middle and the last items of each range, so that a sorted or a reversed array splits in halves.

Quicksort is a probabilistic method. In a very bad case -very bad luck- can be degraded to \(O(n^2)\). To alleviate, to the extent of luck, the bad cases, use quicksort_insertion() which runs heuristics to alleviate the bad cases and invoke the insert method to small array partitions.

Parameters
[in,out]athe array to be ordered.
cmpcomparison object.
See also
selection_sort() insertion_sort() heapsort()
quicksort_rec_min() quicksort_insertion() quicksort_rec()

Explicit partition stack, sized to introsort's worst-case depth.

Definition at line 3965 of file tpl_sort_utils.H.

References cmp(), introsort_depth_limit(), Aleph::FixedStack< T >::is_empty(), l, Aleph::sort_utils_detail::median_of_three_to_last(), partition(), Aleph::FixedStack< T >::pop(), push2(), r, and Aleph::DynArray< T >::size().

◆ quicksort() [4/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort ( DynList< T > &  list,
const Compare &  cmp = Compare() 
)

Sort a DynList using the quicksort method.

Parameters
listThe list to sort.
cmpComparison functor for the data type T.

Definition at line 2605 of file tpl_sort_utils.H.

References cmp().

◆ quicksort() [5/6]

template<typename T , class Compare >
void Aleph::quicksort ( HTList &  list,
const Compare &  cmp = Compare() 
)

Sort an HTList using the quicksort method.

Parameters
listThe list to sort.
cmpComparison functor for the data type T.

Definition at line 2577 of file tpl_sort_utils.H.

References Aleph::HTList::append(), cmp(), Aleph::HTList::concat_list(), Aleph::HTList::is_empty(), Aleph::HTList::is_unitarian_or_empty(), and Aleph::HTList::remove_first_ne().

◆ quicksort() [6/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Sort an array using iterative quicksort with optimizations.

This is the main quicksort implementation, featuring:

  • Iterative (stack-based) instead of recursive to control stack depth
  • Median-of-three pivot selection to avoid worst-case on sorted data
  • Falls back to insertion sort for small partitions (< Quicksort_Threshold)
  • Always processes smaller partition first for O(log n) stack space

Algorithm (Hoare partition scheme)

  1. Select pivot using median-of-three
  2. Partition: elements < pivot go left, >= pivot go right
  3. Push larger partition onto stack
  4. Process smaller partition immediately (tail recursion elimination)
  5. Repeat until stack is empty

Characteristics

  • Time complexity: O(n log n) expected, O(n²) worst case (rare)
  • Space complexity: O(log n) for the stack
  • Stability: Not stable
  • In-place: Yes

When to Use

  • General-purpose sorting (fastest in practice for most data)
  • When stability is not required
  • In-memory sorting of moderate to large arrays
Template Parameters
TElement type (must be swappable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array to sort.
[in]lLeft index (inclusive) of the range to sort.
[in]rRight index (inclusive) of the range to sort.
cmpComparison functor.
See also
quicksort_rec(), quicksort_insertion(), mergesort(), heapsort()

Explicit partition stack, sized to introsort's worst-case depth.

Definition at line 1834 of file tpl_sort_utils.H.

References cmp(), diff(), insertion_sort(), introsort_depth_limit(), l, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), Quicksort_Threshold, r, and Aleph::FixedStack< T >::size().

Referenced by benchmark_list_algorithms(), Aleph::Matrix_Graph< GT, SA >::copy(), Aleph::Map_Matrix_Graph< GT, SA >::copy_list_graph(), Aleph::Bit_Mat_Graph< GT, SA >::copy_list_graph(), Aleph::Ady_Mat< GT, __Entry_Type, SA >::copy_nodes(), main(), and main().

◆ quicksort_insertion()

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort_insertion ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Sorts an array by the improved quicksort method.

quicksort_insertion(a,l,r) sorts the array a among the indexes l and r according to the quicksort method according to criteria comparison Compare.

The procedure combines various techniques to accelerate the ordering and at the same time avoid degradation due to bad cases.

Bad cases are treated by pivot selection consisting of the median between l, r and the center of the partition.

To ensure a maximum battery consumption of \(O(\lg n)\), the method always proceeds recursively to sort the partition smaller.

When the partition reaches a size less than or equal to the sim_id constant Aleph::Insertion_Threshold, then The partition is sorted by the insert method, which It is faster than quicksort for small sizes.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.

This method has an expected performance of \(O(n \; \lg n)\) and is considered the fastest ordering method.

Parameters
[in,out]athe array to sort.
[in]llower index.
[in]rtop index.
cmpcomparison object.
See also
insertion_sort() mergesort() heapsort()
quicksort_rec_min() quicksort_insertion() quicksort()

Definition at line 2649 of file tpl_sort_utils.H.

References and, cmp(), Insertion_Threshold, l, and r.

◆ quicksort_no_tail()

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort_no_tail ( T *  a,
long  l,
long  r,
const Compare &  cmp = Compare() 
)
inline

Quicksort implementation with tail-recursion optimization.

Recursively sorts the smaller partition and iterates on the larger one to guarantee O(log n) stack depth.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]aPointer to the array.
[in]lLeft index.
[in]rRight index.
[in]cmpComparison functor.

Definition at line 1716 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ quicksort_op()

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort_op ( C< T > &  a,
const Compare &  cmp = Compare(),
const size_t  threshold = Quicksort_Threshold 
)
inline

Optimized quicksort for containers using operator().

This is the preferred quicksort implementation for Aleph containers like DynArray and Array. It uses the operator() access method instead of pointer arithmetic, allowing compatibility with various container types.

Optimizations

  • Iterative implementation (no recursion overhead)
  • Median-of-three pivot selection
  • Falls back to insertion sort for small partitions
  • Processes smaller partition first for O(log n) stack space

Time complexity: O(n log n) expected Space complexity: O(log n) for the stack

Template Parameters
CContainer template (must support operator() and size()).
TElement type.
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aContainer to sort.
cmpComparison functor.
thresholdSize below which insertion sort is used.
See also
quicksort(), partition_op(), insertion_sort()

Definition at line 5119 of file tpl_sort_utils.H.

References cmp(), insertion_sort(), introsort_depth_limit(), Aleph::FixedStack< T >::is_empty(), l, Aleph::FixedStack< T >::pop(), push2(), and r.

Referenced by benchmark_array_algorithms(), Aleph::RangeTree2D::build(), Aleph::Bounded_Cycle_Index< GT >::build(), build_index(), build_index_ptr(), build_index_ptr(), Aleph::ShortestPathInPolygon::build_tris(), Aleph::KDTreePointSearch::debug_snapshot(), Aleph::MonotonePolygonTriangulation::decompose_to_monotone_faces(), demonstrate_complexity(), Aleph::Tikz_Plane::draw(), Aleph::GeomTriangleAdjacencyUtils::for_each_sorted_edge_group(), hull_signature(), main(), Aleph::ConstrainedDelaunayTriangulation::map_constraints(), Aleph::ConstrainedDelaunayTriangulation::merge_and_deduplicate(), Aleph::HalfPlaneIntersection::operator()(), Aleph::SweepLineSegmentIntersection::operator()(), Aleph::SegmentArrangement::operator()(), Aleph::ClosestPairDivideAndConquer::operator()(), Aleph::DelaunayTriangulationRandomizedIncremental::operator()(), Aleph::GrahamScanConvexHull::operator()(), Aleph::AlphaShape::operator()(), Aleph::VisibilityPolygon::operator()(), sorted_hull_vertices(), Aleph::AndrewMonotonicChainConvexHull::sorted_unique_points(), Aleph::GrahamScanConvexHull::sorted_unique_points(), Aleph::detail::spp_build_tris(), stable_build_index(), stable_build_index_ptr(), stable_build_index_ptr(), TEST(), test_hash_table(), Aleph::MonotonePolygonTriangulation::triangulate_monotone(), Aleph::KDTreePointSearch::unique_points(), Aleph::DelaunayTriangulationBowyerWatson::unique_points(), and Aleph::RegularTriangulationBowyerWatson::unique_sites().

◆ quicksort_rec() [1/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort_rec ( DynArray< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Recursively sort a dynamic array using quicksort.

The pivot is the median of the first, the middle and the last items of each range.

Parameters
aThe dynamic array.
lLeft index.
rRight index.
cmpComparison functor.

Definition at line 3897 of file tpl_sort_utils.H.

References cmp(), l, Aleph::sort_utils_detail::median_of_three_to_last(), partition(), and r.

◆ quicksort_rec() [2/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort_rec ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Recursively sort an array using quicksort.

This method has an expected performance of \(O(n \; \lg n)\) and is considered the fastest ordering method.

This version of quicksort can take up \(O(n)\) space. Use quicksort_rec_min() if you want to guarantee consumption maximum space of \(O(\lg n)\).

Parameters
aPointer to the array to sort.
lLeft index (inclusive).
rRight index (inclusive).
cmpComparison functor defining "less than" relationship.
See also
selection_sort() insertion_sort() mergesort() heapsort()
quicksort_rec_min() quicksort_insertion() quicksort()

Definition at line 1691 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ quicksort_rec_min()

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::quicksort_rec_min ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Sorts an array according to the quicksort method with minimum space consumption.

Purely recursive quicksort can consume proportional stack to the size of the arrangement to be ordered. To avoid this problem, at the expense of a slight execution cost, quicksort_rec_min() always sorts the smallest partition first. For others, The same considerations as for quicksort_rec() apply.

Parameters
[in,out]athe array to sort.
[in]linitial index by which to sort.
[in]rfinal index by which to sort.
cmpcomparison object.
See also
quicksort_rec() quicksort() quicksort_insertion()

Definition at line 1755 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ rabin_karp_search()

Array< size_t > Aleph::rabin_karp_search ( const std::string_view  text,
const std::string_view  pattern,
const uint64_t  base = 911382323ull 
)
inline

Find all occurrences using Rabin-Karp with rolling hash.

Hash collisions are filtered by exact character-by-character verification, so returned matches are exact.

Parameters
[in]textText where matches are searched.
[in]patternPattern to find.
[in]baseRolling-hash base.
Returns
Array with all match start indices (0-based).
Exceptions
None.
Note
If pattern is empty, returns all positions in [0, text.size()].
The rolling hash uses implicit modulo via uint64_t overflow (no explicit prime modulus). This is sufficient for general use but may produce more collisions on adversarial inputs.
Complexity
Expected O(n + m), worst-case O(nm) due to adversarial collisions.

Definition at line 371 of file String_Search.H.

References Aleph::string_search_detail::all_match_positions(), and, Aleph::Array< T >::append(), Aleph::string_search_detail::equals_at(), m, OhashCommon< HashTbl, Key >::size(), and Aleph::Array< T >::size().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ radix_sort() [1/6]

template<typename T >
requires RadixSortable<T>
void Aleph::radix_sort ( Array< T > &  a)

LSD radix sort for integral Array values.

Sorts in ascending order. Signed integers are supported by applying a monotone bit transform on the sign bit.

Template Parameters
TValue type.
Parameters
[in,out]aThe Array to sort.
Exceptions
std::domain_errorif an internal domain error occurs.
std::runtime_errorif an internal runtime error occurs.
Complexity
O(w*n) time and O(n + 256) extra space, where w = sizeof(T).

Delegate to the shared LSD bucket-distribution implementation.

Definition at line 5989 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::radix_sort_impl().

◆ radix_sort() [2/6]

template<typename T >
requires RadixSortable<T>
void Aleph::radix_sort ( DynArray< T > &  a)

LSD radix sort for integral DynArray values.

How Radix Sort Works: When sorting large numbers, the range k in Counting Sort would consume an unreasonable amount of memory. Radix Sort solves this by sorting numbers "digit by digit" (or more precisely, byte by byte) in multiple passes.

The core idea behind this LSD (Least Significant Digit) Radix Sort is:

  1. Treat the integers as sequences of bytes.
  2. First, sort the entire array by looking only at the least significant byte (the rightmost 8 bits).
  3. Then, sort the array again by looking at the next byte to the left, and so on.
  4. After sorting by the most significant byte, the array is fully sorted.

To sort by each individual byte, the algorithm uses Counting Sort internally (with 256 buckets). Because Counting Sort is stable, sorting by a more significant byte does not scramble the relative order previously established by the less significant bytes. Signed integers are fully supported by applying a monotone bit transform on the sign bit before extracting the keys.

Template Parameters
TValue type.
Parameters
[in,out]aThe DynArray to sort.
Exceptions
std::domain_errorif an internal domain error occurs.
std::runtime_errorif an internal runtime error occurs.
Complexity
O(w*n) time and O(n + 256) extra space, where w = sizeof(T).

Delegate to the shared LSD bucket-distribution implementation.

Definition at line 5967 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::radix_sort_impl().

Referenced by radix_sort().

◆ radix_sort() [3/6]

template<typename T >
requires RadixSortable<T>
void Aleph::radix_sort ( DynDlist< T > &  list)

LSD radix sort for integral DynDlist values.

This overload performs stable bucket distribution directly on list nodes.

Template Parameters
TValue type.
Parameters
[in,out]listThe DynDlist to sort.
Exceptions
std::domain_errorif an internal domain error occurs.
std::runtime_errorif an internal runtime error occurs.

Delegate to the shared LSD bucket-distribution implementation.

Definition at line 6025 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::radix_sort_impl().

◆ radix_sort() [4/6]

template<typename T >
requires RadixSortable<T>
void Aleph::radix_sort ( DynList< T > &  list)

LSD radix sort for integral DynList values.

This overload performs stable bucket distribution directly on list nodes.

Template Parameters
TValue type.
Parameters
[in,out]listThe DynList to sort.
Exceptions
std::domain_errorif an internal domain error occurs.
std::runtime_errorif an internal runtime error occurs.

Delegate to the shared LSD bucket-distribution implementation.

Definition at line 6007 of file tpl_sort_utils.H.

References Aleph::sort_utils_detail::radix_sort_impl().

◆ radix_sort() [5/6]

template<typename T >
requires RadixSortable<T>
void Aleph::radix_sort ( T *  a,
const size_t  n 
)

LSD radix sort for raw integral arrays.

Template Parameters
TValue type.
Parameters
[in,out]aPointer to the first element.
[in]nNumber of elements.
Exceptions
std::domain_errorif an internal domain error occurs.
std::invalid_argumentif a is null and n > 0.
Complexity
O(w*n) time and O(n + 256) extra space, where w = sizeof(T).

Delegate to the shared LSD bucket-distribution implementation.

Definition at line 6045 of file tpl_sort_utils.H.

References ah_invalid_argument_if, and, and Aleph::sort_utils_detail::radix_sort_impl().

◆ radix_sort() [6/6]

template<typename T , size_t N>
requires RadixSortable<T>
void Aleph::radix_sort ( T(&)  a[N])

LSD radix sort for fixed-size integral C arrays.

Template Parameters
TValue type.
NArray size.
Parameters
[in,out]aThe fixed-size array to sort.
Exceptions
std::domain_errorif an internal domain error occurs.
std::runtime_errorif an internal runtime error occurs.

Definition at line 6064 of file tpl_sort_utils.H.

References radix_sort().

◆ random_preflow_maximum_flow() [1/2]

template<class Net >
Net::Flow_Type Aleph::random_preflow_maximum_flow ( Net &  net)

Preflow-push maximum flow using a random active-node queue.

The order of the active nodes takes its seed from the time, so that two runs may push the flow along other arcs; the overload with a seed repeats them.

Parameters
[in,out]netFlow network (must have a single source and sink).
Returns
Maximized flow value.

Definition at line 2738 of file tpl_net.H.

Referenced by Aleph::Random_Preflow_Maximum_Flow< Net >::operator()(), TEST(), and TEST().

◆ random_preflow_maximum_flow() [2/2]

template<class Net >
Net::Flow_Type Aleph::random_preflow_maximum_flow ( Net &  net,
const unsigned long  seed 
)

Preflow-push maximum flow using a random active-node queue whose order takes the seed seed.

Two runs on equal networks with the same seed push the same flows.

Parameters
[in,out]netFlow network (must have a single source and sink).
[in]seedthe seed of the order of the active nodes.
Returns
Maximized flow value.

Definition at line 2756 of file tpl_net.H.

References seed, and Aleph::Random_Set< T >::set_seed().

◆ random_search() [1/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Dnode< T > * Aleph::random_search ( Dlink &  list,
const T &  x,
const Compare &  cmp = Compare() 
)

Random search for an element in a Dnode<T> list.

random_search(list,x) uses the partition algorithm quicksort to find element x in the list.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.

The procedure has an expected complexity of \(O(n \; \lg n)\), which is greater than mere search sequential, but with the addition that after the search the list is partially ordered.

A specialization uses the "less than" relationship as comparison criterion and saves writing that class.

Parameters
[in,out]listlist in which the search is performed; is partially modified after the search.
[in]xelement to search for.
cmpComparison functor defining "less than" relationship.
Returns
pointer to the node containing the value x if it is found within the list; nullptr otherwise.
See also
dlink_random_search

Definition at line 2871 of file tpl_sort_utils.H.

References cmp().

◆ random_search() [2/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::random_search ( DynArray< T > &  a,
const T &  x,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Random search for an element in a dynamic array.

Parameters
aThe dynamic array to search.
xThe element to search for.
lLeft index (inclusive).
rRight index (inclusive).
cmpComparison functor.
Returns
Index of the element if found, Not_Found otherwise.

Definition at line 2760 of file tpl_sort_utils.H.

References cmp(), l, Not_Found, partition(), and r.

◆ random_search() [3/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * Aleph::random_search ( DynDlist< T > &  list,
const T &  x,
const Compare &  cmp = Compare() 
)
inline

Random search for an element in a dynamic list.

random_search(list,x) uses the partition algorithm quicksort to find element x in the dynamic list list.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.

The procedure has an expected complexity of \(O(n \; \lg n)\), which is greater than mere search sequential, but with the addition that after the search the list is partially ordered.

A specialization uses the "less than" relationship as a comparison criterion and saves writing that class.

Parameters
[in,out]listdynamic list in which to perform the search; is partially modified after the search.
[in]xelement to search for.
cmpcomparison object.
Returns
pointer x inside the list if it is found within it; nullptr otherwise.
See also
DynDlist

Definition at line 2906 of file tpl_sort_utils.H.

References cmp(), and Aleph::Dnode< T >::get_data().

◆ random_search() [4/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::random_search ( T *  a,
const T &  x,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Random search for an element in an array.

random_search(a,x,l,r) uses the partition algorithm quicksort to find element x in the array a between the limits l and r.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.
Warning
The expected complexity is \(O(n \; \lg n)\) for a single search, which is WORSE than sequential search \(O(n)\). This function should only be used when you plan to perform multiple searches on the same array, as each search partially sorts the array. After several searches, the array becomes more ordered and subsequent searches become faster.

For a single search, use sequential_search() instead. For searches on an already sorted array, use binary_search().

Parameters
[in,out]aarray to search for; is partially modified after the search.
[in]xelement to search for.
[in]llower index of the start of the search.
[in]rtop index of search term.
cmpComparison functor defining "less than" relationship.
Returns
index of an array entry containing the value x if it is within the array; Not_Found (usually -1) otherwise.
See also
sequential_search() binary_search_rec()

Definition at line 2735 of file tpl_sort_utils.H.

References cmp(), l, Not_Found, and r.

Referenced by main().

◆ random_select() [1/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & Aleph::random_select ( Array< T > &  a,
const long  i,
const Compare &  cmp = Compare() 
)

Select the i-th smallest element in an Array.

Parameters
aThe array.
iPosition to select.
cmpComparison functor.
Returns
Reference to the selected element.
Exceptions
out_of_rangeif index is invalid.

Definition at line 3268 of file tpl_sort_utils.H.

References ah_out_of_range_error_if, cmp(), and Aleph::Array< T >::size().

◆ random_select() [2/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Dnode< T > * Aleph::random_select ( Dlink &  list,
const size_t  i,
const Compare &  cmp = Compare() 
)

Random selection of the ith element from a list based on Dlink.

random_select(list,i) returns the ith smallest element content in the list.

The routine uses the quicksort partition to search for position i in time \(O(n \; \lg n)\), which It is a substantially better time than the search sequential ( \(O(n^2)\)).

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.
Parameters
[in,out]listlist where the ith element will be searched. The list is left semi-ordered through successive partitions that have been made.
[in]iposition to be accessed.
cmpcomparison object.
Returns
pointer to Dlink corresponding to position i inside of the list; nullptr if i is out of range.

Definition at line 3439 of file tpl_sort_utils.H.

References cmp().

◆ random_select() [3/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & Aleph::random_select ( DynArray< T > &  a,
const long  i,
const Compare &  cmp = Compare() 
)

Select the i-th smallest element in a DynArray.

Parameters
aThe dynamic array.
iPosition to select.
cmpComparison functor.
Returns
Reference to the selected element.
Exceptions
out_of_rangeif index is invalid.

Definition at line 3249 of file tpl_sort_utils.H.

References ah_out_of_range_error_if, cmp(), and Aleph::DynArray< T >::size().

Referenced by main().

◆ random_select() [4/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * Aleph::random_select ( DynDlist< T > &  list,
const size_t  i,
const Compare &  cmp = Compare() 
)

Random selection of the ith element from a dynamic list.

random_select(list,i) returns the ith smallest element content in the dynamic list.

The routine uses the quicksort partition to search for position i in time \(O(n \; \lg n)\), which It is a substantially better time than the search sequential ( \(O(n^2)\)).

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.
Parameters
[in,out]listdynamic list where the ith element. The list is semi-sorted through of the successive partitions that have been made.
[in]iposition to be accessed.
cmpcomparison object.
Returns
pointer to the corresponding dynamic list element to position i within the list; nullptr if i is out of range.

Definition at line 3470 of file tpl_sort_utils.H.

References cmp().

◆ random_select() [5/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & Aleph::random_select ( T *  a,
const long  i,
const long  n,
Compare &&  cmp = Compare() 
)

Select the k-th smallest element in an array (convenience overload).

Parameters
aPointer to the array.
iPosition to select.
nNumber of elements.
cmpComparison functor.
Returns
Reference to the selected element.

Definition at line 3337 of file tpl_sort_utils.H.

References cmp().

◆ random_select() [6/6]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T & Aleph::random_select ( T *  a,
const long  i,
const long  n,
const Compare &  cmp = Compare() 
)

Select the k-th smallest element in an array (Quickselect).

Finds the k-th smallest element without fully sorting the array. This is a selection algorithm based on quicksort's partition scheme.

Algorithm (Quickselect / Hoare's selection)

  1. Partition the array around a pivot
  2. If pivot is at position k, we're done
  3. If k < pivot position, recurse on left partition
  4. If k > pivot position, recurse on right partition

Characteristics

  • Time complexity: O(n) expected, O(n²) worst case
  • Space complexity: O(log n) for recursion
  • Side effect: Partially sorts the array

Use Cases

  • Finding the median: random_select(a, n/2, n)
  • Finding k smallest/largest elements
  • Computing percentiles/quartiles
  • Order statistics
Template Parameters
TElement type (must be swappable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aArray to search (will be partially reordered).
[in]iPosition to select (0-indexed, so 0 = minimum).
[in]nNumber of elements in the array.
cmpComparison functor.
Returns
Reference to the i-th smallest element.
Exceptions
out_of_rangeif i >= n.
Note
After calling, elements at indices < i are not necessarily sorted, but are all <= the returned element.
See also
partition()

Definition at line 3320 of file tpl_sort_utils.H.

References ah_invalid_argument_if, ah_out_of_range_error_if, and, and cmp().

◆ range() [1/2]

template<typename T = int, template< typename > class Container = DynList>
Container< T > Aleph::range ( const T  n)

Return a range 0, 1, ... n - 1.

Parameters
[in]nsize of range.
Returns
a container with the range.

Definition at line 398 of file ahFunctional.H.

◆ range() [2/2]

template<typename T = int, template< typename > class Container = DynList>
Container< T > Aleph::range ( const T  start,
const T  end,
const T  step = 1 
)
inline

◆ range_to_DynList()

template<typename Iterator >
auto Aleph::range_to_DynList ( Iterator  begin,
Iterator  end 
) -> DynList<std::decay_t<decltype(*begin)>>
inline

Convert an iterator range to a DynList.

Template Parameters
IteratorIterator type (must be dereferenceable).
Parameters
beginStart iterator.
endEnd iterator.
Returns
DynList containing copies of all elements in the range.

Definition at line 137 of file ah-stl-utils.H.

References Aleph::DynList< T >::append().

Referenced by demo_range_conversions(), TEST(), TEST(), TEST(), and TEST().

◆ ranks() [1/4]

template<typename T >
Array< size_t > Aleph::ranks ( const Array< T > &  array)

Computes the rank of each element in an Array.

The rank of an element is its position in the sorted order. For n elements, ranks range from 0 (smallest) to n-1 (largest).

Template Parameters
TElement type (must be comparable with operator<)
Parameters
arrayThe array to compute ranks for
Returns
An Array where result[i] is the rank of array[i]
Complexity
O(n log n) time, O(n) space
Example
Array<int> arr = {30, 10, 20};
auto r = ranks(arr);
// r[0] = 2 (30 is the largest, rank 2)
// r[1] = 0 (10 is the smallest, rank 0)
// r[2] = 1 (20 is in the middle, rank 1)
Array< size_t > ranks(const Array< T > &array)
Computes the rank of each element in an Array.
Definition ahSort.H:696
See also
pair_ranks() for getting (value, rank) pairs

Definition at line 696 of file ahSort.H.

Referenced by demo_bfs_topological_sort(), generate_dot_file(), rank_graphviz(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TYPED_TEST(), and TYPED_TEST().

◆ ranks() [2/4]

template<typename T >
DynArray< size_t > Aleph::ranks ( const DynArray< T > &  array)

Computes the rank of each element in a DynArray.

The rank of an element is its position in the sorted order. For n elements, ranks range from 0 (smallest) to n-1 (largest).

Template Parameters
TElement type (must be comparable with operator<)
Parameters
arrayThe array to compute ranks for
Returns
An Array where result[i] is the rank of array[i]
Complexity
O(n log n) time, O(n) space
Example
Array<int> arr = {30, 10, 20};
auto r = ranks(arr);
// r[0] = 2 (30 is the largest, rank 2)
// r[1] = 0 (10 is the smallest, rank 0)
// r[2] = 1 (20 is in the middle, rank 1)
See also
pair_ranks() for getting (value, rank) pairs

Definition at line 705 of file ahSort.H.

◆ ranks() [3/4]

template<typename T >
DynArray< size_t > Aleph::ranks ( const DynDlist< T > &  l)

Computes the rank of each element in a DynDlist.

Template Parameters
TElement type
Parameters
lThe list to compute ranks for
Returns
A DynArray where result[i] is the rank of the i-th element
Note
The list is first copied to an array for efficient random access

Definition at line 733 of file ahSort.H.

References l.

◆ ranks() [4/4]

template<typename T >
DynArray< size_t > Aleph::ranks ( const DynList< T > &  l)

Computes the rank of each element in a DynList.

Template Parameters
TElement type
Parameters
lThe list to compute ranks for
Returns
A DynArray where result[i] is the rank of the i-th element
Note
The list is first copied to an array for efficient random access

Definition at line 719 of file ahSort.H.

References l.

◆ ray_endpoint()

Point Aleph::ray_endpoint ( const Point &  src,
const Point &  direction,
const Geom_Number &  length 
)
inline

Definition at line 711 of file tikzgeom_algorithms.H.

References Aleph::Point::get_x(), Aleph::Point::get_y(), and square_root().

Referenced by put_voronoi_result().

◆ read_char_from_stream()

int Aleph::read_char_from_stream ( std::ifstream &  input_stream)
inline

Read a single character from an input stream with position tracking.

Reads one character from the stream and updates the current line and column tracking. Handles newline characters by incrementing the line number and resetting the column.

Parameters
input_streamThe input file stream to read from
Returns
The character read (as int), or EOF on end of file
Exceptions
std::out_of_rangeif the stream is already at EOF before reading
Example
std::ifstream file("input.txt");
while (ch != EOF) {
process(ch);
}
int read_char_from_stream(std::ifstream &input_stream)
Read a single character from an input stream with position tracking.
ofstream file
Definition writeRb.C:51

Definition at line 282 of file parse_utils.H.

References ah_out_of_range_error_if, current_col_number, current_line_number, and read_char_from_stream().

Referenced by expect(), expect_char(), get_token(), load_binary_number(), load_char_literal(), load_deway_number(), load_double(), load_escaped_string(), load_hex_number(), load_identifier(), load_number(), load_octal_number(), load_string(), read_char_from_stream(), skip_white_spaces(), skip_whitespace_and_comments(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and try_char().

◆ read_le32()

static std::uint32_t Aleph::read_le32 ( const std::uint8_t *  p)
inlinestaticnoexcept

Definition at line 129 of file hash-fct.C.

Referenced by MurmurHash3_x86_128(), MurmurHash3_x86_32(), wyhash_hash(), and xxhash64_hash().

◆ read_le64()

static std::uint64_t Aleph::read_le64 ( const std::uint8_t *  p)
inlinestaticnoexcept

Definition at line 137 of file hash-fct.C.

Referenced by MurmurHash3_x64_128(), siphash24_hash(), wyhash_hash(), and xxhash64_hash().

◆ red_black_height_rk()

template<class Node >
int Aleph::red_black_height_rk ( Node *  p)
noexcept

Black height of a ranked red-black subtree, checking all its nodes.

In one traversal, checks every node of the subtree rooted at p: its counter is the size of its subtree, its color is RED or BLACK, a red node has no red child, and every path from p down to Node::NullPtr crosses the same number of black nodes.

Parameters
proot of subtree
Returns
the number of black nodes of each path, or -1 if a property is violated
Note
O(n).

Definition at line 127 of file rbNodeRk.H.

References and, BLACK, COLOR, LLINK, RED, red_black_height_rk(), and RLINK.

Referenced by is_red_black_tree_rk(), and red_black_height_rk().

◆ reduced_cost()

template<class Net >
Net::Flow_Type Aleph::reduced_cost ( const Net &  net,
typename Net::Arc *  arc,
bool  forward 
)

Compute reduced cost of an arc.

The reduced cost is: c(u,v) + π(u) - π(v) where c is the original cost and π are the node potentials.

For SSP algorithm, potentials are shortest path distances from source. This formula guarantees non-negative reduced costs when potentials are optimal.

Definition at line 134 of file tpl_mincost.H.

References GraphCommon< GT, Node, Arc >::get_src_node(), and GraphCommon< GT, Node, Arc >::get_tgt_node().

Referenced by Aleph::Network_Simplex< Net >::build_spanning_tree(), Aleph::Network_Simplex< Net >::find_entering_arc(), Aleph::Simplex< T >::get_all_reduced_costs(), Aleph::Network_Simplex< Net >::print_diagnostics(), Aleph::Simplex< T >::print_sensitivity_analysis(), and Aleph::Network_Simplex< Net >::verify_tree_reduced_costs().

◆ remaining_flow()

template<class Net >
Net::Flow_Type Aleph::remaining_flow ( typename Net::Node *  src,
typename Net::Arc *  a 
)
noexcept

Return the remaining flow of a as seen from src.

If a is residual with respect to src, the remaining flow is the current flow. Otherwise, it is the residual capacity.

Definition at line 283 of file tpl_net.H.

Referenced by decompose_flow().

◆ remove()

template<class Fw_Itor , class T >
Fw_Itor Aleph::remove ( Fw_Itor  __first,
const Fw_Itor &  __last,
const T &  __value 
)
inline

Remove elements equal to a value.

Removes all elements in [first, last) equal to value by moving the remaining elements forward.

Template Parameters
Fw_ItorForward iterator type.
TValue type.
Parameters
__firstIterator to the first element.
__lastIterator past the last element.
__valueValue to remove.
Returns
Iterator to the new logical end of the range.

Definition at line 962 of file ahAlgo.H.

References bind2nd(), and remove_if().

Referenced by ParseUtilsTest::TearDown(), TEST(), TEST(), and TYPED_TEST().

◆ remove_by_key_xt()

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * Aleph::remove_by_key_xt ( Node *&  root,
const typename Node::key_type &  key,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See remove_by_key_xt().

Definition at line 977 of file tpl_binNodeXt.H.

References cmp(), remove_by_key_xt(), and root().

◆ remove_copy_if()

template<class In_Itor , class Out_Itor , class Predicate >
Out_Itor Aleph::remove_copy_if ( In_Itor  __first,
const In_Itor &  __last,
Out_Itor  __result,
Predicate  __pred 
)
inline

Copy elements not satisfying a predicate.

Copies elements from [first, last) to result, excluding those for which pred returns true.

Template Parameters
In_ItorInput iterator type.
Out_ItorOutput iterator type.
PredicatePredicate type.
Parameters
__firstIterator to the first source element.
__lastIterator past the last source element.
__resultIterator to the first destination position.
__predUnary predicate to test elements.
Returns
Iterator past the last copied element in destination.

Definition at line 905 of file ahAlgo.H.

Referenced by remove_if(), and TEST().

◆ remove_from_active_queue()

template<class Q_Type >
static void Aleph::remove_from_active_queue ( Q_Type &  q,
typename Q_Type::Item_Type &  p 
)
inlinestatic

Remove a node from the active queue and clear its queue mark.

Definition at line 2411 of file tpl_net.H.

References Maximum_Flow, and NODE_BITS.

◆ remove_from_container()

template<class C , typename... Args>
size_t Aleph::remove_from_container ( C &  c,
Args...  args 
)
inline

Remove multiple items from a container.

Returns
Number of items removed.

Definition at line 1987 of file ahFunctional.H.

References remove_from_container().

Referenced by remove_from_container(), and TEST().

◆ remove_if()

template<class Fw_Itor , class Predicate >
Fw_Itor Aleph::remove_if ( Fw_Itor  __first,
const Fw_Itor &  __last,
Predicate  __pred 
)
inline

Remove elements satisfying a predicate.

Removes all elements in [first, last) for which pred returns true by moving the remaining elements forward.

Template Parameters
Fw_ItorForward iterator type.
PredicatePredicate type.
Parameters
__firstIterator to the first element.
__lastIterator past the last element.
__predUnary predicate to test elements.
Returns
Iterator to the new logical end of the range.

Definition at line 934 of file ahAlgo.H.

References find_if(), and remove_copy_if().

Referenced by remove(), and TEST().

◆ remove_prefix()

std::string Aleph::remove_prefix ( std::string &  str,
const std::string &  prefix 
)
inline

Remove prefix from str if present.

Parameters
[in,out]strString to modify.
[in]prefixPrefix to remove.
Returns
Reference to str.

Definition at line 614 of file ah-string-utils.H.

References is_prefix(), and prefix().

Referenced by TEST().

◆ remove_spaces()

std::string Aleph::remove_spaces ( const std::string &  str)
inline

Remove all whitespace characters from a std::string.

Whitespace is defined by std::isspace in the current C locale.

Parameters
[in]strInput std::string.
Returns
Copy of str with whitespace removed.

Definition at line 404 of file ah-string-utils.H.

Referenced by demo_filtering(), and TEST().

◆ remove_symbols()

std::string Aleph::remove_symbols ( const std::string &  str,
const std::string &  symbols 
)
inline

Remove any character appearing in symbols.

Parameters
[in]strInput std::string.
[in]symbolsSet of characters to remove.
Returns
Copy of str without any character present in symbols.

Definition at line 421 of file ah-string-utils.H.

Referenced by demo_filtering(), and TEST().

◆ rep() [1/2]

template<typename T = int>
DynList< T > Aleph::rep ( const size_t  n,
const T &  item 
)
inline

Create a sequence of repeated items.

Parameters
[in]nnumber of items.
[in]itemthe value to be repeated.
Returns
a container with n instances of item value.

Definition at line 415 of file ahFunctional.H.

References Aleph::DynList< T >::append().

Referenced by demo_ranges(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ rep() [2/2]

template<typename T = int>
DynList< T > Aleph::rep ( const size_t  n,
T &&  item = T() 
)
inline

Overload of rep.

Definition at line 425 of file ahFunctional.H.

◆ repeated()

template<typename T , template< typename > class Container>
DynList< T > Aleph::repeated ( const Container< T > &  c)
inline

Return elements that appear more than once in the container.

Definition at line 1091 of file tpl_dynSetHash.H.

References Aleph::DynList< T >::append(), and Aleph::DynHashTable< Key, HashTable, Cmp >::insert().

Referenced by main(), Aleph::FFT< Real >::polynomial_roots_impl(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ repeated_with_index()

template<typename T , template< typename > class Container>
DynList< std::pair< T, size_t > > Aleph::repeated_with_index ( const Container< T > &  c)
inline

Return repeated elements paired with their occurrence count.

Definition at line 1108 of file tpl_dynSetHash.H.

References Aleph::DynList< T >::append(), and Aleph::DynHashTable< Key, HashTable, Cmp >::insert().

Referenced by TEST().

◆ replace()

template<class Itor , class T >
void Aleph::replace ( Itor  beg,
const Itor &  end,
const T &  old_value,
const T &  new_value 
)
inline

Replace elements equal to a value.

Replaces all elements in [beg, end) equal to old_value with new_value.

Template Parameters
ItorIterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
old_valueValue to be replaced.
new_valueReplacement value.

Definition at line 815 of file ahAlgo.H.

References bind2nd(), and replace_if().

Referenced by Aleph::PersistentHashMap< Key, T, Cmp >::insert_impl(), and TEST().

◆ replace_copy()

template<class Itor1 , class Itor2 , class T >
Itor2 Aleph::replace_copy ( const Itor1 &  sourceBeg,
const Itor1 &  sourceEnd,
Itor2  destBeg,
const T &  old_value,
const T &  new_value 
)
inline

Copy and replace elements equal to a value.

Copies elements from source to destination, replacing those equal to old_value with new_value.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
TValue type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
old_valueValue to be replaced.
new_valueReplacement value.
Returns
Iterator past the last copied element in destination.

Definition at line 878 of file ahAlgo.H.

References bind2nd(), and replace_copy_if().

◆ replace_copy_if()

template<class Itor1 , class Itor2 , class UnaryPredicate , class T >
Itor2 Aleph::replace_copy_if ( Itor1  sourceBeg,
const Itor1 &  sourceEnd,
Itor2  destBeg,
UnaryPredicate  op,
const T &  value 
)
inline

Copy and replace elements satisfying a predicate.

Copies elements from source to destination, replacing those for which op returns true with the specified value.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
UnaryPredicatePredicate type.
TValue type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
opUnary predicate to test elements.
valueReplacement value.
Returns
Iterator past the last copied element in destination.

Definition at line 842 of file ahAlgo.H.

References value.

Referenced by replace_copy(), and TEST().

◆ replace_if()

template<class Itor , class UnaryPredicate , class T >
void Aleph::replace_if ( Itor  beg,
const Itor &  end,
UnaryPredicate  op,
const T &  value 
)
inline

Replace elements satisfying a predicate.

Replaces all elements in [beg, end) for which op returns true with the specified value.

Template Parameters
ItorIterator type.
UnaryPredicatePredicate type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
opUnary predicate to test elements.
valueReplacement value.

Definition at line 788 of file ahAlgo.H.

References value.

Referenced by replace(), and TEST().

◆ reserve_search_path()

◆ reservoir_sample()

template<std::input_iterator Itor, std::sentinel_for< Itor > Sent>
auto Aleph::reservoir_sample ( Itor  beg,
Sent  end,
size_t  k,
unsigned long  seed = static_cast<unsigned long>(                     std::chrono::high_resolution_clock::now().time_since_epoch().count()) 
)
inline

Convenience function to sample k elements from a range.

Template Parameters
ItorInput iterator type.
SentSentinel type for Itor.
Parameters
[in]begStart of the range.
[in]endEnd of the range.
[in]kNumber of elements to sample.
[in]seedRandom seed.
Returns
Array of the iterator's value_type (derived from std::iterator_traits<Itor>::value_type) containing the sampled elements.
Exceptions
std::bad_allocif there is not enough memory.
std::overflow_errorif stream length exceeds safe limits.
Note
Complexity: O(n) time, O(k) space.

Definition at line 287 of file reservoir-sampling.H.

References Aleph::Reservoir_Sampler< T >::get_sample(), k, seed, and Aleph::Reservoir_Sampler< T >::update().

Referenced by TEST(), and TEST().

◆ reset_parse_state()

void Aleph::reset_parse_state ( )
inline

Reset the parsing state to initial values.

Resets line/column counters and clears the token instance. Call this before parsing a new file.

Example
std::ifstream file("newfile.txt");
// Begin parsing fresh
void reset_parse_state()
Reset the parsing state to initial values.

Definition at line 582 of file parse_utils.H.

References current_col_number, current_line_number, previous_col_number, previous_line_number, and token_instance.

Referenced by ParseUtilsTest::SetUp(), TEST(), TEST(), and TEST().

◆ residual_to_net()

template<class Net >
void Aleph::residual_to_net ( const DynMapTree< void *, void * > &  arcs)

Transfer flow values from residual network back to original.

Updates the original network's flow values based on the residual network's flow values after cycle canceling.

Template Parameters
NetOriginal network type.
Parameters
[in]arcsMapping from original arcs to residual arcs.

Definition at line 773 of file tpl_netcost.H.

References arcs.

◆ resize_process_stack()

bool Aleph::resize_process_stack ( size_t  new_size)
extern

Resize the process stack to new_size.

Parameters
[in]new_sizeRequested stack size in bytes.
Returns
true on success; false otherwise.

Definition at line 52 of file ahUtils.C.

◆ restore_flow_solution()

template<class Net >
void Aleph::restore_flow_solution ( Net &  net,
const DynMapTree< typename Net::Arc *, typename Net::Flow_Type > &  solution 
)

Restore network simplex solution from warm start.

Restores previously saved flow values. Useful when solving similar problems (e.g., after small modifications).

Template Parameters
NetNetwork type.
Parameters
netNetwork to restore solution to.
solutionPreviously saved solution.

Definition at line 1173 of file tpl_mincost.H.

References Aleph::DynMapTree< Key, Data, Tree, Compare >::has(), and Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().

◆ restore_position()

void Aleph::restore_position ( std::ifstream &  input_stream,
const StreamPosition &  pos 
)
inline

Restore a previously marked position.

Seeks the stream back to a saved position and restores the line/column tracking state.

Parameters
input_streamThe input file stream
posPosition previously returned by mark_position()
See also
mark_position()

Definition at line 780 of file parse_utils.H.

References Aleph::StreamPosition::column, current_col_number, current_line_number, Aleph::StreamPosition::line, Aleph::StreamPosition::pos, and restore_position().

Referenced by restore_position(), TEST_F(), and try_char().

◆ reverse() [1/3]

template<typename T , template< typename > class Container>
Container< T > Aleph::reverse ( const Container< T > &  l)
inline

Return a reversed copy of the container.

Creates a new container with elements in reverse order. The original container is not modified.

Template Parameters
TElement type.
ContainerContainer template type with insert() method.
Parameters
lSource container.
Returns
New container with elements in reverse order.
Example:
DynList<int> nums = {1, 2, 3, 4, 5};
auto rev = reverse(nums);
// rev = {5, 4, 3, 2, 1}
// nums unchanged: {1, 2, 3, 4, 5}
void reverse(Itor beg, Itor end)
Reverse elements in a range.
Definition ahAlgo.H:1094

Definition at line 1527 of file ahFunctional.H.

References FunctionalMethods< Container, T >::for_each(), and l.

◆ reverse() [2/3]

template<class Itor >
void Aleph::reverse ( Itor  beg,
Itor  end 
)
inline

Reverse elements in a range.

Reverses the order of elements in the range [beg, end).

Template Parameters
ItorBidirectional iterator type.
Parameters
begIterator to the first element.
endIterator past the last element.

Definition at line 1094 of file ahAlgo.H.

References and.

Referenced by demo_folding(), demo_transformation(), main(), rotate(), rotate_left(), rotate_right(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ reverse() [3/3]

template<typename T >
void Aleph::reverse ( T *  ptr,
const size_t  n 
)
inlinenoexcept

Reverse an array in-place.

Swaps elements symmetrically around the center.

Template Parameters
TElement type
Parameters
ptrPointer to array
nNumber of elements
Example
int arr[] = {1, 2, 3, 4, 5};
reverse(arr, 5); // arr = {5, 4, 3, 2, 1}

Definition at line 155 of file array_utils.H.

◆ reverse_copy()

template<class Itor1 , class Itor2 >
Itor2 Aleph::reverse_copy ( Itor1  sourceBeg,
Itor1  sourceEnd,
Itor2  destBeg 
)
inline

Copy elements in reverse order.

Copies elements from [sourceBeg, sourceEnd) to destBeg in reverse order.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
Returns
Iterator past the last copied element in destination.

Definition at line 1114 of file ahAlgo.H.

Referenced by TEST().

◆ RLINK()

template<class Node >
constexpr const Node * Aleph::RLINK ( const Node *  p)
inlineconstexprnoexcept

Definition at line 492 of file tpl_binNode.H.

◆ rot_hash() [1/3]

size_t Aleph::rot_hash ( const char *  key)
inlinenoexcept

Definition at line 669 of file hash-fct.H.

References h.

◆ rot_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::rot_hash ( const Key &  key)
inlinenoexcept

Definition at line 558 of file hash-fct.H.

References rot_hash().

◆ rot_hash() [3/3]

size_t Aleph::rot_hash ( const std::string &  key)
inlinenoexcept

Definition at line 796 of file hash-fct.H.

References rot_hash().

◆ rotate()

template<class Itor >
void Aleph::rotate ( Itor  beg,
Itor  pos,
Itor  end 
)
inline

Rotate elements in a range.

Rotates the elements in [beg, end) such that pos becomes the first element.

Template Parameters
ItorForward iterator type.
Parameters
begIterator to the first element.
posIterator to the new first element.
endIterator past the last element.

Definition at line 1138 of file ahAlgo.H.

References reverse().

Referenced by TEST().

◆ rotate_copy()

template<class Itor1 , class Itor2 >
Itor2 Aleph::rotate_copy ( const Itor1 &  beg,
const Itor1 &  pos,
const Itor1 &  end,
Itor2  tgt_beg 
)
inline

Copy and rotate elements.

Copies elements from [beg, end) to tgt_beg, rotating so that pos becomes the first element.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
Parameters
begIterator to the first source element.
posIterator to the new first element.
endIterator past the last source element.
tgt_begIterator to the first destination position.
Returns
Iterator past the last copied element in destination.

Definition at line 1161 of file ahAlgo.H.

References copy().

◆ rotate_left()

template<typename T >
void Aleph::rotate_left ( T *  ptr,
const size_t  n,
size_t  m 
)
inlinenoexcept

Rotate array elements left by m positions.

Uses the three-reversal algorithm for O(n) time and O(1) space.

Template Parameters
TElement type
Parameters
ptrPointer to array
nNumber of elements
mNumber of positions to rotate (wrapped if > n)
Example
int arr[] = {1, 2, 3, 4, 5};
rotate_left(arr, 5, 2); // arr = {3, 4, 5, 1, 2}
void rotate_left(T *ptr, const size_t n, size_t m) noexcept
Rotate array elements left by m positions.
Note
No-op if n <= 1 or m == 0

Definition at line 180 of file array_utils.H.

References m, and reverse().

Referenced by main(), TEST_F(), and TEST_F().

◆ rotate_right()

template<typename T >
void Aleph::rotate_right ( T *  ptr,
const size_t  n,
size_t  m 
)
inlinenoexcept

Rotate array elements right by m positions.

Uses the three-reversal algorithm for O(n) time and O(1) space.

Template Parameters
TElement type
Parameters
ptrPointer to array
nNumber of elements
mNumber of positions to rotate (wrapped if > n)
Example
int arr[] = {1, 2, 3, 4, 5};
rotate_right(arr, 5, 2); // arr = {4, 5, 1, 2, 3}
void rotate_right(T *ptr, const size_t n, size_t m) noexcept
Rotate array elements right by m positions.
Note
No-op if n <= 1 or m == 0

Definition at line 213 of file array_utils.H.

References m, and reverse().

Referenced by main(), TEST_F(), and TEST_F().

◆ rotl32()

static uint32_t Aleph::rotl32 ( uint32_t  x,
int8_t  r 
)
inlinestatic

Definition at line 70 of file hash-fct.C.

References r.

◆ rotl64()

static uint64_t Aleph::rotl64 ( uint64_t  x,
int8_t  r 
)
inlinestatic

Definition at line 75 of file hash-fct.C.

References r.

◆ rtrim()

void Aleph::rtrim ( std::string &  s)
inline

Remove trailing whitespace from a std::string in-place.

Whitespace is defined by std::isspace in the current C locale.

Parameters
[in,out]sString to modify.

Definition at line 140 of file ah-string-utils.H.

Referenced by demo_trimming(), trim(), and trim_in_place().

◆ Rvector() [1/2]

template<class C >
std::string Aleph::Rvector ( const C &  c)
inline

Return a string with an R assignment for a container interpreted as [name, value1, value2, ...].

The first element of c is used as the R variable name, and the remaining elements are used as the vector data.

Definition at line 336 of file ahUtils.H.

◆ Rvector() [2/2]

template<class C >
std::string Aleph::Rvector ( const std::string &  name,
const C &  c 
)
inline

Return a string with R specification of a vector with name and data stored in container c

Definition at line 310 of file ahUtils.H.

Referenced by TEST().

◆ safe_atof()

double Aleph::safe_atof ( const std::string &  s)
inline

Convert a std::string to double and throw on parse errors.

Parameters
[in]sInput std::string.
Returns
Parsed double value.
Exceptions
std::runtime_errorIf s does not contain a valid double.

Definition at line 582 of file ah-string-utils.H.

References ah_runtime_error_if, and and.

Referenced by TEST().

◆ safe_atol()

long Aleph::safe_atol ( const std::string &  s)
inline

Convert a std::string to long and throw on parse errors.

Parameters
[in]sInput std::string.
Returns
Parsed long value.
Exceptions
std::runtime_errorIf s does not contain a valid long.

Definition at line 564 of file ah-string-utils.H.

References ah_runtime_error_if, and and.

◆ save_flow_solution()

template<class Net >
DynMapTree< typename Net::Arc *, typename Net::Flow_Type > Aleph::save_flow_solution ( const Net &  net)

Save network simplex solution for warm start.

Saves the current flow values so they can be restored later when solving a modified problem.

Template Parameters
NetNetwork type.
Parameters
netNetwork with solution.
Returns
Map of arc pointers to flow values.

Definition at line 1148 of file tpl_mincost.H.

References Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne().

◆ sax_hash() [1/3]

size_t Aleph::sax_hash ( const char *  key)
inlinenoexcept

Definition at line 691 of file hash-fct.H.

References h.

◆ sax_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::sax_hash ( const Key &  key)
inlinenoexcept

Definition at line 572 of file hash-fct.H.

References sax_hash().

◆ sax_hash() [3/3]

size_t Aleph::sax_hash ( const std::string &  key)
inlinenoexcept

Definition at line 806 of file hash-fct.H.

References sax_hash().

◆ scalar_triple_product()

Geom_Number Aleph::scalar_triple_product ( const Point3D &  a,
const Point3D &  b,
const Point3D &  c 
)
inline

Scalar triple product: a · (b × c).

Definition at line 3291 of file point.H.

References Aleph::Point3D::cross(), and Aleph::Point3D::dot().

Referenced by Aleph::Tetrahedron::contains(), Aleph::Tetrahedron::signed_volume_x6(), and TEST_F().

◆ scanl()

template<typename T , class Container , class Op >
requires requires(T &acc, Op &op) { acc = op(acc, std::declval<functional_detail::get_curr_t<Container>>()); }
DynList< T > Aleph::scanl ( const Container &  container,
const T &  init,
Op  op 
)
inline

Prefix scan with custom operation.

Computes running accumulation: [init, op(init, x1), op(op(init, x1), x2), ...]

Parameters
containerSource container.
initInitial accumulator value.
opBinary operation.
Returns
DynList with all intermediate accumulator values.

Definition at line 2519 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and init.

◆ scanl_sum()

template<typename T , class Container >
DynList< T > Aleph::scanl_sum ( const Container &  container,
const T &  init 
)
inline

Compute running sums (scanl with addition).

Returns a list of partial sums including init.

Parameters
containerSource container.
initStarting value.
Returns
DynList with all intermediate accumulator values.

Definition at line 2494 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and init.

Referenced by TEST(), and TEST().

◆ Scope_Guard()

template<class GT , class Cleanup >
Aleph::Scope_Guard ( const GT &  ,
Cleanup   
) -> Scope_Guard< GT, Cleanup >

Deduction guide for Scope_Guard.

◆ search()

template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 Aleph::search ( Itor1  beg,
const Itor1 &  end,
Itor2  searchBeg,
const Itor2 &  searchEnd,
BinaryPredicate  op = BinaryPredicate() 
)
inline

Search for a subrange within a range.

Searches for the first occurrence of the subrange [searchBeg, searchEnd) within the range [beg, end).

Template Parameters
Itor1Main range iterator type.
Itor2Subrange iterator type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element of the main range.
endIterator past the last element of the main range.
searchBegIterator to the first element of the subrange.
searchEndIterator past the last element of the subrange.
opBinary predicate for comparison (defaults to equality).
Returns
Iterator to the first element of the found subrange, or end.
Note
The ranges can be of different container types as long as op can compare their elements.

Definition at line 309 of file ahAlgo.H.

References and, and count().

Referenced by Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_combinatorial_embedding_bruteforce(), find_end(), Aleph::net_detail::return_dust(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ search_elapsed_ms()

◆ search_extreme() [1/10]

template<class Compare >
Dlink * Aleph::search_extreme ( const Dlink &  list,
const Compare &  cmp = Compare() 
)
inline

Definition at line 423 of file tpl_sort_utils.H.

References cmp().

◆ search_extreme() [2/10]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Dnode< T > * Aleph::search_extreme ( const Dnode< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Overload of search_extreme.

Definition at line 804 of file tpl_sort_utils.H.

References cmp().

◆ search_extreme() [3/10]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::search_extreme ( const DynArray< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Generic search in a dynamic array of an extreme element.

search_extreme(a, l, r) searches the array sequentially a between the indices l and r, the extreme, minimum or element maximum according to the comparison criterion Compare.

Parameters
[in]athe dynamic array in which to perform the search.
[in]lstarting index of the search.
[in]rsearch term index.
cmpcomparison object.
Returns
containing index of the endpoint.
Note
There is no checking if the stream is empty.

Definition at line 4170 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ search_extreme() [4/10]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * Aleph::search_extreme ( const DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 834 of file tpl_sort_utils.H.

References cmp(), and Aleph::Dnode< T >::get_data().

◆ search_extreme() [5/10]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * Aleph::search_extreme ( const DynList< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Iterator positioned at the first element, used as the initial extreme.

Definition at line 403 of file tpl_sort_utils.H.

References cmp(), Aleph::Const_Iterator< It >::get_curr(), Aleph::Const_Iterator< It >::has_curr(), Aleph::HTList::is_empty(), and Aleph::Const_Iterator< It >::next_ne().

◆ search_extreme() [6/10]

template<class Link , class Compare >
Link * Aleph::search_extreme ( const Link &  list,
const Compare &  cmp 
)
inline

Find the extreme (minimum or maximum) element in a linked list.

Performs a linear scan through the list to find the element that compares as "smallest" according to the provided comparator. By changing the comparator, you can find either minimum or maximum.

Time complexity: O(n), where n is the number of nodes in the list.

Template Parameters
LinkLink node type (e.g., Dlink, Slinknc).
CompareComparison functor that compares Link pointers.
Parameters
listThe list header to search.
cmpComparator: cmp(p1, p2) returns true if p1 is "more extreme".
Returns
Pointer to the node containing the extreme element.
Warning
Does not check if the list is empty. Behavior is undefined for empty lists.
See also
search_min(), search_max()

list is only read, but the generic Iterator interface requires a non-const list; the const_cast is safe since nothing mutates through it.

Definition at line 385 of file tpl_sort_utils.H.

References cmp().

Referenced by main().

◆ search_extreme() [7/10]

template<class Compare >
Slinknc * Aleph::search_extreme ( const Slinknc &  list,
const Compare &  cmp = Compare() 
)
inline

Definition at line 429 of file tpl_sort_utils.H.

References cmp().

◆ search_extreme() [8/10]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * Aleph::search_extreme ( DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Search for an extreme element in a DynDlist.

Performs a linear scan to find the minimum or maximum element according to the comparison criterion Compare.

Parameters
[in]listthe list to search on.
cmpcomparison object.
Returns
pointer to the data of the extreme element, or nullptr if empty.

Definition at line 824 of file tpl_sort_utils.H.

References cmp(), and Aleph::Dnode< T >::get_data().

◆ search_extreme() [9/10]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * Aleph::search_extreme ( DynList< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Search for an extreme element in a DynList.

Parameters
listThe list header.
cmpComparison functor.
Returns
Pointer to the data of the extreme element, or nullptr if empty.

Definition at line 848 of file tpl_sort_utils.H.

References cmp(), Aleph::DynList< T >::Iterator::get_curr_ne(), Aleph::HTList::Iterator::has_curr(), Aleph::HTList::is_empty(), and Aleph::HTList::Iterator::next_ne().

◆ search_extreme() [10/10]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::search_extreme ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Generic search in an array of an extreme element.

search_extreme(a, l, r) searches the array sequentially a, between the indices l and r, the extreme, minimum or element maximum according to the comparison criterion Compare.

Parameters
[in]athe array on which to search.
[in]lstarting index of the search.
[in]rsearch term index.
cmpcomparison object.
Returns
containing index of the endpoint.
Note
There is no checking if the stream is empty.

Definition at line 770 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ search_in_arc() [1/2]

template<AlephGraph GT, class Op >
auto Aleph::search_in_arc ( const GT &  g,
typename GT::Node *  p,
Op  op = Op() 
)
inline

Search an arc of g into p that satisfies op; on a digraph, in \(O(E)\).

Parameters
[in]gthe graph of p
[in]pnode pointer
[in]opoperation for testing on each arc
Returns
the first arc that satisfies op, or nullptr

Definition at line 3147 of file tpl_graph.H.

References traverse_in_arcs().

◆ search_in_arc() [2/2]

template<AlephGraph GT, class Op >
auto Aleph::search_in_arc ( typename GT::Node *  p,
Op  op = Op() 
)
inline

Search an incoming arc to a node satisfying a condition op.

op must have the following signature:

bool op(Arc * arc)

It does not compile on a digraph type: use search_in_arc(g, p, op).

Parameters
[in]pnode pointer
[in]opoperation for testing on each arc
Returns
a pointer to a node satisfying the operation if this is found; nullptr otherwise

Definition at line 3119 of file tpl_graph.H.

Referenced by TYPED_TEST().

◆ search_inversion()

template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
std::pair< bool, size_t > Aleph::search_inversion ( const Container< T > &  cont,
const Compare &  cmp = Compare() 
)

Find the first inversion in a container.

Searches for the first position where an element is less than its predecessor, indicating that the container is not sorted at that point.

Time complexity: O(n), where n is the container size.

Template Parameters
ContainerTemplate container type.
TElement type stored in the container.
CompareComparison functor type (default: Aleph::less<T>).
Parameters
contThe container to check.
cmpComparison functor defining "less than" relationship.
Returns
A pair where:
  • first is true if the container is sorted, false otherwise.
  • second is the index of the inversion (if found), or the container size (if sorted).
See also
is_sorted(), test_sorted()

Definition at line 206 of file tpl_sort_utils.H.

References cmp(), Aleph::Const_Iterator< It >::get_curr(), Aleph::Const_Iterator< It >::has_curr(), and Aleph::Const_Iterator< It >::next_ne().

◆ search_max() [1/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
long Aleph::search_max ( const DynArray< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Returns the maximum element of the array a between l and r.

Definition at line 4187 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ search_max() [2/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
const T * Aleph::search_max ( const DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 897 of file tpl_sort_utils.H.

References cmp().

◆ search_max() [3/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
T * Aleph::search_max ( DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Search for the maximum element in a DynDlist.

Parameters
listThe list header.
cmpComparison functor.
Returns
Pointer to the data of the maximum element, or nullptr if empty.

Definition at line 890 of file tpl_sort_utils.H.

References cmp().

◆ search_max() [4/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::greater<T>>
long Aleph::search_max ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Returns the maximum element of the array a between l and r.

Definition at line 795 of file tpl_sort_utils.H.

References cmp(), l, and r.

Referenced by main(), and set_picture_size().

◆ search_min() [1/3]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
const T * Aleph::search_min ( const DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 879 of file tpl_sort_utils.H.

References cmp().

◆ search_min() [2/3]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
T * Aleph::search_min ( DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)
inline

Search for the minimum element in a DynDlist.

Parameters
listThe list header.
cmpComparison functor.
Returns
Pointer to the data of the minimum element, or nullptr if empty.

Definition at line 872 of file tpl_sort_utils.H.

References cmp().

◆ search_min() [3/3]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::search_min ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Returns the smallest element of the array a between l and r.

Definition at line 785 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ search_n()

template<class Itor , class Size , class T , class BinaryPredicate = Aleph::equal_to<T>>
Itor Aleph::search_n ( Itor  beg,
const Itor &  end,
Size  count,
const T &  value,
BinaryPredicate  op = BinaryPredicate() 
)
inline

Find n consecutive elements equal to a value.

Searches for the first occurrence of count consecutive elements equal to value in the range [beg, end).

Template Parameters
ItorIterator type.
SizeInteger type for count.
TValue type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element.
endIterator past the last element.
countNumber of consecutive elements to find.
valueValue to compare against.
opBinary predicate for comparison (defaults to equality).
Returns
Iterator to the first of the consecutive elements, or end.

Definition at line 255 of file ahAlgo.H.

References and, count(), and value.

Referenced by TEST(), TEST(), and TEST().

◆ search_node()

template<AlephGraph GT>
static int Aleph::search_node ( DynArray< typename GT::Node * > &  nodes,
typename GT::Node *  p 
)
staticnoexcept

Definition at line 134 of file generate_graph.H.

References nodes, search_node(), and sequential_search().

Referenced by search_node().

◆ search_or_insert_by_key_xt() [1/2]

template<BinNodeLike Node, class Compare = Aleph::less<typename Node::key_type>>
Node * Aleph::search_or_insert_by_key_xt ( Node *&  r,
Node *  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See search_or_insert_by_key_xt(Node *& r, Node * p, Compare & cmp).

Definition at line 529 of file tpl_binNodeXt.H.

References cmp(), r, and search_or_insert_by_key_xt().

◆ search_or_insert_by_key_xt() [2/2]

template<RankedBinNodeLike Node, class Compare >
Node * Aleph::search_or_insert_by_key_xt ( Node *&  r,
Node *  p,
Compare &  cmp 
)
inlinenoexcept

Search or insert a node in an extended binary search tree.

search_or_insert_by_key_xt(r, p, cmp) searches in the extended tree with root r the key contained in node p. If the key is found, the function returns the node containing the key; otherwise p is inserted in the tree and this pointer is returned.

Parameters
rroot of tree (reference to pointer, may be modified)
ppointer to node to search or insert
cmpcomparison functor for key ordering
Returns
if p is inserted, then this is returned; otherwise the pointer to the node containing the key is returned

Definition at line 500 of file tpl_binNodeXt.H.

References cmp(), COUNT(), KEY, LLINK, r, RLINK, and search_or_insert_by_key_xt().

Referenced by search_or_insert_by_key_xt(), search_or_insert_by_key_xt(), and TEST().

◆ search_or_insert_root_rec_xt() [1/2]

template<BinNodeLike Node, class Key , class Compare = Aleph::less<typename Node::key_type>>
Node * Aleph::search_or_insert_root_rec_xt ( Node *  root,
Node *  p,
Compare &&  cmp = Compare() 
)
inlinenoexcept

See search_or_insert_root_rec_xt().

Definition at line 1137 of file tpl_binNodeXt.H.

References cmp(), and root().

◆ search_or_insert_root_rec_xt() [2/2]

template<RankedBinNodeLike Node, class Key , class Compare >
Node * Aleph::search_or_insert_root_rec_xt ( Node *  root,
Node *  p,
Compare &  cmp 
)
inlinenoexcept

Search or insert a key in an extended binary search tree.

Parameters
[in]rootof the tree
[in]ppointer to the node whose key must be searched and eventually, if not found, be inserted
[in]cmpcomparison criteria
Returns
if the node was inserted (its key was not in the tree), then the inserted node is returned. Otherwise, a pointer to a node containg the key in returned

Definition at line 1098 of file tpl_binNodeXt.H.

References cmp(), COUNT(), KEY, LLINK, RLINK, root(), rotate_to_left_xt(), and rotate_to_right_xt().

◆ search_out_arc()

template<AlephGraph GT, class Op >
auto Aleph::search_out_arc ( typename GT::Node *  p,
Op  op = Op() 
)
inline

Search an outcoming arc to a node satisfying a condition op.

op must have the following signature:

bool op(Arc * arc)

Parameters
[in]pnode pointer
[in]opoperation for testing on each arc
Returns
a pointer to a node satisfying the operation if this is found; nullptr otherwise

Definition at line 3444 of file tpl_graph.H.

◆ search_spanning_tree_arc()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
GT::Arc * Aleph::search_spanning_tree_arc ( const GT &  g,
typename GT::Node *  src,
typename GT::Node *  tgt,
SA  sa = SA() 
)
noexcept

Helper to find the spanning tree arc between two nodes in a multigraph.

When there are parallel arcs between two nodes, this function searches for the arc that is marked as part of the spanning tree.

Parameters
[in]gThe graph
[in]srcSource node
[in]tgtTarget node
[in]saArc filter (default: Dft_Show_Arc<GT>)
Returns
Pointer to the spanning tree arc, or nullptr if not found
Exceptions
anythingthat sa throws

Definition at line 2468 of file tpl_graph_utils.H.

References and, IS_ARC_VISITED, GraphCommon< GT, Node, Arc >::is_digraph(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), GTNodeCommon< NodeInfo >::num_arcs, and Spanning_Tree.

Referenced by TEST().

◆ segment_image()

template<typename Value_Type >
SegmentationResult Aleph::segment_image ( size_t  rows,
size_t  cols,
const std::vector< std::vector< std::array< Value_Type, 2 > > > &  data_cost,
Value_Type  smoothness 
)

Segment image using graph cuts.

Solves the binary labeling problem for image segmentation:

  • Each pixel can be labeled 0 (background) or 1 (foreground)
  • Data term: cost of assigning each label to each pixel
  • Smoothness term: cost of adjacent pixels having different labels

The energy to minimize is: E(L) = Σ D_p(L_p) + Σ V_{p,q}(L_p, L_q)

where D is data cost and V is smoothness cost.

Template Parameters
Value_TypeCost type.
Parameters
rowsImage height.
colsImage width.
data_costdata_cost[i][j][k] = cost of pixel (i,j) having label k.
smoothnessCost of adjacent pixels having different labels.
Returns
SegmentationResult with optimal labeling.
Example
// 3x3 image with data costs
std::vector<std::vector<std::array<double,2>>> data(3,
std::vector<std::array<double,2>>(3));
// Set data costs based on pixel intensities
for (int i = 0; i < 3; ++i)
for (int j = 0; j < 3; ++j) {
data[i][j][0] = intensity[i][j]; // Cost of background
data[i][j][1] = 255 - intensity[i][j]; // Cost of foreground
}
auto result = segment_image(3, 3, data, 10.0);
SegmentationResult segment_image(size_t rows, size_t cols, const std::vector< std::vector< std::array< Value_Type, 2 > > > &data_cost, Value_Type smoothness)
Segment image using graph cuts.
Definition net_apps.H:735

Definition at line 735 of file net_apps.H.

References cols, Aleph::DynSetTree< Key, Tree, Compare >::contains(), dinic_maximum_flow(), Aleph::SegmentationResult::energy, Aleph::DynListQueue< T >::front(), Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_src_node(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::DynListQueue< T >::is_empty(), Aleph::SegmentationResult::labels, Aleph::Net_Graph< NodeT, ArcT >::make_super_sink(), Aleph::Net_Graph< NodeT, ArcT >::make_super_source(), min_cut(), Aleph::DynListQueue< T >::put(), and rows.

Referenced by demo_image_segmentation(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ segment_intersection_point()

Point Aleph::segment_intersection_point ( const Segment &  s1,
const Segment &  s2 
)
inline

Compute the exact intersection point of segments s1 and s2.

Exceptions
std::domain_errorif segments do not intersect.
std::domain_errorif the intersection set is not a unique point.

Definition at line 2982 of file point.H.

References ah_domain_error_if, and, Aleph::Segment::get_src_point(), Aleph::Segment::get_tgt_point(), Aleph::Segment::intersection_with(), Aleph::Segment::is_parallel_with(), on_segment(), and segments_intersect().

Referenced by Aleph::ConstrainedDelaunayTriangulation::merge_and_deduplicate(), scenario_exact_intersection(), scenario_road_network(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ segment_segment_intersection()

SegmentSegmentIntersection::Result Aleph::segment_segment_intersection ( const Segment &  s1,
const Segment &  s2 
)
inline

Convenience free-function wrapper for SegmentSegmentIntersection.

Definition at line 5258 of file geom_algorithms.H.

Referenced by Aleph::SweepLineSegmentIntersection::check_and_enqueue(), main(), and TEST_F().

◆ segments_intersect() [1/2]

bool Aleph::segments_intersect ( const Point &  a,
const Point &  b,
const Point &  c,
const Point &  d 
)
inline

Return true if segments (a,b) and (c,d) intersect (including endpoints).

Definition at line 2973 of file point.H.

References Aleph::Segment::intersects_with().

◆ segments_intersect() [2/2]

bool Aleph::segments_intersect ( const Segment &  s1,
const Segment &  s2 
)
inline

◆ select()

template<RankedBinNodeLike Node>
Node * Aleph::select ( Node *  root,
const size_t  pos,
Node *&  parent 
)
inline

Iterative selection of a node according to inorder psoition and determination of parent of selected node.

  @param[in] root root of tree
  @param[in] pos position inorder whose node wants to be located
  @param[out] parent of selected node
  @return a pointer to the node at the inorder position pos
  @throw out_of_range if pos is greater or equal than the number
  of nodes.

  @see select_rec()
  @ingroup Trees

Definition at line 189 of file tpl_binNodeXt.H.

References ah_out_of_range_error_if, and, COUNT(), LLINK, RLINK, and root().

◆ select_pivot()

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::select_pivot ( T *  a,
long  l,
long  r,
const Compare &  cmp = Compare() 
)
inlinenoexcept

Select a pivot for partitioning using median-of-three.

Parameters
aPointer to the array.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the selected pivot.

Median-of-three: sort a[l], a[m], a[r] in place, then use the middle value's index as the pivot.

Second comparison of the median-of-three ordering pass.

Third comparison of the median-of-three ordering pass.

Median-of-three: sort a[l], a[m], a[r] in place, then use the middle value's index as the pivot.

Second comparison of the median-of-three ordering pass.

Third comparison of the median-of-three ordering pass.

Definition at line 1774 of file tpl_sort_utils.H.

References cmp(), l, m, and r.

Referenced by TEST().

◆ select_pivot_op() [1/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::select_pivot_op ( const Array< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Selects a pivot element as the median between the ends and the center.

Definition at line 3055 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ select_pivot_op() [2/2]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
long Aleph::select_pivot_op ( const DynArray< T > &  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)
inline

Selects a pivot element as the median between the ends and the center.

Definition at line 3043 of file tpl_sort_utils.H.

References cmp(), l, and r.

◆ select_pivot_op_impl()

template<typename T , class Compare , typename Container >
long Aleph::select_pivot_op_impl ( const Container &  a,
const long  l,
const long  r,
const Compare &  cmp 
)
inline

Implementation of pivot selection using operator().

Template Parameters
ContainerContainer type.
Parameters
aThe container.
lLeft index.
rRight index.
cmpComparison functor.
Returns
Index of the selected pivot.

Definition at line 3010 of file tpl_sort_utils.H.

References cmp(), l, m, and r.

◆ selection_sort() [1/4]

template<class Compare >
void Aleph::selection_sort ( Dlink &  list,
Compare  cmp 
)
inline

Selection sort for doubly-linked lists (Dlink).

Sorts the list by repeatedly finding the extreme element and appending it to a temporary auxiliary list.

Template Parameters
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 444 of file tpl_sort_utils.H.

References Aleph::Dlink::append(), cmp(), Aleph::Dlink::del(), Aleph::Dlink::is_empty(), and Aleph::Dlink::swap().

◆ selection_sort() [2/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::selection_sort ( Dnode< T > &  list,
Compare  cmp 
)
inline

Selection sort for Dnode-based doubly-linked lists.

Template Parameters
TElement type.
CompareComparison functor.
Parameters
[in,out]listThe list to sort.
[in]cmpComparison functor.

Definition at line 530 of file tpl_sort_utils.H.

References cmp().

◆ selection_sort() [3/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::selection_sort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Sorts a dynamic array by the selection method.

selection_sort(a) uses the selection method to sort the dynamic array of n elements.

The selection method has a performance of \(O(n^2)\). Due to its simplicity of implementation, its constant cost is low, so it is a good method for arrangements of very small dimension.

The method uses two type parameters:

  1. T: the type of elements that the array has.
  2. Compare: comparison class.
Parameters
cmpcomparison object.
[in,out]athe array to sort.
See also
insertion_sort() quicksort_rec() mergesort() heapsort()

Definition at line 3499 of file tpl_sort_utils.H.

References cmp(), min(), and Aleph::DynArray< T >::size().

◆ selection_sort() [4/4]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::selection_sort ( T *  a,
const size_t  n,
const Compare &  cmp = Compare() 
)
inlinenoexcept

Sort an array using the selection sort algorithm.

Selection sort works by repeatedly finding the minimum element from the unsorted portion and placing it at the beginning. It has O(n²) time complexity but minimal memory overhead and a simple implementation.

Algorithm

  1. Find the minimum element in the unsorted portion [i, n)
  2. Swap it with the element at position i
  3. Repeat for i = 0, 1, ..., n-2

Characteristics

  • Time complexity: O(n²) always (best, average, worst)
  • Space complexity: O(1) - in-place
  • Stability: Not stable (equal elements may be reordered)
  • Comparisons: Exactly n(n-1)/2
  • Swaps: At most n-1

When to Use

  • Very small arrays (n < 10-15)
  • When write operations are expensive (minimizes swaps)
  • When simplicity is more important than speed
Template Parameters
TElement type (must be swappable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array to sort.
[in]nNumber of elements in the array.
cmpComparison functor; cmp(x, y) returns true if x < y.
See also
insertion_sort(), quicksort(), mergesort(), heapsort()

Definition at line 345 of file tpl_sort_utils.H.

References cmp(), and min().

Referenced by benchmark_array_algorithms(), and TEST().

◆ sequential_groups() [1/2]

template<typename T , template< typename > class Container, class Equal = std::equal_to<T>>
std::pair< DynList< DynList< T > >, size_t > Aleph::sequential_groups ( const Container< T > &  c,
Equal &&  eq = Equal() 
)

Overload of sequential_groups.

Definition at line 1641 of file ahFunctional.H.

References eq(), and sequential_groups().

◆ sequential_groups() [2/2]

template<typename T , template< typename > class Container, class Equal >
std::pair< DynList< DynList< T > >, size_t > Aleph::sequential_groups ( const Container< T > &  c,
Equal &  eq 
)

Group consecutive equal elements together.

Partitions a container into groups of consecutive elements that are equal according to the given equality predicate. Each group is a DynList containing all consecutive equal elements.

Template Parameters
TElement type.
ContainerContainer template type.
EqualEquality predicate type.
Parameters
cSource container.
eqEquality predicate for comparing elements.
Returns
Pair of (list of groups, number of groups).
Example:
DynList<int> nums = {1, 1, 2, 2, 2, 4, 4, 0, 0, 1};
auto [groups, count] = sequential_groups(nums);
// groups = { {1, 1}, {2, 2, 2}, {4, 4}, {0, 0}, {1} }
// count = 5
std::pair< DynList< DynList< T > >, size_t > sequential_groups(const Container< T > &c, Equal &eq)
Group consecutive equal elements together.
See also
group_by() for grouping by a key function.
unique_sequential() for getting unique consecutive values.

Definition at line 1606 of file ahFunctional.H.

References Aleph::DynList< T >::append(), count(), and eq().

Referenced by sequential_groups(), and TEST().

◆ sequential_search() [1/13]

template<typename T , class Equal = Aleph::equal_to<T>>
Dlink * Aleph::sequential_search ( const Dlink &  list,
const T &  x,
Equal  eq = Equal() 
)

Linear search for an element in a Dlink list.

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the first Dlink containing x, or nullptr.

Adapt the element-equality comparator into a node-vs-node comparator.

Definition at line 625 of file tpl_sort_utils.H.

References cmp(), and eq().

◆ sequential_search() [2/13]

template<typename T , class Equal = Aleph::equal_to<T>>
const Dnode< T > * Aleph::sequential_search ( const Dnode< T > &  list,
const T &  x,
Equal &&  eq = Equal() 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 688 of file tpl_sort_utils.H.

References eq().

◆ sequential_search() [3/13]

template<typename T , class Equal = Aleph::equal_to<T>>
const Dnode< T > * Aleph::sequential_search ( const Dnode< T > &  list,
const T &  x,
Equal &  eq 
)
inline

Linear search over a list of Dnodes.

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the first Dnode containing x, or nullptr.

Adapt the element-equality comparator into a node-vs-node comparator.

Definition at line 676 of file tpl_sort_utils.H.

References cmp(), and eq().

◆ sequential_search() [4/13]

template<typename T , class Equal = Aleph::equal_to<T>>
long Aleph::sequential_search ( const DynArray< T > &  a,
const T &  x,
const long  l,
const long  r,
Equal  eq = Equal() 
)
inline

Linear search for an element in a dynamic array.

Scans the dynamic array between indices l and r looking for the first occurrence of the specified element.

Template Parameters
TElement type.
EqualEquality comparison functor (default: Aleph::equal_to<T>).
Parameters
aPointer to the dynamic array.
xThe element to search for.
lLeft index (inclusive).
rRight index (inclusive).
eqEquality comparator.
Returns
Index of the first occurrence of x, or Not_Found if not found.
Note
Only existing (mapped) entries in the DynArray are accessed.

Definition at line 585 of file tpl_sort_utils.H.

References eq(), Aleph::DynArray< T >::exist(), l, Not_Found, and r.

◆ sequential_search() [5/13]

template<typename T , class Equal = Aleph::equal_to<T>>
const T * Aleph::sequential_search ( const DynDlist< T > &  list,
const T &  x,
Equal  eq = Equal() 
)
inline

Linear search on a DynDlist (const version).

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the data of the first matching element, or nullptr.

Definition at line 713 of file tpl_sort_utils.H.

References eq(), and Aleph::Dnode< T >::get_data().

◆ sequential_search() [6/13]

template<typename T , class Equal = Aleph::equal_to<T>>
const T * Aleph::sequential_search ( const DynList< T > &  list,
const T &  x,
Equal  eq = Equal() 
)
inline

Linear search on a DynList (const version).

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the data of the first matching element, or nullptr.

Definition at line 744 of file tpl_sort_utils.H.

References eq(), and Aleph::Const_Iterator< It >::has_curr().

◆ sequential_search() [7/13]

template<class Link , typename T , class Equal >
Link * Aleph::sequential_search ( const Link &  list,
const T &  x,
Equal &  eq 
)

Linear search for an element in a linked list.

Template Parameters
LinkLink node type (e.g., Dlink, Slinknc).
TElement type.
EqualEquality comparison functor.
Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the first node containing x, or nullptr if not found.

Definition at line 609 of file tpl_sort_utils.H.

References eq().

◆ sequential_search() [8/13]

template<typename T , class Equal = Aleph::equal_to<T>>
Slinknc * Aleph::sequential_search ( const Slinknc &  list,
const T &  x,
Equal  eq = Equal() 
)

Linear search for an element in an Slinknc list.

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the first Slinknc containing x, or nullptr.

Adapt the element-equality comparator into a node-vs-node comparator.

Definition at line 639 of file tpl_sort_utils.H.

References cmp(), and eq().

◆ sequential_search() [9/13]

template<typename T , class Equal = Aleph::equal_to<T>>
Dnode< T > * Aleph::sequential_search ( Dnode< T > &  list,
const T &  x,
Equal &&  eq = Equal() 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 664 of file tpl_sort_utils.H.

References eq().

◆ sequential_search() [10/13]

template<typename T , class Equal = Aleph::equal_to<T>>
Dnode< T > * Aleph::sequential_search ( Dnode< T > &  list,
const T &  x,
Equal &  eq 
)
inline

Linear search over a list of Dnodes.

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the first Dnode containing x, or nullptr.

Adapt the element-equality comparator into a node-vs-node comparator.

Definition at line 653 of file tpl_sort_utils.H.

References cmp(), and eq().

◆ sequential_search() [11/13]

template<typename T , class Equal = Aleph::equal_to<T>>
T * Aleph::sequential_search ( DynDlist< T > &  list,
const T &  x,
Equal  eq = Equal() 
)
inline

Linear search on a DynDlist.

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the data of the first matching element, or nullptr.

Definition at line 700 of file tpl_sort_utils.H.

References eq(), and Aleph::Dnode< T >::get_data().

◆ sequential_search() [12/13]

template<typename T , class Equal = Aleph::equal_to<T>>
T * Aleph::sequential_search ( DynList< T > &  list,
const T &  x,
Equal  eq = Equal() 
)
inline

Linear search on a DynList.

Parameters
listThe list header.
xThe element to search for.
eqEquality comparator.
Returns
Pointer to the data of the first matching element, or nullptr.

Definition at line 726 of file tpl_sort_utils.H.

References eq(), and Aleph::HTList::Iterator::has_curr().

◆ sequential_search() [13/13]

template<typename T , class Equal = Aleph::equal_to<T>>
long Aleph::sequential_search ( T *  a,
const T &  x,
const long  l,
const long  r,
Equal  eq = Equal() 
)
inline

Linear search for an element in an array.

Scans the array from left to right looking for the first occurrence of the specified element.

Time complexity: O(n), where n = r - l + 1

Template Parameters
TElement type.
EqualEquality comparison functor (default: Aleph::equal_to<T>).
Parameters
aPointer to the array.
xThe element to search for.
lLeft index (inclusive) where search begins.
rRight index (inclusive) where search ends.
eqEquality comparator; eq(a[i], x) returns true if equal.
Returns
Index of the first occurrence of x, or Not_Found (-1) if not found.
See also
binary_search() for sorted arrays

Definition at line 557 of file tpl_sort_utils.H.

References eq(), l, Not_Found, and r.

Referenced by aleatorio(), main(), and search_node().

◆ set_freq()

static void Aleph::set_freq ( Huffman_Node *  huffman_node,
const size_t &  freq 
)
inlinestaticnoexcept

◆ set_range() [1/2]

template<typename T = int, template< typename > class Container = DynList, class Op >
auto Aleph::set_range ( const T  start,
const T  end,
const T  step,
Op &  op 
) -> Container<std::decay_t<decltype(op(start))>>
inline

Generate a range [start, end] and apply an operation to each value.

Template Parameters
TNumeric type.
ContainerResult container type.
OpMapping operation.
Parameters
startStart value (inclusive).
endEnd value (inclusive).
stepIncrement.
opOperation to apply.
Returns
Container with the mapped values.

Definition at line 345 of file ahFunctional.H.

◆ set_range() [2/2]

template<typename T = int, template< typename > class Container = DynList, class Op >
auto Aleph::set_range ( const T  start,
const T  end,
const T  step = 1,
Op &&  op = Op() 
) -> Container<std::decay_t<decltype(op(start))>>
inline

Overload of set_range.

Definition at line 356 of file ahFunctional.H.

◆ set_to_Array()

template<class T , class Compare , class Alloc >
Array< T > Aleph::set_to_Array ( const std::set< T, Compare, Alloc > &  s)

Convert a std::set to an Array.

Creates a new Array containing copies of all elements from the given std::set. Elements are inserted in sorted order.

Template Parameters
TThe element type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
sThe source std::set.
Returns
An Array containing copies of all elements from s.

Definition at line 618 of file ah-convert.H.

References Aleph::Array< T >::append(), and Aleph::Array< T >::reserve().

Referenced by TEST().

◆ set_to_DynArray()

template<class T , class Compare , class Alloc >
DynArray< T > Aleph::set_to_DynArray ( const std::set< T, Compare, Alloc > &  s)

Convert a std::set to a DynArray.

Creates a new DynArray containing copies of all elements from the given std::set. Elements are inserted in sorted order.

Template Parameters
TThe element type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
sThe source std::set.
Returns
A DynArray containing copies of all elements from s.

Definition at line 641 of file ah-convert.H.

References Aleph::DynArray< T >::append().

Referenced by TEST().

◆ set_to_DynList()

template<class T , class Compare , class Alloc >
DynList< T > Aleph::set_to_DynList ( const std::set< T, Compare, Alloc > &  s)

Convert a std::set to a DynList.

Creates a new DynList containing copies of all elements from the given std::set. Elements are inserted in sorted order.

Template Parameters
TThe element type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
sThe source std::set.
Returns
A DynList containing copies of all elements from s.

Definition at line 596 of file ah-convert.H.

References Aleph::DynList< T >::append().

Referenced by TEST(), and TEST().

◆ set_unify()

template<typename T , class Op , class C >
DynSetTree< T > Aleph::set_unify ( const C &  c,
Op  op 
)

◆ sethash_to_Array()

template<typename Key , template< typename, class > class HashTable, class Cmp >
Array< Key > Aleph::sethash_to_Array ( const DynHashTable< Key, HashTable, Cmp > &  s)

Convert a DynHashTable (hash set) to an Array.

Template Parameters
KeyThe key type.
HashTableThe hash table template.
CmpThe equality comparator.
Parameters
sThe source DynHashTable.
Returns
An Array containing copies of all elements from s.

Definition at line 1039 of file ah-convert.H.

References Aleph::Array< T >::append(), FunctionalMethods< Container, T >::for_each(), and Aleph::Array< T >::reserve().

Referenced by TEST().

◆ sethash_to_DynArray()

template<typename Key , template< typename, class > class HashTable, class Cmp >
DynArray< Key > Aleph::sethash_to_DynArray ( const DynHashTable< Key, HashTable, Cmp > &  s)

Convert a DynHashTable (hash set) to a DynArray.

Template Parameters
KeyThe key type.
HashTableThe hash table template.
CmpThe equality comparator.
Parameters
sThe source DynHashTable.
Returns
A DynArray containing copies of all elements from s.

Definition at line 1058 of file ah-convert.H.

References Aleph::DynArray< T >::append(), and FunctionalMethods< Container, T >::for_each().

Referenced by TEST().

◆ sethash_to_DynList()

template<typename Key , template< typename, class > class HashTable, class Cmp >
DynList< Key > Aleph::sethash_to_DynList ( const DynHashTable< Key, HashTable, Cmp > &  s)

Convert a DynHashTable (hash set) to a DynList.

Template Parameters
KeyThe key type.
HashTableThe hash table template.
CmpThe equality comparator.
Parameters
sThe source DynHashTable.
Returns
A DynList containing copies of all elements from s.

Definition at line 1021 of file ah-convert.H.

References Aleph::DynList< T >::append(), and FunctionalMethods< Container, T >::for_each().

Referenced by TEST().

◆ sethash_to_vector()

template<typename Key , template< typename, class > class HashTable, class Cmp >
std::vector< Key > Aleph::sethash_to_vector ( const DynHashTable< Key, HashTable, Cmp > &  s)

Convert a DynHashTable (hash set) to a std::vector.

Template Parameters
KeyThe key type.
HashTableThe hash table template.
CmpThe equality comparator.
Parameters
sThe source DynHashTable.
Returns
A std::vector containing copies of all elements from s.

Definition at line 1076 of file ah-convert.H.

References FunctionalMethods< Container, T >::for_each().

Referenced by TEST().

◆ settree_to_Array()

template<typename Key , template< typename, class > class Tree, class Compare >
Array< Key > Aleph::settree_to_Array ( const DynSetTree< Key, Tree, Compare > &  s)

Convert a DynSetTree to an Array.

Creates a new Array containing copies of all elements from the given DynSetTree. Elements are in tree traversal order (in-order).

Template Parameters
KeyThe key type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
sThe source DynSetTree.
Returns
An Array containing copies of all elements from s.

Definition at line 905 of file ah-convert.H.

References Aleph::Array< T >::append(), FunctionalMethods< Container, T >::for_each(), Aleph::Array< T >::reserve(), and Aleph::DynSetTree< Key, Tree, Compare >::size().

Referenced by TEST().

◆ settree_to_DynArray()

template<typename Key , template< typename, class > class Tree, class Compare >
DynArray< Key > Aleph::settree_to_DynArray ( const DynSetTree< Key, Tree, Compare > &  s)

Convert a DynSetTree to a DynArray.

Creates a new DynArray containing copies of all elements from the given DynSetTree. Elements are in tree traversal order (in-order).

Template Parameters
KeyThe key type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
sThe source DynSetTree.
Returns
A DynArray containing copies of all elements from s.

Definition at line 927 of file ah-convert.H.

References Aleph::DynArray< T >::append(), and FunctionalMethods< Container, T >::for_each().

Referenced by TEST().

◆ settree_to_DynList()

template<typename Key , template< typename, class > class Tree, class Compare >
DynList< Key > Aleph::settree_to_DynList ( const DynSetTree< Key, Tree, Compare > &  s)

Convert a DynSetTree to a DynList.

Creates a new DynList containing copies of all elements from the given DynSetTree. Elements are in tree traversal order (in-order).

Template Parameters
KeyThe key type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
sThe source DynSetTree.
Returns
A DynList containing copies of all elements from s.

Definition at line 884 of file ah-convert.H.

References Aleph::DynList< T >::append(), and FunctionalMethods< Container, T >::for_each().

Referenced by TEST(), and TEST().

◆ settree_to_stdset()

template<typename Key , template< typename, class > class Tree, class Compare >
std::set< Key > Aleph::settree_to_stdset ( const DynSetTree< Key, Tree, Compare > &  s)

Convert a DynSetTree to a std::set.

Template Parameters
KeyThe key type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
sThe source DynSetTree.
Returns
A std::set containing copies of all elements from s.

Definition at line 964 of file ah-convert.H.

References FunctionalMethods< Container, T >::for_each().

Referenced by TEST().

◆ settree_to_vector()

template<typename Key , template< typename, class > class Tree, class Compare >
std::vector< Key > Aleph::settree_to_vector ( const DynSetTree< Key, Tree, Compare > &  s)

Convert a DynSetTree to a std::vector.

Template Parameters
KeyThe key type.
TreeThe tree implementation template.
CompareThe comparison functor.
Parameters
sThe source DynSetTree.
Returns
A std::vector containing copies of all elements from s.

Definition at line 945 of file ah-convert.H.

References FunctionalMethods< Container, T >::for_each(), Aleph::DynArray< T >::reserve(), and Aleph::DynSetTree< Key, Tree, Compare >::size().

Referenced by TEST(), and TEST().

◆ shellsort()

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::shellsort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Sort a dynamic array using Shell sort.

Shell sort is an optimization of insertion sort that allows exchange of elements that are far apart. It works by sorting elements at various gap intervals, progressively reducing the gap until it becomes 1.

Algorithm

Uses Ciura's gap sequence (empirically optimal): 1, 4, 10, 23, 57, 132, ... Extended with 2.25x multiplier for larger arrays. For each gap h (from largest to smallest): Perform h-sorting (insertion sort with stride h) When h=1, the array becomes fully sorted.

Characteristics

  • Time complexity: O(n^1.3) empirical with Ciura sequence
  • Space complexity: O(1) - in-place
  • Stability: Not stable
  • Adaptive: Partially (benefits from presortedness)

When to Use

  • Medium-sized arrays (hundreds to thousands of elements)
  • When simplicity and low overhead matter
  • Embedded systems with limited stack space
  • When code size is a concern
Template Parameters
TElement type (must be copy-assignable and comparable).
CompareComparison functor type (default: Aleph::less<T>).
Parameters
[in,out]aThe dynamic array to sort.
cmpComparison functor.
See also
insertion_sort(), quicksort()

Definition at line 3650 of file tpl_sort_utils.H.

References and, cmp(), h, and Aleph::DynArray< T >::size().

Referenced by benchmark_array_algorithms().

◆ shift_lines_to_left()

std::string Aleph::shift_lines_to_left ( const std::string &  str,
const size_t  n 
)
inline

Indent every line in a multi-line std::string by n spaces.

Parameters
[in]strInput text.
[in]nNumber of spaces.
Returns
Indented text.

Definition at line 1237 of file ah-string-utils.H.

References fill(), and split_to_list().

Referenced by TEST().

◆ shuffle()

template<typename T , template< typename > class C>
auto Aleph::shuffle ( const C< T > &  c)

Randomly shuffle a sequence.

shuffle(c) produces a random permutation of container c

Parameters
[in]ccontainer to be shuffled
Returns
a shuffled permutation of c

Definition at line 419 of file tpl_random_queue.H.

References FunctionalMethods< Container, T >::for_each(), Aleph::Random_Set< T >::get(), Aleph::Random_Set< T >::is_empty(), and Aleph::Random_Set< T >::put().

Referenced by generate_random_data(), run_experiment(), RankTreeTest< Tree >::SetUp(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and visual_demonstration().

◆ shuffle_ptr()

template<typename T , template< typename > class C>
C< T * > Aleph::shuffle_ptr ( const C< T > &  c)

Return a random sequence of pointers to items of a sequence.

Parameters
[in]ccontainer to be shuffled
Returns
a shuffled permutation of pointer to items in the sequence c

Definition at line 440 of file tpl_random_queue.H.

References FunctionalMethods< Container, T >::for_each(), Aleph::Random_Set< T >::get(), Aleph::Random_Set< T >::is_empty(), and Aleph::Random_Set< T >::put().

◆ sift_down() [1/4]

template<typename T , class Compare >
void Aleph::sift_down ( DynArray< T > &  a,
const size_t  l,
const size_t  r,
Compare &  cmp 
)
inlinenoexcept

Restore heap order by moving an element down.

Restores the heap invariant in the subrange [l, r] by sifting the element initially at index l downward until the heap property holds. All the comparisons come before the moves, so that if one throws, nothing has moved.

Exceptions
whatthe comparison throws, with the subrange as it was; nothing when it is noexcept.
Note
A move of the items that throws leaves the subrange out of order, and ends the program when the comparison does not throw.

Definition at line 239 of file tpl_dynArrayHeap.H.

References cmp(), Aleph::dynarrayheap_detail::down_index(), l, r, and Aleph::dynarrayheap_detail::shift().

◆ sift_down() [2/4]

template<typename T , class Compare >
void Aleph::sift_down ( DynArray< T > &  table,
const long  n,
const Compare &  cmp 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 3749 of file tpl_sort_utils.H.

References cmp().

◆ sift_down() [3/4]

template<typename T , class Compare >
void Aleph::sift_down ( DynArray< T > &  table,
const long  start,
const long  n,
const Compare &  cmp 
)
inline

Move an element down in a heap to restore heap property.

Parameters
tableThe dynamic array containing the heap.
startThe index of the element to sift down (1-based).
nThe current size of the heap.
cmpComparison functor.

Definition at line 3723 of file tpl_sort_utils.H.

References back_index(), and cmp().

◆ sift_down() [4/4]

template<typename T , class Compare >
void Aleph::sift_down ( T *  ptr,
const size_t  l,
const size_t  r,
Compare &  cmp 
)
inline

Restore the heap property by moving the element at position l downwards.

This operation assumes the subtrees below l satisfy the heap property and then restores it for the whole range [l, r]. If the comparison throws, the element goes back to l.

Template Parameters
Telement type
Comparecomparator defining the heap order
Parameters
[in,out]ptr1-based array backing the heap
[in]lleft boundary (inclusive) / starting index
[in]rright boundary (inclusive)
[in]cmpcomparison criteria
Exceptions
whatthe comparison throws, with the range as it was if the exchange of two items does not throw.

Definition at line 280 of file tpl_arrayHeap.H.

References cmp(), l, r, and Aleph::arrayheap_detail::sift_down().

Referenced by Aleph::ArrayHeap< T, Compare >::getMin(), heapsort(), TEST(), TEST(), and TEST().

◆ sift_down_subrange()

template<typename T , class Compare >
void Aleph::sift_down_subrange ( DynArray< T > &  a,
long  start,
const long  n,
const long  offset,
const Compare &  cmp 
)
inline

Sift down operation for heapsort on a DynArray subrange.

Definition at line 4007 of file tpl_sort_utils.H.

References cmp(), and offset.

Referenced by heapsort_subrange().

◆ sift_down_up()

template<typename T , class Compare >
void Aleph::sift_down_up ( T *  ptr,
const size_t  l,
const size_t  i,
const size_t  r,
Compare &  cmp 
)
inline

Restore the heap property by sifting down and then sifting up.

Used when the element at i might need to move in either direction.

Template Parameters
Telement type
Comparecomparator defining the heap order
Parameters
[in,out]ptr1-based array backing the heap
[in]lleft boundary (inclusive)
[in]iposition to update
[in]rright boundary (inclusive)
[in]cmpcomparison criteria
Exceptions
whatthe comparison throws, with the range as it was if the exchange of two items does not throw.

Definition at line 302 of file tpl_arrayHeap.H.

References cmp(), l, r, Aleph::arrayheap_detail::sift_down(), and Aleph::arrayheap_detail::undo_sift_down().

Referenced by Aleph::ArrayHeap< T, Compare >::remove(), TEST(), and Aleph::ArrayHeap< T, Compare >::update().

◆ sift_up() [1/3]

template<typename T , class Compare >
size_t Aleph::sift_up ( DynArray< T > &  a,
const size_t  l,
const size_t  r,
Compare &  cmp 
)
inlinenoexcept

Restore heap order by moving an element up.

Restores the heap invariant in the subrange [l, r] by sifting the element initially at index r upward until the heap property holds. All the comparisons come before the moves, so that if one throws, nothing has moved.

Returns
The final index where the sifted element ended up.
Exceptions
whatthe comparison throws, with the subrange as it was; nothing when it is noexcept.
Note
A move of the items that throws leaves the subrange out of order, and ends the program when the comparison does not throw.

Definition at line 211 of file tpl_dynArrayHeap.H.

References cmp(), l, r, Aleph::dynarrayheap_detail::shift(), and Aleph::dynarrayheap_detail::up_index().

◆ sift_up() [2/3]

template<typename T , class Compare >
void Aleph::sift_up ( DynArray< T > &  table,
const long  n,
const Compare &  cmp 
)
inline

Move an element up in a heap to restore heap property.

Parameters
tableThe dynamic array containing the heap.
nThe index of the element to sift up (1-based).
cmpComparison functor.

Definition at line 3701 of file tpl_sort_utils.H.

References back_index(), and cmp().

◆ sift_up() [3/3]

template<typename T , class Compare >
T & Aleph::sift_up ( T *  ptr,
const size_t  l,
const size_t  r,
Compare &  cmp 
)
inline

Restore the heap property by moving the element at position r upwards.

This operation assumes the range [l, r-1] already satisfies the heap property and then restores it for the whole range [l, r]. If the comparison throws, the element goes back to r.

Template Parameters
Telement type
Comparecomparator defining the heap order
Parameters
[in,out]ptr1-based array backing the heap
[in]lleft boundary (inclusive)
[in]rright boundary (inclusive)
[in]cmpcomparison criteria
Returns
a mutable reference to the element after it has been placed
Exceptions
whatthe comparison throws, with the range as it was if the exchange of two items does not throw.

Definition at line 257 of file tpl_arrayHeap.H.

References cmp(), l, r, and Aleph::arrayheap_detail::sift_up().

Referenced by Aleph::ArrayHeap< T, Compare >::insert_ne(), Aleph::ArrayHeap< T, Compare >::insert_ne(), TEST(), TEST(), and TEST().

◆ signed_bits()

constexpr Bit_Column Aleph::signed_bits ( const unsigned  n)
constexpr

Column of n bits with sign: the integers of [-2^(n-1), 2^(n-1) - 1].

Parameters
[in]nNumber of bits, from 1 to 64.
Returns
The column.
Exceptions
std::domain_errorif n is 0 or greater than 64. As a template argument, that is a compile-time error.

Definition at line 146 of file tpl_packed_matrix.H.

References ah_domain_error_if.

◆ sinus()

Geom_Number Aleph::sinus ( const Geom_Number &  x)
inline

Sine of x (wrapper over mpfr).

Definition at line 185 of file point.H.

References sin().

Referenced by Aleph::Point::rotate(), Aleph::Ellipse::sample(), Aleph::RotatedEllipse::sample(), and TEST().

◆ siphash24_hash() [1/3]

size_t Aleph::siphash24_hash ( const char *  key,
std::uint64_t  key0 = 0x0706050403020100ULL,
std::uint64_t  key1 = 0x0f0e0d0c0b0a0908ULL 
)
inlinenoexcept

Definition at line 775 of file hash-fct.H.

References siphash24_hash().

◆ siphash24_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::siphash24_hash ( const Key &  key,
std::uint64_t  key0 = 0x0706050403020100ULL,
std::uint64_t  key1 = 0x0f0e0d0c0b0a0908ULL 
)
noexcept

Definition at line 640 of file hash-fct.H.

References siphash24_hash().

◆ siphash24_hash() [3/3]

size_t Aleph::siphash24_hash ( const std::string &  key,
std::uint64_t  key0 = 0x0706050403020100ULL,
std::uint64_t  key1 = 0x0f0e0d0c0b0a0908ULL 
)
inlinenoexcept

Definition at line 855 of file hash-fct.H.

References siphash24_hash().

◆ size()

template<BinNodeLike Node>
size_t Aleph::size ( Node *  root)
inlinenoexcept

See compute_cardinality_rec(Node * root).

Definition at line 586 of file tpl_binNodeUtils.H.

References compute_cardinality_rec(), and root().

Referenced by Aleph::AhArenaAllocator::AhArenaAllocator(), Aleph::Modular_Matrix< MatrixT >::Modular_Matrix(), __deway_search(), __generate_tree(), __search_deway(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::_collect_sorted_primitive_factor_groups(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::_interpolated_factors_for_main_var(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::_try_lift_primitive_affine_linear_factor_for_main_var(), Aleph::AhArenaAllocator::alloc(), Aleph::AhArenaAllocator::alloc_aligned(), allocate(), Aleph::AhArenaAllocator::allocate(), allocate_zeroed(), Event_Table< void *(void *)>::append_event_to_table(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_combinatorial_embedding_bruteforce(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_combinatorial_embedding_linear_lr(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_nonplanar_certificate(), Event_Table< void *(void *)>::check(), Aleph::parallel_detail::chunk_size(), compiler_dump_ssa_function(), Aleph::FFT< Real >::OverlapAddBank::convolve_impl(), Aleph::detail::crc32_add_bytes(), csv_distinct(), csv_get_column(), csv_group_by(), csv_inner_join(), csv_is_rectangular(), csv_select_columns(), csv_unique(), Aleph::AhArenaAllocator::dealloc(), Aleph::AhArenaAllocator::deallocate(), Aleph::detail::Paged_Bounded_String_Codec< Capacity, SizeType >::decode(), demo_grid_networks(), demo_memory_stats(), demo_modular_linalg(), deway_search(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::dominance_frontiers(), Aleph::Compiler_C_Backend::Emitter::emit_prototypes(), Aleph::FFT< Real >::ISTFTProcessor::ensure_pending_size(), Aleph::patricia_trie_detail::Bitwise_Trie_Utils< UInt >::erase_key(), Event_Table< void *(void *)>::execute_event(), Moved_From_Case< Graph_Life >::fingerprint(), generate_graphpic(), generate_layered_network(), generate_tree(), Aleph::BinNodeInfixIterator< Node >::get_pos(), in_place_transpose(), interpreter_dump_environment(), interpreter_dump_globals(), interpreter_value_to_string(), interpreter_values_equal(), Moved_From_Case< Field_Grid >::is_empty(), Event_Table< void *(void *)>::is_registered(), Aleph::FFT< Real >::istft_impl(), Aleph::howard_detail::karp_by_component(), LLVMFuzzerTestOneInput(), Aleph::Compiler_SSA_Lowering::lower_function_internal(), main(), main(), Aleph::FFT< Real >::matrix_shape(), Aleph::FFT< Real >::OverlapAddBank::max_batch_length(), Aleph::Gen_Centroid_Decomposition< GT, SA >::max_centroid_level(), graph_oracles::max_matching(), Aleph::NTT< MOD, ROOT >::max_transform_size_impl(), Aleph::NTT< MOD, ROOT >::multipoint_eval_recursive(), Aleph::BinNodeInfixIterator< Node >::next_ne(), operator new(), operator new(), operator new(), operator new(), operator new[](), operator new[](), operator new[](), operator new[](), Aleph::MonotonePolygonTriangulation::operator()(), Aleph::FFT< Real >::overlap_add_frames(), Aleph::FFT< Real >::OverlapAddBank::pprocess_block(), Aleph::FFT< Real >::prfft_batch(), Aleph::FFT< Real >::OverlapAddBank::process_block(), Aleph::FFT< Real >::OverlapAddBank::process_chunk_batch_impl(), Aleph::FFT< Real >::ptransform_batch(), Aleph::NTT< MOD, ROOT >::ptransform_batch(), Event_Table< void *(void *)>::register_event(), Event_Table< void *(void *)>::register_event(), Aleph::Compiler_SSA_Detail::rename_recursive(), Aleph::Compiler_Lexer::reset(), Aleph::FFT< Real >::rfft_batch(), search_deway(), Aleph::FunctionalMixin< Derived, Type >::sliding(), solve_transportation(), Aleph::pdq_detail::sort_loop(), stl_distinct(), stl_drop(), stl_group_by(), stl_take_last(), stl_tally(), Aleph::FFT< Real >::tensor3_shape(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::FFT< Real >::transform_batch(), Aleph::NTT< MOD, ROOT >::transform_batch(), Aleph::NTT< MOD, ROOT >::transformed_batch(), transpose(), Aleph::FFT< Real >::transpose_spectrogram_layout_impl(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), Event_Table< void *(void *)>::unregister_event(), Moved_From_Case< AABBTree >::use(), Moved_From_Case< F::STFTProcessor >::use(), Moved_From_Case< Graph_Life >::use(), Aleph::FFT< Real >::BatchedSTFTProcessor::validate_batch_size(), Aleph::FFT< Real >::BatchedISTFTProcessor::validate_batch_size(), Aleph::Simplex< T >::verify_solution(), Aleph::RevisedSimplex< T >::verify_solution(), welsh_powell_coloring(), and Aleph::CA::Reproductions::write_histogram_csv().

◆ skewness()

template<typename Container >
auto Aleph::skewness ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute skewness (measure of asymmetry).

Positive skewness: right tail is longer Negative skewness: left tail is longer Zero skewness: symmetric distribution

Uses the adjusted Fisher-Pearson standardized moment coefficient.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Skewness value
Exceptions
std::invalid_argumentif container has fewer than 3 elements

Definition at line 523 of file stat_utils.H.

References ah_invalid_argument_if, diff(), m, mean(), skewness(), and stddev().

Referenced by compute_all_stats(), skewness(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ skip_block_comment()

void Aleph::skip_block_comment ( std::ifstream &  input_stream,
const std::string &  open = "/" "*",
const std::string &  close = "*" "/" 
)
inline

Skip a block comment (C-style)

Reads and discards characters until the closing sequence is found. Updates line/column tracking appropriately.

Parameters
input_streamThe input file stream
openOpening sequence (default "/ *")
closeClosing sequence (default "* /")
Exceptions
ParseErrorif EOF is reached before comment closes
Note
The open parameter is for documentation; this function assumes the opening sequence has already been consumed.

Definition at line 837 of file parse_utils.H.

References ah_parse_error, current_col_number, current_line_number, and skip_block_comment().

Referenced by skip_block_comment(), skip_whitespace_and_comments(), TEST_F(), and TEST_F().

◆ skip_line_comment()

void Aleph::skip_line_comment ( std::ifstream &  input_stream)
inline

Skip a line comment (// style or # style)

Assumes the comment marker has already been read. Advances the stream to the end of the line (or EOF).

Parameters
input_streamThe input file stream
Example
if (peek_char(input) == '/' && peek_next == '/') {
read_char_from_stream(input); // consume first /
read_char_from_stream(input); // consume second /
}
void skip_line_comment(std::ifstream &input_stream)
Skip a line comment (// style or # style)

Definition at line 808 of file parse_utils.H.

References current_col_number, current_line_number, and skip_line_comment().

Referenced by skip_line_comment(), skip_whitespace_and_comments(), and TEST_F().

◆ skip_white_spaces()

void Aleph::skip_white_spaces ( std::ifstream &  input_stream)
inline

Skip whitespace characters in the input stream.

Advances the stream position past any whitespace characters (spaces, tabs, newlines, etc.). After this call, the next character in the stream will be non-whitespace (or EOF).

Parameters
input_streamThe input file stream
Exceptions
std::out_of_rangeif EOF is reached while skipping
Example
// Input: " hello"
// Stream now positioned at 'h'
void skip_white_spaces(std::ifstream &input_stream)
Skip whitespace characters in the input stream.

Definition at line 317 of file parse_utils.H.

References read_char_from_stream(), and skip_white_spaces().

Referenced by expect(), expect_char(), get_token(), load_binary_number(), load_char_literal(), load_deway_number(), load_double(), load_escaped_string(), load_hex_number(), load_identifier(), load_number(), load_octal_number(), load_string(), skip_white_spaces(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and try_char().

◆ skip_whitespace_and_comments()

void Aleph::skip_whitespace_and_comments ( std::ifstream &  input_stream)
inline

Skip whitespace and comments (C/C++ style)

Skips spaces, tabs, newlines, line comments (//), and block comments. This is a common operation in lexers.

Parameters
input_streamThe input file stream
Example
// Now positioned at next meaningful token
void skip_whitespace_and_comments(std::ifstream &input_stream)
Skip whitespace and comments (C/C++ style)

Definition at line 888 of file parse_utils.H.

References current_col_number, next(), peek_char(), read_char_from_stream(), skip_block_comment(), skip_line_comment(), and skip_whitespace_and_comments().

Referenced by skip_whitespace_and_comments(), TEST_F(), TEST_F(), and TEST_F().

◆ snd_hash_fct() [1/4]

size_t Aleph::snd_hash_fct ( const char *  key)
inlinenoexcept

Definition at line 1120 of file hash-fct.H.

References Aleph_Snd_Hash_Seed, and wyhash_hash().

◆ snd_hash_fct() [2/4]

template<typename Key >
requires (not std::is_pointer_v<Key> and not std::is_array_v<Key> and not std::is_same_v<std::remove_cvref_t<Key>, std::string>)
size_t Aleph::snd_hash_fct ( const Key &  key)
inlinenoexcept

Secondary default hash: different distribution from dft_hash_fct.

Uses Aleph_Hash<Key> with a fixed secondary seed so that snd_hash_fct(x) != dft_hash_fct(x) for virtually all inputs. Suitable as the second hash in double-hashing schemes.

Note
Pointer keys intentionally stay on the historical SuperFastHash(&key, sizeof(key), Aleph_Snd_Hash_Seed) path to preserve consistency with the open-addressing hash tables used across the repo.

Definition at line 1108 of file hash-fct.H.

References Aleph_Snd_Hash_Seed.

Referenced by pair_snd_hash_fct(), snd_hash(), AhHashDispatcher< Key, Operation >::snd_hash(), snd_hash_ptr_fct(), TEST(), TEST(), TEST(), and TEST_F().

◆ snd_hash_fct() [3/4]

template<typename Key >
requires std::is_pointer_v<Key>
size_t Aleph::snd_hash_fct ( const Key &  key)
inlinenoexcept

Definition at line 1115 of file hash-fct.H.

References Aleph_Snd_Hash_Seed, and SuperFastHash().

◆ snd_hash_fct() [4/4]

size_t Aleph::snd_hash_fct ( const std::string &  key)
inlinenoexcept

Definition at line 1125 of file hash-fct.H.

References Aleph_Snd_Hash_Seed, and wyhash_hash().

◆ snd_hash_ptr_fct()

template<typename Key >
size_t Aleph::snd_hash_ptr_fct ( const Key &  key)
inlinenoexcept

Definition at line 1131 of file hash-fct.H.

References snd_hash_fct().

Referenced by TEST().

◆ solve_assignment()

template<typename Cost_Type >
AssignmentResult< Cost_Type > Aleph::solve_assignment ( const std::vector< std::vector< Cost_Type > > &  costs)

Solve the assignment problem using min-cost flow.

Given n workers and n tasks with cost matrix C, find an assignment that minimizes total cost where each worker is assigned exactly one task.

This is modeled as min-cost bipartite matching:

  • Source connected to all workers (capacity 1)
  • Workers connected to tasks with costs from matrix
  • Tasks connected to sink (capacity 1)
Template Parameters
Cost_TypeType for costs.
Parameters
costsCost matrix (costs[i][j] = cost of assigning worker i to task j).
Returns
AssignmentResult with optimal assignment.
Complexity
O(n³) using successive shortest paths.
Exceptions
std::invalid_argumentif costs is not a square matrix (any row has a different size than costs.size()).
Warning
With floating costs, a cost of a far larger magnitude than the others, as a large penalty that forbids an assignment, can hide cheaper assignments: see the warning of successive_shortest_paths().
Example
std::vector<std::vector<double>> costs = {
{10, 5, 13},
{3, 9, 18},
{10, 6, 12}
};
auto result = solve_assignment(costs);
for (auto [worker, task] : result.assignments)
std::cout << "Worker " << worker << " -> Task " << task << "\n";
AssignmentResult< Cost_Type > solve_assignment(const std::vector< std::vector< Cost_Type > > &costs)
Solve the assignment problem using min-cost flow.

Definition at line 872 of file tpl_mincost.H.

References ah_invalid_argument_if, Aleph::DynList< T >::append(), Aleph::AssignmentResult< Cost_Type >::assignments, Aleph::DynMapTree< Key, Data, Tree, Compare >::contains(), Aleph::Array< T >::create(), Aleph::AssignmentResult< Cost_Type >::feasible, Aleph::DynMapTree< Key, Data, Tree, Compare >::find(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), row, successive_shortest_paths(), and Aleph::AssignmentResult< Cost_Type >::total_cost.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ solve_circulation()

template<class Net , class GetDemand , class GetLower , template< class > class Maxflow = Dinic_Maximum_Flow>
CirculationResult< typename Net::Flow_Type > Aleph::solve_circulation ( Net &  net,
GetDemand  get_demand,
GetLower  get_lower 
)

Solve a circulation problem with demands.

Given a network where:

  • Each node has a demand d(v): positive = needs flow, negative = produces flow
  • Each edge has lower bound l(e) and upper bound u(e)

Find a circulation f such that:

  • l(e) ≤ f(e) ≤ u(e) for all edges
  • For each node: in_flow - out_flow = demand

Algorithm

  1. Transform to max-flow problem:
    • Take the lower bounds as a mandatory flow, which adjusts the demands: d'(v) = d(v) - l_in(v) + l_out(v)
    • Create super-source connected to nodes with negative demand
    • Create super-sink connected from nodes with positive demand
    • Adjust capacities for lower bounds
  2. Solve max-flow
  3. Check if flow saturates all super-source/sink edges

There is no circulation if a lower bound is negative or above the capacity of its arc, or if the demands do not add up to 0. With a floating flow, an adjusted demand within the rounding of its sum of the demand and the lower bounds of its node, an epsilon of the sum of their magnitudes by each of them and two more, is 0, so that bounds that balance but for rounding are a circulation.

Template Parameters
NetNetwork type.
GetDemandFunctor returning node demand.
GetLowerFunctor returning edge lower bound.
MaxflowMax-flow algorithm to use.
Parameters
netNetwork (modified during computation).
get_demandReturns demand for each node.
get_lowerReturns the lower bound for each arc.
Returns
CirculationResult with feasibility and flow values: the flow of the circulation, if there is one, else the lower bounds.
Exceptions
std::bad_allocif there is not enough memory. Then the network is as it was, but for its flows, which are 0, unless the removal of the super nodes, which allocates, fails too.
Example
// ... build network ...
auto result = solve_circulation(net,
[](Node* n) { return node_demand[n]; },
[](Arc* a) { return arc_lower[a]; });
if (result.feasible)
std::cout << "Feasible circulation exists!\n";
WeightedDigraph::Node Node
WeightedDigraph::Arc Arc
CirculationResult< typename Net::Flow_Type > solve_circulation(Net &net, GetDemand get_demand, GetLower get_lower)
Solve a circulation problem with demands.
Definition net_apps.H:151

Definition at line 151 of file net_apps.H.

References and, Aleph::DynList< T >::append(), Aleph::CirculationResult< Flow_Type >::feasible, Aleph::CirculationResult< Flow_Type >::flow, LocateFunctions< Container, Type >::get_it(), Aleph::Net_Graph< NodeT, ArcT >::get_sink_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), Aleph::Net_Graph< NodeT, ArcT >::get_src_nodes(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), and Aleph::Net_Graph< NodeT, ArcT >::remove_node().

Referenced by design_survey(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ solve_multicommodity_flow()

template<class Net >
MCF_Result< typename Net::Flow_Type > Aleph::solve_multicommodity_flow ( Net &  net)

Solve multi-commodity flow problem.

Convenience function to solve MCF on a network.

Template Parameters
NetNetwork type.
Parameters
[in,out]netNetwork with commodities defined.
Returns
Result with status and cost.
See also
MCF_LP_Solver

Definition at line 695 of file tpl_multicommodity.H.

References Aleph::MCF_LP_Solver< Net >::solve().

Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ solve_project_selection()

template<typename Value_Type >
ProjectSelectionResult< Value_Type > Aleph::solve_project_selection ( const std::vector< Project< Value_Type > > &  projects)

Solve project selection problem using max-flow.

Given a set of projects with profits/costs and prerequisite constraints, select a subset of projects to maximize total profit.

Constraint: If project A is selected, all its prerequisites must also be selected.

Problem Formulation

This is the "closure" problem, solved by min-cut:

  • Create source connected to all positive-profit projects (capacity = profit)
  • Create sink connected from all negative-profit projects (capacity = -profit)
  • Create infinite-capacity edges for prerequisites
  • Max profit = sum of positive profits - min cut
Template Parameters
Value_TypeType for profit values.
Parameters
projectsVector of projects.
Returns
ProjectSelectionResult with optimal selection.
Example
std::vector<Project<double>> projects = {
{0, 100, {}, "Project A"}, // Profit 100, no prerequisites
{1, 50, {0}, "Project B"}, // Profit 50, requires A
{2, -70, {}, "Infrastructure"} // Cost 70, no prerequisites
};
auto result = solve_project_selection(projects);
std::cout << "Max profit: " << result.max_profit << "\n";
ProjectSelectionResult< Value_Type > solve_project_selection(const std::vector< Project< Value_Type > > &projects)
Solve project selection problem using max-flow.
Definition net_apps.H:397

Definition at line 397 of file net_apps.H.

References Aleph::DynSetTree< Key, Tree, Compare >::contains(), dinic_maximum_flow(), Aleph::DynListQueue< T >::front(), Aleph::DynListQueue< T >::get(), GraphCommon< GT, Node, Arc >::get_connected_node(), GraphCommon< GT, Node, Arc >::get_src_node(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::DynSetTree< Key, Tree, Compare >::insert(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::DynListQueue< T >::is_empty(), Aleph::ProjectSelectionResult< Value_Type >::max_profit, min_cut(), Aleph::DynListQueue< T >::put(), Aleph::ProjectSelectionResult< Value_Type >::selected, Aleph::ProjectSelectionResult< Value_Type >::total_cost, and Aleph::ProjectSelectionResult< Value_Type >::total_revenue.

Referenced by demo_project_selection(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ solve_transportation()

template<typename Cost_Type >
TransportationResult< Cost_Type > Aleph::solve_transportation ( const std::vector< Cost_Type > &  supplies,
const std::vector< Cost_Type > &  demands,
const std::vector< std::vector< Cost_Type > > &  costs 
)

Solve the transportation problem using min-cost flow.

Given:

  • m supply points with capacities s[i]
  • n demand points with requirements d[j]
  • Cost matrix C[i][j] for shipping from i to j

Find the minimum cost way to satisfy all demands.

Template Parameters
Cost_TypeType for costs and quantities.
Parameters
suppliesSupply at each source.
demandsDemand at each destination.
costsCost matrix (costs[i][j] = unit cost from i to j).
Returns
TransportationResult with optimal shipments.
Exceptions
std::invalid_argumentif costs.size() != supplies.size(), any costs[i].size() != demands.size(), or any supply/demand is negative.
Warning
With floating costs, a cost of a far larger magnitude than the others, as a large penalty that forbids a route, can hide cheaper shipments: see the warning of successive_shortest_paths().
Example
std::vector<double> supplies = {100, 150, 200}; // 3 factories
std::vector<double> demands = {150, 100, 200}; // 3 warehouses
std::vector<std::vector<double>> costs = {
{10, 8, 5}, // Factory 0 to warehouses
{6, 4, 3}, // Factory 1 to warehouses
{9, 7, 8} // Factory 2 to warehouses
};1
auto result = solve_transportation(supplies, demands, costs);
TransportationResult< Cost_Type > solve_transportation(const std::vector< Cost_Type > &supplies, const std::vector< Cost_Type > &demands, const std::vector< std::vector< Cost_Type > > &costs)
Solve the transportation problem using min-cost flow.

Definition at line 1003 of file tpl_mincost.H.

References ah_invalid_argument_if, arcs, Aleph::Array< T >::create(), Aleph::TransportationResult< Cost_Type >::feasible, Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), m, Aleph::mincost_detail::same_total(), Aleph::TransportationResult< Cost_Type >::shipments, OhashCommon< HashTbl, Key >::size(), size(), successive_shortest_paths(), and Aleph::TransportationResult< Cost_Type >::total_cost.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ solve_transshipment()

template<class Net , class GetDemand >
TransshipmentResult< typename Net::Flow_Type > Aleph::solve_transshipment ( Net &  net,
GetDemand  get_demand 
)

Solve minimum cost transshipment problem.

Given a network where nodes have supply/demand values, find the minimum cost way to satisfy all demands from supplies.

This is solved by:

  1. Creating a super-source connected to all supply nodes
  2. Creating a super-sink connected from all demand nodes, and joining to them, with arcs of capacity 0, the other sources and sinks, as a node without arcs in that supplies nothing
  3. Solving min-cost max-flow
  4. Checking if all demands are satisfied
Template Parameters
NetNetwork type with cost.
GetDemandFunctor to get node demand.
Parameters
netNetwork with costs.
get_demandFunction returning demand for each node.
Returns
TransshipmentResult with feasibility and cost.
Exceptions
std::bad_allocif there is not enough memory. Then the super nodes are removed, unless their removal, which allocates, fails too.
Note
The network topology (nodes and arcs) is preserved: temporary super-source/super-sink nodes are removed before returning. However, arc->flow fields on original arcs are modified to reflect the optimal transshipment flow. NODE_COOKIE on all nodes is overwritten during computation and should not be relied upon after the call.
Warning
With floating costs, a cost of a far larger magnitude than the others, as a large penalty, can hide cheaper flows: see the warning of successive_shortest_paths().
Example
// ... build network ...
std::map<Node*, double> demands;
demands[factory] = 100; // supplies 100
demands[warehouse] = 0; // transshipment
demands[customer] = -100; // demands 100
auto result = solve_transshipment(net, [&](Node* n) {
return demands[n];
});
TransshipmentResult< typename Net::Flow_Type > solve_transshipment(Net &net, GetDemand get_demand)
Solve minimum cost transshipment problem.

Definition at line 706 of file tpl_mincost.H.

References Aleph::DynList< T >::append(), Aleph::TransshipmentResult< Flow_Type >::feasible, LocateFunctions< Container, Type >::get_it(), Aleph::Net_Graph< NodeT, ArcT >::get_sink_nodes(), Aleph::Net_Graph< NodeT, ArcT >::get_src_nodes(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_node(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), Aleph::Net_Graph< NodeT, ArcT >::remove_node(), Aleph::mincost_detail::same_total(), successive_shortest_paths(), Aleph::TransshipmentResult< Flow_Type >::total_cost, and Aleph::TransshipmentResult< Flow_Type >::total_flow.

Referenced by TEST_F(), and TYPED_TEST().

◆ sort() [1/4]

template<typename T , class Cmp = Aleph::less<T>>
Array< T > Aleph::sort ( Array< T > &&  a,
Cmp &&  cmp = Cmp() 
)
inline

Sorts an rvalue Array in place and returns it.

Efficient move-based sorting that avoids copying.

Template Parameters
TElement type
CmpComparison functor type
Parameters
aThe array to sort (will be moved from)
cmpComparison functor
Returns
The sorted array (moved)
Note
The original container is left in valid but unspecified state

Definition at line 278 of file ahSort.H.

References cmp(), and introsort().

◆ sort() [2/4]

template<typename T , class Cmp = Aleph::less<T>>
Array< T > Aleph::sort ( const Array< T > &  a,
Cmp &&  cmp = Cmp() 
)
inline

Returns a sorted copy of an Array.

Creates a copy of the input array and sorts it using quicksort.

Template Parameters
TElement type
CmpComparison functor type (default: Aleph::less<T>)
Parameters
aThe array to sort (not modified)
cmpComparison functor
Returns
A new array with elements in sorted order
Note
Uses quicksort, O(n log n) average time, NOT stable
See also
in_place_sort() for sorting without copying

Definition at line 266 of file ahSort.H.

References cmp(), and introsort().

◆ sort() [3/4]

template<typename T , class Cmp = Aleph::less<T>>
DynArray< T > Aleph::sort ( const DynArray< T > &  a,
Cmp &&  cmp = Cmp() 
)
inline

Returns a sorted copy of a DynArray.

Creates a copy of the input array and sorts it using quicksort.

Template Parameters
TElement type
CmpComparison functor type (default: Aleph::less<T>)
Parameters
aThe array to sort (not modified)
cmpComparison functor
Returns
A new array with elements in sorted order
Note
Uses quicksort, O(n log n) average time, NOT stable
See also
in_place_sort() for sorting without copying

Definition at line 234 of file ahSort.H.

References cmp(), and introsort().

Referenced by Container< Ctype >::Container(), build_combs(), demo_kruskal_simulation(), generate_random_data(), insert_n_random_items_in_map(), Aleph::AlDomain< T >::keys(), LLVMFuzzerTestOneInput(), main(), run_performance_comparison(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::AlDomain< T >::to_str(), TYPED_TEST_P(), TYPED_TEST_P(), TYPED_TEST_P(), TYPED_TEST_P(), TYPED_TEST_P(), TYPED_TEST_P(), TYPED_TEST_P(), and TYPED_TEST_P().

◆ sort() [4/4]

template<typename T , class Cmp = Aleph::less<T>>
DynArray< T > Aleph::sort ( DynArray< T > &&  a,
Cmp &&  cmp = Cmp() 
)
inline

Sorts an rvalue DynArray in place and returns it.

Efficient move-based sorting that avoids copying.

Template Parameters
TElement type
CmpComparison functor type
Parameters
aThe array to sort (will be moved from)
cmpComparison functor
Returns
The sorted array (moved)
Note
The original container is left in valid but unspecified state

Definition at line 255 of file ahSort.H.

References cmp(), and introsort().

◆ sort_range() [1/2]

template<typename Range >
void Aleph::sort_range ( Range &  r)
inline

Sort a whole range in place using the default < ordering.

Template Parameters
Rangea sortable random-access range.
Parameters
[in,out]rrange to sort in place.

Definition at line 243 of file ah-ranges.H.

References r.

◆ sort_range() [2/2]

template<typename Range , typename Cmp >
void Aleph::sort_range ( Range &  r,
Cmp  cmp 
)
inline

Sort a whole range in place, portably across the ranges divide.

Uses std::ranges::sort when the toolchain provides reliable ranges support (ALEPH_HAS_RANGES) — which is what clang-tidy's use-ranges check recommends — and falls back to std::sort otherwise, so the call still compiles on C++20 toolchains without a complete <ranges> implementation.

Intended for sorting an entire container in place. For sub-ranges or raw pointer ranges, call std::sort directly.

Template Parameters
Rangea sortable random-access range.
Cmpa strict-weak-ordering comparator.
Parameters
[in,out]rrange to sort in place.
[in]cmpcomparator (a, b) -> bool (true if a precedes b).

Definition at line 227 of file ah-ranges.H.

References cmp(), and r.

Referenced by stl_sort(), and stl_sort_by().

◆ sort_ranked_moves()

template<typename Move , typename Priority , typename BetterPriority >
void Aleph::sort_ranked_moves ( Array< RankedMove< Move, Priority > > &  moves,
BetterPriority  better_priority,
const bool  prefer_killer,
const bool  prefer_history 
)

Sort one materialized move batch using priority and optional hooks.

The ordering is:

  1. killer moves first, if enabled,
  2. greater history score first, if enabled,
  3. better priority first according to better_priority,
  4. original domain order as deterministic tie-breaker.
Template Parameters
MoveConcrete move type.
PriorityNumeric priority type.
BetterPriorityBinary predicate (Priority, Priority) -> bool.
Parameters
movesBatch of ranked moves to sort in-place.
better_priorityComparator where true means the first priority is better.
prefer_killerIf true, moves with .killer == true are promoted.
prefer_historyIf true, moves are ordered by descending .history_score.

Definition at line 295 of file search_move_ordering.H.

References and, Aleph::RankedMove< Move, Priority >::history_score, introsort(), Aleph::RankedMove< Move, Priority >::killer, Aleph::RankedMove< Move, Priority >::ordinal, and Aleph::RankedMove< Move, Priority >::priority.

Referenced by Aleph::Alpha_Beta< Domain >::collect_ordered_moves(), Aleph::Branch_And_Bound< Domain, ObjectivePolicy >::collect_ordered_moves(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ split() [1/2]

std::vector< std::string > Aleph::split ( const std::string &  s,
const char  delim 
)
inline

Split a std::string by a single delimiter character.

Parameters
[in]sInput std::string.
[in]delimDelimiter character.
Returns
Vector of tokens (including empty tokens, as getline produces).

Definition at line 743 of file ah-string-utils.H.

References split().

◆ split() [2/2]

std::vector< std::string > & Aleph::split ( const std::string &  s,
const char  delim,
std::vector< std::string > &  elems 
)
inline

Split a std::string by a single delimiter character.

This overload appends tokens to an existing vector.

Parameters
[in]sInput std::string.
[in]delimDelimiter character.
[in,out]elemsOutput vector; tokens are appended.
Returns
Reference to elems.

Definition at line 725 of file ah-string-utils.H.

References split().

Referenced by demo_formatting(), demo_practical(), demo_splitting(), divide_and_conquer_partition_dp(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::insert_descend(), Aleph::RadixTree< T, Char >::insert_impl(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::insert_one(), Aleph::Naive_Suffix_Tree::insert_suffix(), load_digraph(), main(), matrix_chain_order(), split(), split(), split(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ split_camel_case() [1/2]

DynList< std::string > Aleph::split_camel_case ( const char *const  str)
inline

Split a camelCase / PascalCase std::string into tokens.

A new token starts at each upper-case character.

Parameters
[in]strNull-terminated input std::string.
Returns
List of tokens.

Definition at line 673 of file ah-string-utils.H.

References Aleph::DynList< T >::append().

Referenced by split_camel_case(), and TEST().

◆ split_camel_case() [2/2]

DynList< std::string > Aleph::split_camel_case ( const std::string &  str)
inline

Split a camelCase / PascalCase std::string into tokens.

Parameters
[in]strInput std::string.
Returns
List of tokens.

Definition at line 700 of file ah-string-utils.H.

References split_camel_case().

◆ split_n()

DynList< std::string > Aleph::split_n ( const std::string &  str,
const size_t  n 
)
inline

Split a std::string into n parts.

The first n-1 parts have length str.size() / n. The last part receives the remainder.

Parameters
[in]strInput std::string.
[in]nNumber of parts.
Returns
List with exactly n elements.
Exceptions
std::range_errorIf n == 0 or n > str.size().

Definition at line 868 of file ah-string-utils.H.

References ah_range_error_if, and, Aleph::DynList< T >::append(), k, and Aleph::DynList< T >::size().

Referenced by TEST(), and TEST().

◆ split_pos()

std::pair< std::string, std::string > Aleph::split_pos ( const std::string &  str,
const size_t  pos 
)
inline

Split a std::string at a fixed position.

Parameters
[in]strInput std::string.
[in]posSplit position (0..str.size()).
Returns
Pair {left, right} where left.size() == pos.
Exceptions
std::range_errorIf pos > str.size().

Definition at line 839 of file ah-string-utils.H.

References ah_range_error_if.

Referenced by demo_splitting(), main(), TEST(), and TEST().

◆ split_string() [1/2]

template<template< typename > class Container = DynList>
Container< std::string > Aleph::split_string ( const std::string &  s,
const std::string &  delim 
)
inline

Split a std::string by a set of delimiter characters.

The delimiter std::string is treated as a set: any character in delim separates tokens.

Template Parameters
ContainerOutput container template accepting std::string and supporting append(const std::string&).
Parameters
[in]sInput std::string.
[in]delimDelimiter character set.
Returns
Container of tokens. Empty input yields an empty container.

Definition at line 762 of file ah-string-utils.H.

References split_string().

Referenced by split_string(), split_string(), TEST(), and TEST().

◆ split_string() [2/2]

DynList< std::string > Aleph::split_string ( const std::string &  str,
char  delimiter 
)
inline

Split a string by a delimiter.

Parameters
strThe string to split
delimiterCharacter to split on
Returns
List of substrings

Definition at line 1630 of file parse_utils.H.

References Aleph::DynList< T >::append(), and split_string().

◆ split_text_into_lines()

DynList< std::string > Aleph::split_text_into_lines ( const std::string &  text)
inline

Split a text into lines by "\n".

Parameters
[in]textInput text.
Returns
List of lines.

Definition at line 1069 of file ah-string-utils.H.

References split_to_list().

Referenced by align_text_to_left_except_first(), justify_line_except_first(), TEST(), and TEST().

◆ split_text_into_words()

DynList< std::string > Aleph::split_text_into_words ( const std::string &  text)
inline

Split a text into whitespace-separated words.

Parameters
[in]textInput text.
Returns
List of words.

Definition at line 1055 of file ah-string-utils.H.

References Aleph::DynList< T >::append().

Referenced by align_text_to_left(), justify_text(), and TEST().

◆ split_to_array()

Array< std::string > Aleph::split_to_array ( const std::string &  s,
const std::string &  delim 
)
inline

Split a std::string into an Aleph::Array<std::string>.

Parameters
[in]sInput std::string.
[in]delimDelimiter character set.
Returns
Array of tokens.

Definition at line 827 of file ah-string-utils.H.

Referenced by TEST(), TEST(), and TEST().

◆ split_to_list()

DynList< std::string > Aleph::split_to_list ( const std::string &  s,
const std::string &  delim 
)
inline

Split a std::string into an Aleph::DynList<std::string>.

Parameters
[in]sInput std::string.
[in]delimDelimiter character set.
Returns
List of tokens.

Definition at line 793 of file ah-string-utils.H.

Referenced by shift_lines_to_left(), split_text_into_lines(), TEST(), TEST(), TEST(), TEST(), and to_Pascalcase().

◆ square_root()

◆ ssp_info()

template<class Net >
SSP_Node_Info< typename Net::Flow_Type > & Aleph::ssp_info ( typename Net::Node *  p)
inlinenoexcept

Access SSP node info.

Definition at line 118 of file tpl_mincost.H.

References NODE_COOKIE.

◆ ssp_init_potentials()

template<class Net >
bool Aleph::ssp_init_potentials ( Net &  net,
typename Net::Node *  source 
)

Initialize potentials using Bellman-Ford.

Computes the shortest path distances in the residual graph of the flow of the network from a virtual node joined to every node by an arc of cost 0, which serve as initial potentials to ensure reduced costs are non-negative. From the source, it did not see the negative cycles that the source does not reach. With floating costs, a relaxation must improve a distance by more than 4 n^2 epsilons of the largest cost, so that the rounding of the sums does not make a cycle of cost zero, as an arc with a partial flow and its residual, negative.

Template Parameters
NetNetwork type (must be Net_Cost_Graph or compatible).
Parameters
[in,out]netFlow network with costs.
[in]sourceKept for compatibility: the distances are not from it.
Returns
true if no negative cycle detected, false otherwise.

Definition at line 344 of file tpl_mincost.H.

References and, GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), and GraphCommon< GT, Node, Arc >::vsize().

Referenced by successive_shortest_paths().

◆ ssp_shortest_path()

◆ stable_argsort()

template<class C , class Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > Aleph::stable_argsort ( const C &  a,
const Compare &  cmp = Compare() 
)
inline

Return stable sorted-order indices for an array-like container.

This is the high-level ahSort.H synonym for stable_build_index() from tpl_sort_utils.H. It works with Aleph arrays (Array, DynArray, and other containers exposing operator()) and with STL-style random-access containers such as std::vector (via operator[]). It returns an Array<size_t> because the number of indices is fixed once the source container size is known.

The returned index array has the direction idx[sorted_pos] = original_pos. Iterating a(idx(i)) for Aleph arrays, or a[idx(i)] for STL arrays, observes the original container in sorted order without moving its elements.

Stability means that elements equivalent according to cmp keep their original relative order in the returned index array. This is useful when sorting by a projection or partial key while preserving a previous order.

Template Parameters
CArray-like container type. Must provide size() and either operator()(size_t) or operator[](size_t).
CompareStrict weak ordering over the element type.
Parameters
aContainer whose elements define the ordering.
cmpComparator used to order elements.
Returns
Array<size_t> of original positions in stable sorted order.
Note
Complexity: O(n log n) comparisons and O(n) extra storage.
The comparator must define a strict weak ordering; otherwise the stable tie-break cannot make the ordering meaningful.
Example
std::vector<int> a = {2, 1, 2, 1, 2};
auto idx = stable_argsort(a); // {1, 3, 0, 2, 4}
Array< size_t > stable_argsort(const C &a, const Compare &cmp=Compare())
Return stable sorted-order indices for an array-like container.
Definition ahSort.H:433
See also
stable_build_index() Shared implementation in tpl_sort_utils.H.
argsort() for the non-stable variant.
ranks() for the inverse direction, rank[original_pos] = sorted_pos.

Definition at line 433 of file ahSort.H.

References cmp(), and stable_build_index().

Referenced by LLVMFuzzerTestOneInput(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ stable_build_index()

template<class C , StrictWeakOrder< sort_utils_detail::Indexed_Value_Type< C > > Compare = Aleph::less<sort_utils_detail::Indexed_Value_Type<C>>>
Array< size_t > Aleph::stable_build_index ( const C &  a,
const Compare &  cmp = Compare() 
)
inline

Build a stable index array for indirect sorting.

Creates an array of indices that visits an array-like container in sorted order without moving or copying its elements. Unlike build_index(), this function preserves the original relative order of elements that are equivalent according to cmp.

The returned array has the direction idx[sorted_pos] = original_pos. For Aleph arrays, iterate with a(idx(i)); for STL-style arrays such as std::vector, iterate with a[idx(i)].

Stability is enforced by sorting indices with a deterministic tie-break: when neither cmp(a[i], a[j]) nor cmp(a[j], a[i]) is true, the smaller original index is ordered first.

Template Parameters
CArray-like container type. Must provide size() and either operator()(size_t) or operator[](size_t).
CompareStrict weak ordering over the element type.
Parameters
aContainer whose elements define the ordering.
cmpComparator used to order elements.
Returns
Array<size_t> of original positions in stable sorted order.
Note
Complexity: O(n log n) comparisons and O(n) extra storage.
The returned Array is created with its final logical size before initialization, so index construction does not grow or reallocate the result.
The comparator must define a strict weak ordering; otherwise the stable tie-break cannot make the ordering meaningful.
Example
std::vector<int> a = {2, 1, 2, 1, 2};
auto idx = stable_build_index(a); // {1, 3, 0, 2, 4}
Array< size_t > stable_build_index(const C &a, const Compare &cmp=Compare())
Build a stable index array for indirect sorting.
See also
build_index() for the non-stable variant.
stable_argsort() High-level counterpart in ahSort.H.

Definition at line 4942 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create(), quicksort_op(), and Aleph::Array< T >::size().

Referenced by stable_argsort(), and TEST().

◆ stable_build_index_ptr() [1/2]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< T * > Aleph::stable_build_index_ptr ( C< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Build a stable index array of pointers for indirect sorting.

Mutable-reference counterpart of the const stable_build_index_ptr() overload above — see its documentation for the stability guarantee and the index-then-materialize technique used to provide it.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aContainer to index.
cmpComparison functor.
Returns
Array<T *> of sorted pointers, stable with respect to cmp.
See also
build_index_ptr() for the non-stable variant.
stable_build_index() for the plain-index counterpart.

Definition at line 5072 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create(), quicksort_op(), and Aleph::Array< T >::size().

◆ stable_build_index_ptr() [2/2]

template<template< typename > class C, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
Array< const T * > Aleph::stable_build_index_ptr ( const C< T > &  a,
const Compare &  cmp = Compare() 
)
inline

Build a stable index array of pointers for indirect sorting (const version).

Like build_index_ptr(), but preserves the original relative order of elements that are equivalent according to cmp — the same stability guarantee stable_build_index() provides for plain indices, applied to pointers instead. This does not move or copy the elements of a.

Sorting pointers directly cannot use their addresses as a tie-break (nothing guarantees a container lays out elements in address order, and C<T> is generic), so this sorts an internal index array with stable_index_less() first, then materializes the sorted pointers from those indices — the same technique stable_build_index() uses, plus one extra O(n) pass to turn indices into pointers.

Template Parameters
CContainer template.
TElement type.
CompareComparison functor type.
Parameters
aContainer to index.
cmpComparison functor.
Returns
Array<const T *> of sorted pointers, stable with respect to cmp.
See also
build_index_ptr() for the non-stable variant.
stable_build_index() for the plain-index counterpart.

Definition at line 5034 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::create(), quicksort_op(), and Aleph::Array< T >::size().

◆ std_zip()

template<typename C1 , typename C2 >
auto Aleph::std_zip ( const C1 &  c1,
const C2 &  c2 
)

Build a vector of pairs from two STL containers.

Note
For backwards compatibility. For more than 2 containers, use tzip_std.

Definition at line 1587 of file ah-zip.H.

References and.

Referenced by demo_stl_compatibility(), TEST(), and TEST().

◆ std_zip_n()

template<typename... Cs>
auto Aleph::std_zip_n ( const Cs &...  cs)

Build a vector of tuples from 2 or more STL containers (variadic).

This is a convenience alias for tzip_std() with a more explicit name (and to avoid ambiguity with the legacy 2-container std_zip() that returns std::vector<std::pair<...>>).

Parameters
csSTL-compatible containers.
Returns
std::vector<std::tuple<...>> stopping at the shortest container.

Definition at line 1650 of file ah-zip.H.

References tzip_std().

Referenced by TEST(), and TEST().

◆ stddev()

template<typename Container >
auto Aleph::stddev ( const Container &  data,
bool  population = false 
) -> std::decay_t<decltype(*std::begin(data))>

Compute standard deviation.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
populationIf true, compute population stddev; if false (default), sample stddev
Returns
Standard deviation

Definition at line 257 of file stat_utils.H.

References stddev(), and variance().

Referenced by coefficient_of_variation(), correlation(), demo_practical(), kurtosis(), monte_carlo_simulation(), skewness(), stddev(), TEST(), TEST(), and TEST_F().

◆ stdmap_to_DynMapTree()

template<class K , class V , class Compare , class Alloc >
DynMapTree< K, V > Aleph::stdmap_to_DynMapTree ( const std::map< K, V, Compare, Alloc > &  m)

Convert a std::map to a DynMapTree.

Template Parameters
KThe key type.
VThe value type.
CompareThe comparison function type.
AllocThe allocator type.
Parameters
mThe source std::map.
Returns
A DynMapTree containing all key-value pairs from m.

Definition at line 1210 of file ah-convert.H.

References Aleph::DynMapTree< Key, Data, Tree, Compare >::insert(), m, and value.

Referenced by TEST().

◆ stdsort()

template<typename Container , class Cmp = std::less<typename Container::value_type>>
Container Aleph::stdsort ( const Container &  c,
Cmp  cmp = Cmp() 
)
inline

Sorts an STL-compatible container using std::sort.

This function provides a convenient way to sort STL containers (std::vector, std::deque, etc.) with a consistent interface.

Template Parameters
ContainerSTL-compatible container type with begin()/end()
CmpComparison functor type (default: std::less)
Parameters
cThe container to sort (not modified)
cmpComparison functor
Returns
A new sorted container
Note
Uses std::sort internally, O(n log n) average, NOT stable
See also
std::stable_sort for stable sorting
Example
std::vector<int> v = {3, 1, 4, 1, 5};
auto sorted = stdsort(v); // {1, 1, 3, 4, 5}
Container stdsort(const Container &c, Cmp cmp=Cmp())
Sorts an STL-compatible container using std::sort.
Definition ahSort.H:307

Definition at line 307 of file ahSort.H.

References cmp().

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ stl_adjacent()

template<typename Container >
auto Aleph::stl_adjacent ( const Container &  c)

Zip adjacent (consecutive) elements of a container.

Creates pairs of consecutive elements: (e[0], e[1]), (e[1], e[2]), etc. Useful for computing differences, detecting changes, etc.

Parameters
cContainer with elements.
Returns
std::vector of pairs of adjacent elements.
Example:
std::vector<int> v = {1, 2, 3, 4, 5};
auto pairs = stl_adjacent(v);
// pairs = {(1,2), (2,3), (3,4), (4,5)}
// Compute differences
for (auto [prev, curr] : stl_adjacent(v))
std::cout << curr - prev << " "; // 1 1 1 1
auto stl_adjacent(const Container &c)
Zip adjacent (consecutive) elements of a container.
Author
Leandro Rabindranath León

Definition at line 1433 of file ah-stl-zip.H.

Referenced by TEST(), TEST(), and TEST().

◆ stl_adjacent_all()

template<typename Pred , typename Container >
bool Aleph::stl_adjacent_all ( Pred &&  pred,
const Container &  c 
)

Check if predicate holds for all adjacent pairs.

Parameters
predPredicate (prev, curr) -> bool.
cContainer.
Returns
true if predicate holds for all consecutive pairs.
Example:
std::vector<int> v = {1, 2, 3, 4, 5};
bool sorted = stl_adjacent_all([](int a, int b) { return a < b; }, v);
// sorted = true (ascending order)
bool stl_adjacent_all(Pred &&pred, const Container &c)
Check if predicate holds for all adjacent pairs.
Author
Leandro Rabindranath León

Definition at line 1515 of file ah-stl-zip.H.

References pred.

Referenced by TEST().

◆ stl_adjacent_exists()

template<typename Pred , typename Container >
bool Aleph::stl_adjacent_exists ( Pred &&  pred,
const Container &  c 
)

Check if predicate holds for any adjacent pair.

Parameters
predPredicate (prev, curr) -> bool.
cContainer.
Returns
true if any consecutive pair satisfies predicate.
Author
Leandro Rabindranath León

Definition at line 1544 of file ah-stl-zip.H.

References pred.

Referenced by TEST().

◆ stl_adjacent_map()

template<typename Op , typename Container >
auto Aleph::stl_adjacent_map ( Op &&  op,
const Container &  c 
)

Apply function to adjacent pairs of elements.

Parameters
opFunction (prev, curr) -> R.
cContainer.
Returns
std::vector of results.
Example:
std::vector<int> v = {1, 3, 6, 10};
auto diffs = stl_adjacent_map([](int a, int b) { return b - a; }, v);
// diffs = {2, 3, 4}
auto stl_adjacent_map(Op &&op, const Container &c)
Apply function to adjacent pairs of elements.
Author
Leandro Rabindranath León

Definition at line 1471 of file ah-stl-zip.H.

Referenced by TEST().

◆ stl_all()

template<typename Pred , typename Container >
bool Aleph::stl_all ( Pred &&  pred,
const Container &  c 
)

Check if all elements satisfy predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
true if all elements satisfy predicate.
Author
Leandro Rabindranath León

Definition at line 582 of file ah-stl-functional.H.

References pred, and Aleph::detail::ranges_all_of().

Referenced by main(), TEST(), TEST(), and TEST().

◆ stl_any()

template<typename Pred , typename Container >
bool Aleph::stl_any ( Pred &&  pred,
const Container &  c 
)

Alias for stl_exists.

Definition at line 627 of file ah-stl-functional.H.

References pred, and stl_exists().

◆ stl_arrangements()

template<typename Container >
auto Aleph::stl_arrangements ( size_t  k,
const Container &  c 
)

Generate all k-arrangements (k-permutations) of a container.

Parameters
kNumber of elements to choose.
cContainer.
Returns
Vector of vectors, each containing one arrangement.
Author
Leandro Rabindranath León

Definition at line 2014 of file ah-stl-functional.H.

References k, and stl_traverse_arrangements().

Referenced by main(), and TEST().

◆ stl_cartesian_product()

template<typename T >
auto Aleph::stl_cartesian_product ( const std::vector< std::vector< T > > &  containers)

Generate cartesian product of multiple containers.

Parameters
containersVector of containers.
Returns
Vector of vectors, each containing one tuple from the product.
Example:
std::vector<std::vector<int>> sets = {{1, 2}, {3, 4}};
// Result: {{1,3}, {1,4}, {2,3}, {2,4}}
T product(const Container &container, const T &init=T{1})
Compute product of all elements.
auto stl_cartesian_product(const std::vector< std::vector< T > > &containers)
Generate cartesian product of multiple containers.
Author
Leandro Rabindranath León

Definition at line 2045 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_chunks()

template<typename Container >
auto Aleph::stl_chunks ( size_t  n,
const Container &  c 
)

Split container into chunks of size n (each_slice in Ruby).

Parameters
nChunk size.
cContainer.
Returns
Vector of vectors, each containing up to n elements.
Example:
auto chunks = stl_chunks(2, {1, 2, 3, 4, 5});
// Result: {{1,2}, {3,4}, {5}}
auto stl_chunks(size_t n, const Container &c)
Split container into chunks of size n (each_slice in Ruby).
Author
Leandro Rabindranath León

Definition at line 2164 of file ah-stl-functional.H.

References stl_chunks().

Referenced by main(), stl_chunks(), TEST(), and TEST().

◆ stl_combinations()

template<typename Container >
auto Aleph::stl_combinations ( size_t  k,
const Container &  c 
)

Generate all k-combinations of a container.

Parameters
kNumber of elements to choose.
cContainer.
Returns
Vector of vectors, each containing one combination.
Author
Leandro Rabindranath León

Definition at line 1949 of file ah-stl-functional.H.

References k, and stl_traverse_combinations().

Referenced by main(), TEST(), and TEST().

◆ stl_compare()

template<typename Container1 , typename Container2 >
int Aleph::stl_compare ( const Container1 &  c1,
const Container2 &  c2 
)

Compare two containers lexicographically.

Parameters
c1First container.
c2Second container.
Returns
-1 if c1 < c2, 0 if equal, 1 if c1 > c2.
Author
Leandro Rabindranath León

Definition at line 1404 of file ah-stl-functional.H.

References and.

Referenced by TEST(), TEST(), and TEST().

◆ stl_concat()

template<typename Container1 , typename Container2 >
auto Aleph::stl_concat ( const Container1 &  c1,
const Container2 &  c2 
)

Concatenate two containers.

Parameters
c1First container.
c2Second container.
Returns
std::vector with all elements from c1 followed by c2.
Author
Leandro Rabindranath León

Definition at line 1583 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_container_to_dynList()

template<typename StlContainer >
auto Aleph::stl_container_to_dynList ( const StlContainer &  container) -> DynList<typename StlContainer::value_type>
inline

Convert any STL container to a DynList.

Works with any container that exposes value_type and supports range-based for loops (std::vector, std::list, std::set, etc.).

Template Parameters
StlContainerSTL container type (must have value_type typedef).
Parameters
containerSource container.
Returns
DynList containing copies of all elements.

Definition at line 367 of file ah-stl-utils.H.

References Aleph::DynList< T >::append().

Referenced by demo_list_dynlist(), TEST(), TEST(), TEST(), and TEST().

◆ stl_count()

template<typename Pred , typename Container >
size_t Aleph::stl_count ( Pred &&  pred,
const Container &  c 
)

Count elements satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
Number of elements satisfying predicate.
Author
Leandro Rabindranath León

Definition at line 777 of file ah-stl-functional.H.

References count(), and pred.

Referenced by main(), TEST(), and TEST().

◆ stl_count_value()

template<typename T , typename Container >
size_t Aleph::stl_count_value ( const T &  target,
const Container &  c 
)

Count occurrences of a value.

Parameters
targetValue to count.
cContainer.
Returns
Number of occurrences.
Author
Leandro Rabindranath León

Definition at line 798 of file ah-stl-functional.H.

References count().

Referenced by main(), and TEST().

◆ stl_distinct()

template<typename Container >
auto Aleph::stl_distinct ( const Container &  c)

Remove all duplicates (keeps first occurrence).

Uses an adaptive algorithm:

  • For small containers (≤64 elements): linear search O(n²)
  • For larger containers: hash-based O(n) amortized
Template Parameters
ContainerContainer type with value_type that supports equality comparison. For hash optimization, value_type must also be hashable via std::hash.
Parameters
cInput container.
Returns
std::vector with all duplicates removed, preserving first occurrence.
Complexity:
  • Small containers: O(n²) time, O(k) space where k = distinct elements
  • Large containers: O(n) amortized time, O(n) space
Example:
std::vector<int> v = {1, 2, 2, 3, 1, 4, 3};
auto d = stl_distinct(v); // {1, 2, 3, 4}
auto stl_distinct(const Container &c)
Remove all duplicates (keeps first occurrence).
Author
Leandro Rabindranath León

Definition at line 1533 of file ah-stl-functional.H.

References Aleph::stl_detail::ADAPTIVE_THRESHOLD, Aleph::stl_detail::safe_size(), and size().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ stl_drop()

template<typename Container >
auto Aleph::stl_drop ( size_t  n,
const Container &  c 
)

Drop first n elements, return the rest.

Parameters
nNumber of elements to skip.
cContainer.
Returns
std::vector with remaining elements.
Author
Leandro Rabindranath León

Definition at line 849 of file ah-stl-functional.H.

References count(), and size().

Referenced by main(), TEST(), and TEST().

◆ stl_drop_while()

template<typename Pred , typename Container >
auto Aleph::stl_drop_while ( Pred &&  pred,
const Container &  c 
)

Drop elements while predicate is true, return the rest.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::vector with remaining elements.
Author
Leandro Rabindranath León

Definition at line 953 of file ah-stl-functional.H.

References and, and pred.

Referenced by main(), and TEST().

◆ stl_enumerate()

template<typename Container >
constexpr auto Aleph::stl_enumerate ( const Container &  c)
constexpr

Create an enumerate view over a container.

Like Python's enumerate(). Produces tuples of (index, element).

Parameters
cContainer to enumerate.
Returns
StlEnumerateView for lazy iteration.
Example:
std::vector<std::string> names = {"Alice", "Bob", "Charlie"};
for (auto [idx, name] : stl_enumerate(names))
std::cout << idx << ": " << name << "\n";
// Output:
// 0: Alice
// 1: Bob
// 2: Charlie
constexpr auto stl_enumerate(const Container &c)
Create an enumerate view over a container.
Author
Leandro Rabindranath León

Definition at line 1154 of file ah-stl-zip.H.

Referenced by TEST(), and TEST().

◆ stl_enumerate_to_pairs()

template<typename Container >
auto Aleph::stl_enumerate_to_pairs ( const Container &  c)

Enumerate container (return pairs of index and element).

Parameters
cContainer.
Returns
std::vector of pairs (index, element).
Author
Leandro Rabindranath León

Definition at line 1356 of file ah-stl-functional.H.

References Aleph::stl_detail::try_reserve().

Referenced by main(), and TEST().

◆ stl_equal()

template<typename Container1 , typename Container2 >
bool Aleph::stl_equal ( const Container1 &  c1,
const Container2 &  c2 
)

Check equality of two containers.

Parameters
c1First container.
c2Second container.
Returns
true if containers have same elements in same order.
Author
Leandro Rabindranath León

Definition at line 1383 of file ah-stl-functional.H.

References and.

Referenced by TEST(), and TEST().

◆ stl_exists()

template<typename Pred , typename Container >
bool Aleph::stl_exists ( Pred &&  pred,
const Container &  c 
)

Check if any element satisfies predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
true if any element satisfies predicate.
Author
Leandro Rabindranath León

Definition at line 609 of file ah-stl-functional.H.

References pred, and Aleph::detail::ranges_any_of().

Referenced by main(), stl_any(), stl_none(), TEST(), TEST(), and TEST().

◆ stl_filter()

template<typename Pred , typename Container >
auto Aleph::stl_filter ( Pred &&  pred,
const Container &  c 
)

Filter elements satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::vector with filtered elements.
Author
Leandro Rabindranath León

Definition at line 384 of file ah-stl-functional.H.

References pred.

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ stl_filteri()

template<typename Pred , typename Container >
auto Aleph::stl_filteri ( Pred &&  pred,
const Container &  c 
)

Filter with index (filteri in ML).

Parameters
predPredicate (size_t idx, element) -> bool.
cContainer.
Returns
std::vector with filtered elements.
Author
Leandro Rabindranath León

Definition at line 407 of file ah-stl-functional.H.

References pred.

Referenced by main(), and TEST().

◆ stl_find()

template<typename Pred , typename Container >
auto Aleph::stl_find ( Pred &&  pred,
const Container &  c 
)

Find first element satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::optional with element if found.
Author
Leandro Rabindranath León

Definition at line 659 of file ah-stl-functional.H.

References pred.

Referenced by main(), TEST(), and TEST().

◆ stl_find_index()

template<typename Pred , typename Container >
std::optional< size_t > Aleph::stl_find_index ( Pred &&  pred,
const Container &  c 
)

Find index of first element satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::optional<size_t> with index if found.
Author
Leandro Rabindranath León

Definition at line 704 of file ah-stl-functional.H.

References pred.

Referenced by main(), and TEST().

◆ stl_find_last()

template<typename Pred , typename Container >
auto Aleph::stl_find_last ( Pred &&  pred,
const Container &  c 
)

Find last element satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::optional with element if found.
Author
Leandro Rabindranath León

Definition at line 681 of file ah-stl-functional.H.

References pred.

Referenced by main(), and TEST().

◆ stl_find_mapi()

template<typename Op , typename Container >
auto Aleph::stl_find_mapi ( Op &&  op,
const Container &  c 
)

Find and map with index (find_mapi in ML).

Parameters
opCallable (size_t idx, element) -> std::optional<R>.
cContainer.
Returns
First non-empty result from op.
Author
Leandro Rabindranath León

Definition at line 728 of file ah-stl-functional.H.

Referenced by TEST().

◆ stl_first()

template<typename Container >
auto Aleph::stl_first ( const Container &  c)

Get first element.

Parameters
cContainer.
Returns
std::optional with first element if container is not empty.
Author
Leandro Rabindranath León

Definition at line 984 of file ah-stl-functional.H.

Referenced by main(), TEST(), TEST(), and TEST().

◆ stl_flat_map()

template<typename Op , typename Container >
auto Aleph::stl_flat_map ( Op &&  op,
const Container &  c 
)

Flat map - map then flatten.

Parameters
opOperation (element) -> Container<R>.
cContainer.
Returns
std::vector with flattened mapped results.
Author
Leandro Rabindranath León

Definition at line 1630 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_flatten()

template<typename Container >
auto Aleph::stl_flatten ( const Container &  c)

Flatten a container of containers.

Parameters
cContainer of containers.
Returns
std::vector with all nested elements.
Author
Leandro Rabindranath León

Definition at line 1607 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_foldl()

template<typename T , typename Op , typename Container >
T Aleph::stl_foldl ( T  init,
Op &&  op,
const Container &  c 
)

Left fold (foldl) - reduce from left to right.

Computes: op(...op(op(init, x1), x2)..., xn)

Parameters
initInitial accumulator value.
opBinary operation (acc, element) -> acc.
cContainer.
Returns
Final accumulated value.
Example:
int sum = stl_foldl(0, [](int acc, int x) { return acc + x; }, nums);
T stl_foldl(T init, Op &&op, const Container &c)
Left fold (foldl) - reduce from left to right.
Author
Leandro Rabindranath León

Definition at line 442 of file ah-stl-functional.H.

References init, and Aleph::detail::ranges_fold_left().

Referenced by main(), stl_reduce(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ stl_foldr()

template<typename T , typename Op , typename Container >
T Aleph::stl_foldr ( T  init,
Op &&  op,
const Container &  c 
)

Right fold (foldr) - reduce from right to left.

Computes: op(x1, op(x2, ...op(xn, init)...))

Note
This is possible with STL containers that have reverse iterators!
Parameters
initInitial accumulator value.
opBinary operation (element, acc) -> acc.
cContainer (must support rbegin()/rend()).
Returns
Final accumulated value.
Example:
// Right fold with subtraction: 1 - (2 - (3 - 0)) = 1 - (2 - 3) = 1 - (-1) = 2
int result = stl_foldr(0, [](int x, int acc) { return x - acc; }, {1, 2, 3});
T stl_foldr(T init, Op &&op, const Container &c)
Right fold (foldr) - reduce from right to left.
Author
Leandro Rabindranath León

Definition at line 480 of file ah-stl-functional.H.

References init.

Referenced by main(), TEST(), TEST(), and TEST().

◆ stl_for_each()

template<typename Op , typename Container >
void Aleph::stl_for_each ( Op &&  op,
const Container &  c 
)

Apply operation to each element (for_each).

Parameters
opCallable (element) -> void.
cContainer.
Author
Leandro Rabindranath León

Definition at line 294 of file ah-stl-functional.H.

Referenced by TEST(), and TEST().

◆ stl_for_each_indexed()

template<typename Op , typename Container >
void Aleph::stl_for_each_indexed ( Op &&  op,
const Container &  c 
)

Apply operation to each element with index.

Parameters
opCallable (size_t idx, element) -> void.
cContainer.
Author
Leandro Rabindranath León

Definition at line 311 of file ah-stl-functional.H.

Referenced by TEST().

◆ stl_generate()

template<typename Gen >
auto Aleph::stl_generate ( size_t  n,
Gen &&  gen 
)

Generate a vector using a generator function.

Parameters
nNumber of elements.
genGenerator function (size_t index) -> T.
Returns
std::vector with generated values.
Author
Leandro Rabindranath León

Definition at line 269 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_group()

template<typename Container >
auto Aleph::stl_group ( const Container &  c)

Group consecutive equal elements.

Parameters
cContainer.
Returns
std::vector of vectors, each containing consecutive equal elements.
Author
Leandro Rabindranath León

Definition at line 1658 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_group_by()

template<typename Key , typename Container >
auto Aleph::stl_group_by ( Key &&  key,
const Container &  c 
)

Group elements by key function.

Uses an adaptive algorithm:

  • For small containers (≤64 elements): linear search O(n²)
  • For larger containers: hash-based O(n) amortized
Template Parameters
KeyKey extractor function type.
ContainerContainer type.
Parameters
keyKey extractor (element) -> K. The key type K must be hashable via std::hash for the optimized path.
cInput container.
Returns
std::vector of pairs (key, vector of elements with that key). Order of groups matches first occurrence of each key.
Complexity:
  • Small containers: O(n²) time, O(g) space where g = number of groups
  • Large containers: O(n) amortized time, O(n) space
Example:
std::vector<std::string> words = {"apple", "ant", "banana", "bear", "apricot"};
auto groups = stl_group_by([](const std::string& s) { return s[0]; }, words);
// {{'a', {"apple", "ant", "apricot"}}, {'b', {"banana", "bear"}}}
auto stl_group_by(Key &&key, const Container &c)
Group elements by key function.
Author
Leandro Rabindranath León

Definition at line 1713 of file ah-stl-functional.H.

References Aleph::stl_detail::ADAPTIVE_THRESHOLD, k, Aleph::stl_detail::safe_size(), and size().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ stl_init()

template<typename Container >
auto Aleph::stl_init ( const Container &  c)

Get all elements except the last (init in Haskell).

Parameters
cContainer.
Returns
Vector without last element.
Author
Leandro Rabindranath León

Definition at line 2287 of file ah-stl-functional.H.

References stl_init().

Referenced by main(), stl_init(), and TEST().

◆ stl_intersperse()

template<typename T , typename Container >
auto Aleph::stl_intersperse ( const T &  sep,
const Container &  c 
)

Insert element between each pair (intersperse in Haskell).

Parameters
sepSeparator element.
cContainer.
Returns
Vector with separator inserted between elements.
Example:
auto result = stl_intersperse(0, {1, 2, 3});
// Result: {1, 0, 2, 0, 3}
auto stl_intersperse(const T &sep, const Container &c)
Insert element between each pair (intersperse in Haskell).
Author
Leandro Rabindranath León

Definition at line 2199 of file ah-stl-functional.H.

References stl_intersperse().

Referenced by main(), stl_intersperse(), TEST(), and TEST().

◆ stl_last()

template<typename Container >
auto Aleph::stl_last ( const Container &  c)

Get last element.

Parameters
cContainer.
Returns
std::optional with last element if container is not empty.
Author
Leandro Rabindranath León

Definition at line 1004 of file ah-stl-functional.H.

Referenced by main(), TEST(), TEST(), TEST(), and TEST().

◆ stl_linspace()

template<typename T = double>
std::vector< T > Aleph::stl_linspace ( T  start,
T  end,
size_t  n 
)

Generate n evenly spaced values between start and end.

Parameters
startStart value.
endEnd value.
nNumber of values to generate.
Returns
std::vector with n values.
Author
Leandro Rabindranath León

Definition at line 224 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_map()

template<typename Op , typename Container >
auto Aleph::stl_map ( Op &&  op,
const Container &  c 
)

Map operation - transform each element.

Parameters
opCallable (element) -> R.
cContainer.
Returns
std::vector<R> with transformed values.
Example:
auto squares = stl_map([](int x) { return x * x; }, nums);
auto stl_map(Op &&op, const Container &c)
Map operation - transform each element.
Author
Leandro Rabindranath León

Definition at line 335 of file ah-stl-functional.H.

References Aleph::stl_detail::try_reserve().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ stl_mapi()

template<typename Op , typename Container >
auto Aleph::stl_mapi ( Op &&  op,
const Container &  c 
)

Map with index (mapi in ML).

Parameters
opCallable (size_t idx, element) -> R.
cContainer.
Returns
std::vector<R> with transformed values.
Author
Leandro Rabindranath León

Definition at line 359 of file ah-stl-functional.H.

References Aleph::stl_detail::try_reserve().

Referenced by main(), and TEST().

◆ stl_max()

template<typename Container >
auto Aleph::stl_max ( const Container &  c)

Get maximum element.

Parameters
cContainer.
Returns
std::optional with maximum element.
Author
Leandro Rabindranath León

Definition at line 1093 of file ah-stl-functional.H.

Referenced by main(), TEST(), TEST(), and TEST().

◆ stl_max_by()

template<typename Key , typename Container >
auto Aleph::stl_max_by ( Key &&  key,
const Container &  c 
)

Get maximum element by key function.

Parameters
keyKey extractor (element) -> comparable.
cContainer.
Returns
std::optional with element having maximum key.
Author
Leandro Rabindranath León

Definition at line 1187 of file ah-stl-functional.H.

References k.

Referenced by main(), and TEST().

◆ stl_mem()

template<typename T , typename Container >
bool Aleph::stl_mem ( const T &  target,
const Container &  c 
)

Check if element exists in container (mem in ML).

Parameters
targetElement to search for.
cContainer.
Returns
true if target is found.
Author
Leandro Rabindranath León

Definition at line 754 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_min()

template<typename Container >
auto Aleph::stl_min ( const Container &  c)

Get minimum element.

Parameters
cContainer.
Returns
std::optional with minimum element.
Author
Leandro Rabindranath León

Definition at line 1067 of file ah-stl-functional.H.

Referenced by main(), TEST(), TEST(), and TEST().

◆ stl_min_by()

template<typename Key , typename Container >
auto Aleph::stl_min_by ( Key &&  key,
const Container &  c 
)

Get minimum element by key function.

Parameters
keyKey extractor (element) -> comparable.
cContainer.
Returns
std::optional with element having minimum key.
Author
Leandro Rabindranath León

Definition at line 1151 of file ah-stl-functional.H.

References k.

Referenced by main(), and TEST().

◆ stl_min_max()

template<typename Container >
auto Aleph::stl_min_max ( const Container &  c)

Get both min and max in a single pass.

Parameters
cContainer.
Returns
std::optional<std::pair<T, T>> with (min, max).
Author
Leandro Rabindranath León

Definition at line 1119 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_none()

template<typename Pred , typename Container >
bool Aleph::stl_none ( Pred &&  pred,
const Container &  c 
)

Check if no element satisfies predicate.

Author
Leandro Rabindranath León

Definition at line 639 of file ah-stl-functional.H.

References pred, and stl_exists().

Referenced by main(), and TEST().

◆ stl_nth()

template<typename Container >
auto Aleph::stl_nth ( const size_t  n,
const Container &  c 
)

Get n-th element.

Parameters
nIndex (0-based).
cContainer.
Returns
std::optional with n-th element if exists.
Author
Leandro Rabindranath León

Definition at line 1039 of file ah-stl-functional.H.

Referenced by main(), TEST(), and TEST().

◆ stl_partition()

template<typename Pred , typename Container >
auto Aleph::stl_partition ( Pred &&  pred,
const Container &  c 
)

Partition elements by predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
Pair of vectors: (elements satisfying pred, elements not satisfying pred).
Author
Leandro Rabindranath León

Definition at line 1273 of file ah-stl-functional.H.

References pred.

Referenced by main(), and TEST().

◆ stl_permutations()

template<typename Container >
auto Aleph::stl_permutations ( const Container &  c)

Generate all permutations of a container.

Parameters
cContainer.
Returns
Vector of vectors, each containing one permutation.
Note
For n elements, generates n! permutations. Use with care for large n.
Author
Leandro Rabindranath León

Definition at line 1885 of file ah-stl-functional.H.

References stl_traverse_permutations().

Referenced by main(), and TEST().

◆ stl_power_set()

template<typename Container >
auto Aleph::stl_power_set ( const Container &  c)

Generate power set (all subsets) of a container.

Parameters
cContainer.
Returns
Vector of vectors containing all 2^n subsets.
Author
Leandro Rabindranath León

Definition at line 2083 of file ah-stl-functional.H.

References stl_power_set().

Referenced by main(), stl_power_set(), TEST(), TEST(), and TEST().

◆ stl_product()

template<typename Container >
auto Aleph::stl_product ( const Container &  c)

Product of all elements.

Parameters
cContainer of numeric values.
Returns
Product of all elements.
Author
Leandro Rabindranath León

Definition at line 1245 of file ah-stl-functional.H.

Referenced by main(), TEST(), and TEST().

◆ stl_range() [1/2]

template<typename T = int>
std::vector< T > Aleph::stl_range ( T  n)

Generate a range [0, n-1].

Parameters
nNumber of elements.
Returns
std::vector<T> with values 0 to n-1.
Author
Leandro Rabindranath León

Definition at line 203 of file ah-stl-functional.H.

◆ stl_range() [2/2]

template<typename T = int>
std::vector< T > Aleph::stl_range ( T  start,
T  end,
T  step = 1 
)

Generate a range of values [start, end] with given step.

Template Parameters
TNumeric type.
Parameters
startStart value (inclusive).
endEnd value (inclusive).
stepIncrement between values (default 1).
Returns
std::vector<T> with the range.
Example:
auto r = stl_range(1, 5); // {1, 2, 3, 4, 5}
auto r2 = stl_range(0, 10, 2); // {0, 2, 4, 6, 8, 10}
std::vector< T > stl_range(T start, T end, T step=1)
Generate a range of values [start, end] with given step.
Author
Leandro Rabindranath León

Definition at line 175 of file ah-stl-functional.H.

References and.

Referenced by main(), TEST(), TEST(), TEST(), and TEST().

◆ stl_reduce()

template<typename T , typename Op , typename Container >
T Aleph::stl_reduce ( T  init,
Op &&  op,
const Container &  c 
)

Alias for stl_foldl.

Definition at line 562 of file ah-stl-functional.H.

References init, and stl_foldl().

◆ stl_reject()

template<typename Pred , typename Container >
auto Aleph::stl_reject ( Pred &&  pred,
const Container &  c 
)

Filter out elements (reject in Ruby, opposite of filter).

Parameters
predPredicate - elements where pred is TRUE are removed.
cContainer.
Returns
Vector with elements not satisfying predicate.
Author
Leandro Rabindranath León

Definition at line 2419 of file ah-stl-functional.H.

References pred, and stl_reject().

Referenced by main(), stl_reject(), and TEST().

◆ stl_rep()

template<typename T >
std::vector< T > Aleph::stl_rep ( size_t  n,
const T &  value 
)

Generate a vector of n repeated values.

Parameters
nNumber of repetitions.
valueValue to repeat.
Returns
std::vector with n copies of value.
Author
Leandro Rabindranath León

Definition at line 253 of file ah-stl-functional.H.

References value.

Referenced by main(), and TEST().

◆ stl_reverse()

template<typename Container >
auto Aleph::stl_reverse ( const Container &  c)

Return reversed copy of container.

Parameters
cContainer.
Returns
std::vector with elements in reverse order.
Author
Leandro Rabindranath León

Definition at line 1433 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_scan_left()

template<typename T , typename Op , typename Container >
std::vector< T > Aleph::stl_scan_left ( T  init,
Op &&  op,
const Container &  c 
)

Scan left - fold with all intermediate results.

Parameters
initInitial value.
opBinary operation (acc, element) -> acc.
cContainer.
Returns
std::vector containing init and all intermediate results.
Example:
// Running sum: [0, 1, 3, 6, 10]
auto sums = stl_scan_left(0, [](int acc, int x) { return acc + x; }, {1,2,3,4});
std::vector< T > stl_scan_left(T init, Op &&op, const Container &c)
Scan left - fold with all intermediate results.
Author
Leandro Rabindranath León

Definition at line 509 of file ah-stl-functional.H.

References init.

Referenced by main(), TEST(), and TEST().

◆ stl_scan_right()

template<typename T , typename Op , typename Container >
std::vector< T > Aleph::stl_scan_right ( T  init,
Op &&  op,
const Container &  c 
)

Scan right - right fold with all intermediate results.

Parameters
initInitial value.
opBinary operation (element, acc) -> acc.
cContainer.
Returns
std::vector containing all intermediate results (in reverse order) and init.
Author
Leandro Rabindranath León

Definition at line 538 of file ah-stl-functional.H.

References init.

Referenced by TEST(), and TEST().

◆ stl_sliding_window()

template<typename Container >
auto Aleph::stl_sliding_window ( size_t  n,
const Container &  c 
)

Sliding window of size n over container (each_cons in Ruby).

Parameters
nWindow size.
cContainer.
Returns
Vector of vectors, each containing n consecutive elements.
Example:
auto windows = stl_sliding_window(3, {1, 2, 3, 4, 5});
// Result: {{1,2,3}, {2,3,4}, {3,4,5}}
auto stl_sliding_window(size_t n, const Container &c)
Sliding window of size n over container (each_cons in Ruby).
Author
Leandro Rabindranath León

Definition at line 2131 of file ah-stl-functional.H.

References stl_sliding_window().

Referenced by main(), stl_sliding_window(), TEST(), and TEST().

◆ stl_sort()

template<typename Container >
auto Aleph::stl_sort ( const Container &  c)

Return sorted copy of container.

Parameters
cContainer.
Returns
std::vector with sorted elements.
Author
Leandro Rabindranath León

Definition at line 1452 of file ah-stl-functional.H.

References sort_range().

Referenced by main(), and TEST().

◆ stl_sort_by()

template<typename Cmp , typename Container >
auto Aleph::stl_sort_by ( Cmp &&  cmp,
const Container &  c 
)

Return sorted copy using custom comparator.

Parameters
cmpComparator (a, b) -> bool (true if a < b).
cContainer.
Returns
std::vector with sorted elements.
Author
Leandro Rabindranath León

Definition at line 1472 of file ah-stl-functional.H.

References cmp(), and sort_range().

Referenced by main(), and TEST().

◆ stl_span()

template<typename Pred , typename Container >
auto Aleph::stl_span ( Pred &&  pred,
const Container &  c 
)

Split at predicate boundary (span in Haskell).

Returns (takeWhile pred, dropWhile pred) in one pass.

Parameters
predPredicate.
cContainer.
Returns
Pair of vectors.
Author
Leandro Rabindranath León

Definition at line 2257 of file ah-stl-functional.H.

References pred, and stl_span().

Referenced by main(), stl_span(), and TEST().

◆ stl_split_at()

template<typename Container >
auto Aleph::stl_split_at ( size_t  n,
const Container &  c 
)

Split at position n, returning (take n, drop n) in one pass.

Parameters
nPosition to split at.
cContainer.
Returns
Pair of vectors.
Author
Leandro Rabindranath León

Definition at line 2226 of file ah-stl-functional.H.

References stl_split_at().

Referenced by main(), stl_split_at(), and TEST().

◆ stl_sum()

template<typename Container >
auto Aleph::stl_sum ( const Container &  c)

Sum all elements.

Parameters
cContainer of numeric values.
Returns
Sum of all elements.
Author
Leandro Rabindranath León

Definition at line 1226 of file ah-stl-functional.H.

References sum().

Referenced by main(), TEST(), TEST(), and TEST().

◆ stl_tail()

template<typename Container >
auto Aleph::stl_tail ( const Container &  c)

Get all elements except the first (tail in Haskell).

Parameters
cContainer.
Returns
Vector without first element.
Author
Leandro Rabindranath León

Definition at line 2308 of file ah-stl-functional.H.

References stl_tail().

Referenced by main(), stl_tail(), and TEST().

◆ stl_take()

template<typename Container >
auto Aleph::stl_take ( size_t  n,
const Container &  c 
)

Take first n elements.

Parameters
nNumber of elements to take.
cContainer.
Returns
std::vector with first n elements.
Author
Leandro Rabindranath León

Definition at line 822 of file ah-stl-functional.H.

References count().

Referenced by main(), and TEST().

◆ stl_take_last()

template<typename Container >
auto Aleph::stl_take_last ( size_t  n,
const Container &  c 
)

Take last n elements.

Parameters
nNumber of elements to take.
cContainer.
Returns
std::vector with last n elements.
Author
Leandro Rabindranath León

Definition at line 880 of file ah-stl-functional.H.

References all(), count(), Aleph::stl_detail::safe_size(), and size().

Referenced by main(), TEST(), and TEST().

◆ stl_take_while()

template<typename Pred , typename Container >
auto Aleph::stl_take_while ( Pred &&  pred,
const Container &  c 
)

Take elements while predicate is true.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::vector with elements taken while predicate is true.
Author
Leandro Rabindranath León

Definition at line 927 of file ah-stl-functional.H.

References pred.

Referenced by main(), and TEST().

◆ stl_tally()

template<typename Container >
auto Aleph::stl_tally ( const Container &  c)

Count occurrences of each element (tally in Ruby, frequencies).

Uses an adaptive algorithm:

  • For small containers (≤64 elements): linear search O(n²)
  • For larger containers: hash-based O(n) amortized
Template Parameters
ContainerContainer type with hashable value_type.
Parameters
cInput container.
Returns
Vector of pairs (element, count), ordered by first occurrence.
Complexity:
  • Small containers: O(n²) time, O(k) space where k = distinct elements
  • Large containers: O(n) amortized time, O(n) space
Example:
std::vector<int> v = {1, 2, 2, 3, 1, 1};
auto t = stl_tally(v); // {{1, 3}, {2, 2}, {3, 1}}
auto stl_tally(const Container &c)
Count occurrences of each element (tally in Ruby, frequencies).
Author
Leandro Rabindranath León

Definition at line 2350 of file ah-stl-functional.H.

References size(), and stl_tally().

Referenced by main(), stl_tally(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ stl_traverse_arrangements()

template<typename Op , typename Container >
bool Aleph::stl_traverse_arrangements ( size_t  k,
Op &&  op,
const Container &  c 
)

Traverse all k-arrangements (k-permutations) of a container.

Generates all P(n,k) = n!/(n-k)! ways to choose k elements from n WITH order. The operation can return false to stop early.

Parameters
kNumber of elements to choose.
opCallable (const std::vector<T>&) -> bool. Return false to stop.
cContainer.
Returns
true if all arrangements were visited, false if stopped early.
Example:
stl_traverse_arrangements(2, [](const auto& arr) {
for (int x : arr) std::cout << x << " ";
std::cout << "\n";
return true;
}, std::vector<int>{1, 2, 3});
// Output: {1,2}, {1,3}, {2,1}, {2,3}, {3,1}, {3,2}
bool stl_traverse_arrangements(size_t k, Op &&op, const Container &c)
Traverse all k-arrangements (k-permutations) of a container.
Author
Leandro Rabindranath León

Definition at line 1988 of file ah-stl-functional.H.

References Aleph::stl_comb_detail::arrangements_impl(), and k.

Referenced by stl_arrangements().

◆ stl_traverse_combinations()

template<typename Op , typename Container >
bool Aleph::stl_traverse_combinations ( size_t  k,
Op &&  op,
const Container &  c 
)

Traverse all k-combinations of a container.

Generates all C(n,k) ways to choose k elements from n, without regard to order. The operation can return false to stop early.

Parameters
kNumber of elements to choose.
opCallable (const std::vector<T>&) -> bool. Return false to stop.
cContainer.
Returns
true if all combinations were visited, false if stopped early.
Example:
stl_traverse_combinations(2, [](const auto& combo) {
for (int x : combo) std::cout << x << " ";
std::cout << "\n";
return true;
}, std::vector<int>{1, 2, 3, 4});
// Output: {1,2}, {1,3}, {1,4}, {2,3}, {2,4}, {3,4}
bool stl_traverse_combinations(size_t k, Op &&op, const Container &c)
Traverse all k-combinations of a container.
Author
Leandro Rabindranath León

Definition at line 1924 of file ah-stl-functional.H.

References Aleph::stl_comb_detail::combinations_impl(), and k.

Referenced by stl_combinations().

◆ stl_traverse_permutations()

template<typename Op , typename Container >
bool Aleph::stl_traverse_permutations ( Op &&  op,
const Container &  c 
)

Traverse all permutations of a container.

Generates all n! permutations (orderings) of the elements. The operation can return false to stop early.

Parameters
opCallable (const std::vector<T>&) -> bool. Return false to stop.
cContainer.
Returns
true if all permutations were visited, false if stopped early.
Example:
stl_traverse_permutations([](const auto& p) {
for (int x : p) std::cout << x << " ";
std::cout << "\n";
return true;
}, std::vector<int>{1, 2, 3});
// Output: all 6 permutations
bool stl_traverse_permutations(Op &&op, const Container &c)
Traverse all permutations of a container.
Author
Leandro Rabindranath León

Definition at line 1865 of file ah-stl-functional.H.

References Aleph::stl_comb_detail::permutations_impl().

Referenced by stl_permutations(), and TEST().

◆ stl_unique()

template<typename Container >
auto Aleph::stl_unique ( const Container &  c)

Remove consecutive duplicates.

Parameters
cContainer.
Returns
std::vector with consecutive duplicates removed.
Author
Leandro Rabindranath León

Definition at line 1495 of file ah-stl-functional.H.

Referenced by main(), and TEST().

◆ stl_unzip()

template<typename T , typename U >
auto Aleph::stl_unzip ( const std::vector< std::pair< T, U > > &  pairs)

Unzip a vector of pairs into two vectors.

Inverse operation of zip for pairs.

Parameters
pairsVector of pairs to unzip.
Returns
Pair of vectors containing separated elements.
Example:
std::vector<std::pair<int, std::string>> pairs = {{1, "a"}, {2, "b"}};
auto [nums, strs] = stl_unzip(pairs);
// nums = {1, 2}, strs = {"a", "b"}
auto stl_unzip(const std::vector< std::pair< T, U > > &pairs)
Unzip a vector of pairs into two vectors.
Author
Leandro Rabindranath León

Definition at line 1344 of file ah-stl-zip.H.

Referenced by TEST().

◆ stl_unzip_pairs()

template<typename Container >
auto Aleph::stl_unzip_pairs ( const Container &  c)

Unzip pairs into two vectors.

Parameters
cContainer of pairs.
Returns
Pair of vectors.
Author
Leandro Rabindranath León

Definition at line 1327 of file ah-stl-functional.H.

References Aleph::stl_detail::try_reserve().

Referenced by main(), and TEST().

◆ stl_unzip_tuple()

template<typename... Ts>
auto Aleph::stl_unzip_tuple ( const std::vector< std::tuple< Ts... > > &  tuples)

Unzip a vector of tuples into a tuple of vectors.

Inverse operation of zip for tuples.

Parameters
tuplesVector of tuples to unzip.
Returns
Tuple of vectors, one for each tuple element.
Example:
std::vector<std::tuple<int, double, char>> tuples = {
{1, 1.1, 'a'}, {2, 2.2, 'b'}
};
auto [ints, doubles, chars] = stl_unzip_tuple(tuples);
// ints = {1, 2}, doubles = {1.1, 2.2}, chars = {'a', 'b'}
auto stl_unzip_tuple(const std::vector< std::tuple< Ts... > > &tuples)
Unzip a vector of tuples into a tuple of vectors.
Author
Leandro Rabindranath León

Definition at line 1380 of file ah-stl-zip.H.

Referenced by TEST().

◆ stl_zip()

template<typename... Containers>
constexpr auto Aleph::stl_zip ( const Containers &...  cs)
constexpr

Create a lazy zip view over STL containers.

Returns a view that can be iterated with range-based for loops or used with functional operations. No memory is allocated for the zipped result - iteration happens inline.

Template Parameters
ContainersTypes of containers to zip.
Parameters
csContainers to zip together.
Returns
StlZipView for lazy iteration.
Example:
std::vector<int> v = {1, 2, 3};
std::list<std::string> l = {"a", "b", "c"};
for (auto [num, str] : stl_zip(v, l))
std::cout << num << ": " << str << "\n";
constexpr auto stl_zip(const Containers &... cs)
Create a lazy zip view over STL containers.
Definition ah-stl-zip.H:421
int num(Node *p)
The number of a node of a built graph.
DynList< int > l
Author
Leandro Rabindranath León

Definition at line 421 of file ah-stl-zip.H.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ stl_zip_all()

template<typename Pred , typename... Containers>
bool Aleph::stl_zip_all ( Pred &&  pred,
const Containers &...  cs 
)

Check if predicate holds for all zipped tuples.

Iterates over zipped containers and tests each tuple with the predicate. Returns true only if the predicate returns true for every tuple. Short-circuits on first false.

This is similar to ML's forall or Haskell's all.

Template Parameters
PredPredicate type (tuple) -> bool.
ContainersContainer types.
Parameters
predPredicate to test each tuple.
csContainers to zip.
Returns
true if pred is true for all tuples; false otherwise.
Example:
std::vector<int> xs = {1, 2, 3};
std::vector<int> ys = {10, 20, 30};
// Check if all xs are less than ys
bool result = stl_zip_all([](auto t) {
return std::get<0>(t) < std::get<1>(t);
}, xs, ys); // true
bool stl_zip_all(Pred &&pred, const Containers &... cs)
Check if predicate holds for all zipped tuples.
Definition ah-stl-zip.H:479
Author
Leandro Rabindranath León

Definition at line 479 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ stl_zip_all_eq()

template<typename Pred , typename... Containers>
bool Aleph::stl_zip_all_eq ( Pred &&  pred,
const Containers &...  cs 
)

Check if predicate holds for all tuples AND containers have equal length.

Like stl_zip_all but also verifies that all containers have the same size.

Parameters
predPredicate to test.
csContainers to zip.
Returns
true if pred is true for all tuples and lengths match.
Author
Leandro Rabindranath León

Definition at line 500 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST().

◆ stl_zip_any()

template<typename Pred , typename... Containers>
bool Aleph::stl_zip_any ( Pred &&  pred,
const Containers &...  cs 
)

Alias for stl_zip_exists (Python/JS style name)

Definition at line 546 of file ah-stl-zip.H.

References pred, and stl_zip_exists().

Referenced by TEST().

◆ stl_zip_assoc()

template<typename Key , typename... Containers>
auto Aleph::stl_zip_assoc ( const Key &  key,
const Containers &...  cs 
)

Find value associated with key in zipped pairs (assoc in ML).

Searches for a tuple where the first element equals the key.

Parameters
keyThe key to search for.
csContainers to zip (first container contains keys).
Returns
Optional containing the full tuple if found.
Author
Leandro Rabindranath León

Definition at line 1795 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_cmp()

template<typename Cmp , typename... Containers>
bool Aleph::stl_zip_cmp ( Cmp &&  cmp,
const Containers &...  cs 
)

Compare elements across containers using a comparator.

For each position, checks if all elements from different containers satisfy the comparator pairwise. Useful for checking if multiple containers have equal elements at each position.

Parameters
cmpBinary comparator (a, b) -> bool.
csContainers to compare (must have same element type).
Returns
true if comparator holds for all adjacent pairs at all positions.
Example:
std::vector<int> a = {1, 2, 3};
std::vector<int> b = {1, 2, 3};
std::vector<int> c = {1, 2, 3};
// Check if all three are element-wise equal
bool equal = stl_zip_cmp([](auto x, auto y) { return x == y; }, a, b, c);
// true
bool stl_zip_cmp(Cmp &&cmp, const Containers &... cs)
Compare elements across containers using a comparator.
Author
Leandro Rabindranath León

Definition at line 1015 of file ah-stl-zip.H.

References cmp(), Aleph::stl_zip_detail::compare_adjacent_impl(), and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_compare()

template<typename... Containers1, typename... Containers2>
int Aleph::stl_zip_compare ( const std::tuple< const Containers1 &... > &  cs1,
const std::tuple< const Containers2 &... > &  cs2 
)

Compare two zipped sequences lexicographically.

Uses default comparison (operator<) for elements at corresponding positions.

Template Parameters
Containers1Types of first set of containers.
Containers2Types of second set of containers.
Parameters
cs1First set of containers (as tuple).
cs2Second set of containers (as tuple).
Returns
-1 if first < second, 0 if equal, 1 if first > second.
Author
Leandro Rabindranath León

Definition at line 1741 of file ah-stl-zip.H.

References and, and stl_zip_it().

◆ stl_zip_count()

template<typename Pred , typename... Containers>
size_t Aleph::stl_zip_count ( Pred &&  pred,
const Containers &...  cs 
)

Count tuples satisfying predicate.

Parameters
predPredicate to test.
csContainers to zip.
Returns
Number of tuples satisfying predicate.
Author
Leandro Rabindranath León

Definition at line 759 of file ah-stl-zip.H.

References count(), pred, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_drop()

template<typename... Containers>
auto Aleph::stl_zip_drop ( const size_t  n,
const Containers &...  cs 
)

Skip first n tuples, return the rest.

Parameters
nNumber of tuples to skip.
csContainers to zip.
Returns
std::vector of remaining tuples.
Author
Leandro Rabindranath León

Definition at line 860 of file ah-stl-zip.H.

References and, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_drop_while()

template<typename Pred , typename... Containers>
auto Aleph::stl_zip_drop_while ( Pred &&  pred,
const Containers &...  cs 
)

Skip tuples while predicate returns true, then return the rest.

Skips tuples from the beginning while the predicate is satisfied, then collects all remaining tuples.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
std::vector of tuples after pred becomes false.
Author
Leandro Rabindranath León

Definition at line 1218 of file ah-stl-zip.H.

References and, pred, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_equal()

template<typename... Containers>
bool Aleph::stl_zip_equal ( const Containers &...  cs)

Check equality of zipped sequences.

Two zipped sequences are equal if they have the same length and all corresponding tuples are equal (or satisfy the given predicate).

Parameters
csContainers to zip.
Returns
true if sequences are equal.
Author
Leandro Rabindranath León

Definition at line 1697 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_equal_by()

template<typename Eq , typename... Containers>
bool Aleph::stl_zip_equal_by ( Eq &&  eq,
const Containers &...  cs 
)

Check equality with custom comparator.

Parameters
eqEquality predicate (tuple) -> bool.
csContainers to zip.
Returns
true if all tuples satisfy eq AND containers have equal length.
Author
Leandro Rabindranath León

Definition at line 1717 of file ah-stl-zip.H.

References eq(), and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_equal_length()

template<typename... Containers>
bool Aleph::stl_zip_equal_length ( const Containers &...  cs)

Check if all containers have equal length.

Parameters
csContainers to compare.
Returns
true if all containers have the same size.
Author
Leandro Rabindranath León

Definition at line 796 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_exists()

template<typename Pred , typename... Containers>
bool Aleph::stl_zip_exists ( Pred &&  pred,
const Containers &...  cs 
)

Check if predicate holds for any zipped tuple.

Returns true if at least one tuple satisfies the predicate. Short-circuits on first true.

This is similar to ML's exists or Haskell's any.

Parameters
predPredicate to test.
csContainers to zip.
Returns
true if any tuple satisfies pred.
Example:
std::vector<int> xs = {1, -2, 3};
std::vector<int> ys = {10, 20, 30};
// Check if any x is negative
bool result = stl_zip_exists([](auto t) {
return std::get<0>(t) < 0;
}, xs, ys); // true
bool stl_zip_exists(Pred &&pred, const Containers &... cs)
Check if predicate holds for any zipped tuple.
Definition ah-stl-zip.H:536
Author
Leandro Rabindranath León

Definition at line 536 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by stl_zip_any(), stl_zip_none(), TEST(), TEST(), and TEST().

◆ stl_zip_filter()

template<typename Pred , typename... Containers>
auto Aleph::stl_zip_filter ( Pred &&  pred,
const Containers &...  cs 
)

Filter zipped tuples by predicate.

Selects tuples for which the predicate returns true.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
std::vector of tuples satisfying predicate.
Author
Leandro Rabindranath León

Definition at line 716 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_filteri()

template<typename Pred , typename... Containers>
auto Aleph::stl_zip_filteri ( Pred &&  pred,
const Containers &...  cs 
)

Filter with index (filteri in ML).

Filters tuples using a predicate that receives both index and tuple.

Parameters
predPredicate (size_t idx, tuple) -> bool.
csContainers to zip.
Returns
std::vector of tuples satisfying predicate.
Author
Leandro Rabindranath León

Definition at line 1611 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST().

◆ stl_zip_find_first()

template<typename Pred , typename... Containers>
auto Aleph::stl_zip_find_first ( Pred &&  pred,
const Containers &...  cs 
)

Find first tuple satisfying predicate.

Parameters
predPredicate to test.
csContainers to zip.
Returns
std::optional containing tuple if found, empty otherwise.
Author
Leandro Rabindranath León

Definition at line 738 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_find_index()

template<typename Pred , typename... Containers>
size_t Aleph::stl_zip_find_index ( Pred &&  pred,
const Containers &...  cs 
)

Find index of first tuple satisfying predicate.

Parameters
predPredicate to test.
csContainers to zip.
Returns
Index of first match, or total count if not found.
Author
Leandro Rabindranath León

Definition at line 1312 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_find_last()

template<typename Pred , typename... Containers>
auto Aleph::stl_zip_find_last ( Pred &&  pred,
const Containers &...  cs 
)

Find last tuple satisfying predicate.

Parameters
predPredicate to test.
csContainers to zip.
Returns
std::optional containing last matching tuple, or empty if none found.
Author
Leandro Rabindranath León

Definition at line 1287 of file ah-stl-zip.H.

References Aleph::StlZipIterator< Containers >::get_curr(), pred, and stl_zip_it().

Referenced by TEST().

◆ stl_zip_find_mapi()

template<typename Op , typename... Containers>
auto Aleph::stl_zip_find_mapi ( Op &&  op,
const Containers &...  cs 
)

Find and map with index (find_mapi in ML).

Finds the first element where the function returns a non-empty optional.

Parameters
opCallable (size_t idx, tuple) -> std::optional<R>.
csContainers to zip.
Returns
First non-empty result from op, or std::nullopt.
Author
Leandro Rabindranath León

Definition at line 1672 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_first()

template<typename... Containers>
auto Aleph::stl_zip_first ( const Containers &...  cs)

Get first tuple from zipped containers.

Parameters
csContainers to zip.
Returns
std::optional containing first tuple, or empty if containers are empty.
Author
Leandro Rabindranath León

Definition at line 1249 of file ah-stl-zip.H.

References stl_zip_nth().

Referenced by TEST(), and TEST().

◆ stl_zip_foldl()

template<typename T , typename Op , typename... Containers>
T Aleph::stl_zip_foldl ( T  init,
Op &&  op,
const Containers &...  cs 
)

Left fold over zipped tuples.

Accumulates a value by applying a binary operation to the accumulator and each tuple, from left to right.

This is equivalent to ML's foldl or JavaScript's reduce.

Template Parameters
TAccumulator type.
OpBinary operation (T, tuple) -> T.
Parameters
initInitial accumulator value.
opBinary operation.
csContainers to zip.
Returns
Final accumulated value.
Example:
std::vector<int> prices = {10, 20, 30};
std::vector<int> quantities = {2, 3, 1};
// Total cost = sum of (price * quantity)
int total = stl_zip_foldl(0, [](int acc, auto t) {
return acc + std::get<0>(t) * std::get<1>(t);
}, prices, quantities);
// total = 10*2 + 20*3 + 30*1 = 110
T stl_zip_foldl(T init, Op &&op, const Containers &... cs)
Left fold over zipped tuples.
Definition ah-stl-zip.H:648
Author
Leandro Rabindranath León

Definition at line 648 of file ah-stl-zip.H.

References init, and stl_zip_it().

Referenced by stl_zip_reduce(), TEST(), TEST(), and TEST().

◆ stl_zip_for_each()

template<typename Op , typename... Containers>
void Aleph::stl_zip_for_each ( Op &&  op,
const Containers &...  cs 
)

Apply operation to each zipped tuple (for side effects).

Iterates over all zipped tuples, applying the callable to each. This is a side effect operation that returns void.

Parameters
opCallable to apply to each tuple.
csContainers to zip.
Example:
std::vector<std::string> names = {"Alice", "Bob"};
std::vector<int> ages = {30, 25};
stl_zip_for_each([](auto t) {
std::cout << std::get<0>(t) << " is "
<< std::get<1>(t) << " years old\n";
}, names, ages);
void stl_zip_for_each(Op &&op, const Containers &... cs)
Apply operation to each zipped tuple (for side effects).
Definition ah-stl-zip.H:594
Author
Leandro Rabindranath León

Definition at line 594 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST().

◆ stl_zip_for_each_indexed()

template<typename Op , typename... Containers>
void Aleph::stl_zip_for_each_indexed ( Op &&  op,
const Containers &...  cs 
)

Apply operation to each tuple with its index.

Parameters
opCallable (size_t index, tuple) -> void.
csContainers to zip.
Author
Leandro Rabindranath León

Definition at line 610 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST().

◆ stl_zip_it()

template<typename... Containers>
constexpr auto Aleph::stl_zip_it ( const Containers &...  cs)
constexpr

◆ stl_zip_last()

template<typename... Containers>
auto Aleph::stl_zip_last ( const Containers &...  cs)

Get last tuple from zipped containers.

Parameters
csContainers to zip.
Returns
std::optional containing last tuple, or empty if containers are empty.
Note
This iterates through all elements - O(n) complexity.
Author
Leandro Rabindranath León

Definition at line 1266 of file ah-stl-zip.H.

References Aleph::StlZipIterator< Containers >::get_curr(), and stl_zip_it().

Referenced by TEST().

◆ stl_zip_length()

template<typename... Containers>
size_t Aleph::stl_zip_length ( const Containers &...  cs)

Count total tuples (minimum length of containers).

Parameters
csContainers to zip.
Returns
Number of tuples that would be produced.
Author
Leandro Rabindranath León

Definition at line 778 of file ah-stl-zip.H.

References count(), and stl_zip_it().

Referenced by TEST().

◆ stl_zip_map()

template<typename Op , typename... Containers>
auto Aleph::stl_zip_map ( Op &&  op,
const Containers &...  cs 
)

Map operation over zipped tuples, returning a vector.

Applies a transformation to each tuple and collects results in a vector. The result type is automatically deduced from the transformation.

Parameters
opTransformation (tuple) -> R.
csContainers to zip.
Returns
std::vector of transformed values.
Example:
std::vector<int> xs = {1, 2, 3};
std::vector<int> ys = {10, 20, 30};
// Create sums
auto sums = stl_zip_map([](auto t) {
return std::get<0>(t) + std::get<1>(t);
}, xs, ys);
// sums = {11, 22, 33}
auto stl_zip_map(Op &&op, const Containers &... cs)
Map operation over zipped tuples, returning a vector.
Definition ah-stl-zip.H:692
Note
This DOES allocate memory for the result vector. For lazy transformation, use stl_zip() with a transforming view.
Author
Leandro Rabindranath León

Definition at line 692 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_mapi()

template<typename Op , typename... Containers>
auto Aleph::stl_zip_mapi ( Op &&  op,
const Containers &...  cs 
)

Map with index (mapi in ML).

Applies a function that receives both the index and the tuple.

Parameters
opCallable (size_t idx, tuple) -> R.
csContainers to zip.
Returns
std::vector of transformed values.
Example:
auto indexed = stl_zip_mapi([](size_t i, auto t) {
return std::to_string(i) + ":" + std::to_string(std::get<0>(t));
}, xs, ys);
auto stl_zip_mapi(Op &&op, const Containers &... cs)
Map with index (mapi in ML).
Author
Leandro Rabindranath León

Definition at line 1586 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST().

◆ stl_zip_max()

template<typename... Containers>
auto Aleph::stl_zip_max ( const Containers &...  cs)

Get maximum tuple according to comparator.

Parameters
csContainers to zip.
Returns
Optional containing the maximum tuple.
Author
Leandro Rabindranath León

Definition at line 1845 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST().

◆ stl_zip_mem()

template<typename Tuple , typename... Containers>
bool Aleph::stl_zip_mem ( const Tuple &  target,
const Containers &...  cs 
)

Check if a tuple exists in the zipped sequence (mem in ML).

Parameters
targetThe tuple to search for.
csContainers to zip.
Returns
true if target is found.
Author
Leandro Rabindranath León

Definition at line 1774 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST().

◆ stl_zip_min()

template<typename... Containers>
auto Aleph::stl_zip_min ( const Containers &...  cs)

Get minimum tuple according to comparator.

Parameters
csContainers to zip.
Returns
Optional containing the minimum tuple.
Author
Leandro Rabindranath León

Definition at line 1815 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST().

◆ stl_zip_min_max()

template<typename... Containers>
auto Aleph::stl_zip_min_max ( const Containers &...  cs)

Get both min and max in a single pass.

Parameters
csContainers to zip.
Returns
Optional pair of (min, max) tuples.
Author
Leandro Rabindranath León

Definition at line 1875 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_none()

template<typename Pred , typename... Containers>
bool Aleph::stl_zip_none ( Pred &&  pred,
const Containers &...  cs 
)

Check if no tuple satisfies the predicate.

Returns true if the predicate returns false for all tuples. This is the complement of stl_zip_exists.

Parameters
predPredicate to test.
csContainers to zip.
Returns
true if no tuple satisfies pred.
Author
Leandro Rabindranath León

Definition at line 565 of file ah-stl-zip.H.

References pred, and stl_zip_exists().

Referenced by TEST().

◆ stl_zip_nth()

template<typename... Containers>
auto Aleph::stl_zip_nth ( const size_t  n,
const Containers &...  cs 
)

Get n-th tuple from zipped containers.

Parameters
nIndex (0-based).
csContainers to zip.
Returns
std::optional containing tuple if index is valid, empty otherwise.
Author
Leandro Rabindranath León

Definition at line 815 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by stl_zip_first(), TEST(), and TEST().

◆ stl_zip_partition()

template<typename Pred , typename... Containers>
auto Aleph::stl_zip_partition ( Pred &&  pred,
const Containers &...  cs 
)

Partition tuples by predicate.

Separates tuples into two groups: those satisfying the predicate and those that don't.

Parameters
predPredicate to partition by.
csContainers to zip.
Returns
Pair of vectors: (matching, non-matching).
Author
Leandro Rabindranath León

Definition at line 891 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST().

◆ stl_zip_reduce()

template<typename T , typename Op , typename... Containers>
T Aleph::stl_zip_reduce ( T  init,
Op &&  op,
const Containers &...  cs 
)

Alias for stl_zip_foldl (alternative name)

Definition at line 658 of file ah-stl-zip.H.

References init, and stl_zip_foldl().

Referenced by TEST().

◆ stl_zip_scan_left()

template<typename T , typename Op , typename... Containers>
auto Aleph::stl_zip_scan_left ( T  init,
Op &&  op,
const Containers &...  cs 
)

Scan left (scan_left in ML) - fold with intermediate results.

Like foldl but returns all intermediate accumulator values.

Parameters
initInitial value.
opBinary operation (acc, tuple) -> acc.
csContainers to zip.
Returns
std::vector containing init and all intermediate results.
Example:
// Running sum: [0, 1, 3, 6, 10]
auto sums = stl_zip_scan_left(0, [](int acc, auto t) {
return acc + std::get<0>(t);
}, xs, ys);
auto stl_zip_scan_left(T init, Op &&op, const Containers &... cs)
Scan left (scan_left in ML) - fold with intermediate results.
Author
Leandro Rabindranath León

Definition at line 1645 of file ah-stl-zip.H.

References init, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_sum()

template<typename... Containers>
auto Aleph::stl_zip_sum ( const Containers &...  cs)

Sum all tuples element-wise (requires + operator on tuple elements).

For numeric containers, computes the sum of each position.

Parameters
csContainers to zip.
Returns
Optional tuple with sums.
Author
Leandro Rabindranath León

Definition at line 1909 of file ah-stl-zip.H.

References stl_zip_it(), and sum().

◆ stl_zip_take()

template<typename... Containers>
auto Aleph::stl_zip_take ( const size_t  n,
const Containers &...  cs 
)

Take first n tuples from zipped containers.

Parameters
nMaximum number of tuples to take.
csContainers to zip.
Returns
std::vector of up to n tuples.
Author
Leandro Rabindranath León

Definition at line 837 of file ah-stl-zip.H.

References and, count(), and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_take_while()

template<typename Pred , typename... Containers>
auto Aleph::stl_zip_take_while ( Pred &&  pred,
const Containers &...  cs 
)

Take tuples while predicate returns true.

Collects tuples from the beginning while the predicate is satisfied. Stops at the first tuple where predicate returns false.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
std::vector of tuples while pred is true.
Example:
std::vector<int> xs = {1, 2, 3, 10, 4, 5};
std::vector<int> ys = {10, 20, 30, 100, 40, 50};
// Take while x < 10
auto result = stl_zip_take_while([](auto t) {
return std::get<0>(t) < 10;
}, xs, ys);
// result contains: {(1,10), (2,20), (3,30)}
auto stl_zip_take_while(Pred &&pred, const Containers &... cs)
Take tuples while predicate returns true.
Author
Leandro Rabindranath León

Definition at line 1189 of file ah-stl-zip.H.

References Aleph::StlZipIterator< Containers >::get_curr(), pred, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_to_pairs()

template<typename Container1 , typename Container2 >
auto Aleph::stl_zip_to_pairs ( const Container1 &  c1,
const Container2 &  c2 
)

Zip two containers into pairs.

Parameters
c1First container.
c2Second container.
Returns
std::vector of pairs.
Author
Leandro Rabindranath León

Definition at line 1302 of file ah-stl-functional.H.

References and.

Referenced by main(), and TEST().

◆ stl_zip_to_vector()

template<typename... Containers>
auto Aleph::stl_zip_to_vector ( const Containers &...  cs)

Materialize zipped tuples into a vector.

Collects all zipped tuples into a std::vector. Use this when you need to iterate multiple times or pass the result to other functions.

Parameters
csContainers to zip.
Returns
std::vector of tuples.
Note
This allocates memory. For single-pass iteration, use stl_zip().
Author
Leandro Rabindranath León

Definition at line 919 of file ah-stl-zip.H.

References stl_zip_it().

Referenced by TEST().

◆ stl_zip_traverse()

template<typename Pred , typename... Containers>
bool Aleph::stl_zip_traverse ( Pred &&  pred,
const Containers &...  cs 
)

Traverse while predicate returns true.

Iterates over zipped tuples, calling the predicate for each. Stops early if predicate returns false.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
true if pred was true for all tuples, false if stopped early.
Author
Leandro Rabindranath León

Definition at line 947 of file ah-stl-zip.H.

References pred, and stl_zip_it().

Referenced by TEST(), and TEST().

◆ stl_zip_traverse_eq()

template<typename Pred , typename... Containers>
bool Aleph::stl_zip_traverse_eq ( Pred &&  pred,
const Containers &...  cs 
)

Traverse while predicate returns true, verify equal lengths.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
true if pred was true for all AND containers have equal length.
Author
Leandro Rabindranath León

Definition at line 966 of file ah-stl-zip.H.

References pred, and stl_zip_it().

◆ sublist() [1/2]

template<class Container >
DynList< typename Container::Item_Type > Aleph::sublist ( const Container &  c,
size_t  pos,
const size_t  stride 
)

Extract a sublist using a stride.

Parameters
cSource container.
posStart position.
strideNumber of elements to skip between picks.
Returns
New list with picked elements.

Definition at line 650 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and each().

Referenced by sublist(), and TEST_F().

◆ sublist() [2/2]

template<class Container >
DynList< typename Container::Item_Type > Aleph::sublist ( const Container &  c,
size_t  stride 
)

Overload of sublist from start.

Definition at line 671 of file ahFunctional.H.

References sublist().

◆ subset_sum()

template<std::integral T>
Subset_Sum_Result< T > Aleph::subset_sum ( const Array< T > &  values,
T  target 
)

Solve the subset sum problem via classical DP with reconstruction.

Finds if there exists a subset of values that sums exactly to target. If it exists, the indices of the elements are returned.

Template Parameters
TIntegral type (must support comparison and addition).
Parameters
[in]valuesArray of non-negative integers.
[in]targetTarget sum to achieve.
Returns
A Subset_Sum_Result with the existence flag and selected indices.
Exceptions
ah_domain_errorif target or any value is negative.
ah_bad_allocif memory allocation for the DP table fails.
Note
Complexity: Time O(n * target), Space O(n * target), where n is values.size().

Definition at line 166 of file Subset_Sum.H.

References and, Aleph::Array< T >::append(), Aleph::Array< T >::create(), Aleph::subset_sum_detail::extract_values_checked(), k, Aleph::Array< T >::reserve(), row, Aleph::Array< T >::size(), and Aleph::subset_sum_detail::to_size_checked().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ subset_sum_count()

template<std::integral T>
size_t Aleph::subset_sum_count ( const Array< T > &  values,
T  target 
)

Count the number of subsets that sum to target.

Template Parameters
TIntegral type.
Parameters
[in]valuesArray of non-negative integers.
[in]targetTarget sum to achieve.
Returns
The total number of distinct subsets summing to target. Capped at std::numeric_limits<size_t>::max().
Exceptions
ah_domain_errorif target or any value is negative.
Note
Complexity: Time O(n * target), Space O(target).

Definition at line 282 of file Subset_Sum.H.

References and, count(), Aleph::Array< T >::create(), Aleph::subset_sum_detail::extract_values_checked(), Aleph::Array< T >::size(), and Aleph::subset_sum_detail::to_size_checked().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ subset_sum_exists()

template<std::integral T>
bool Aleph::subset_sum_exists ( const Array< T > &  values,
T  target 
)

Check if a subset summing to target exists (space-optimized).

Similar to subset_sum() but only checks for existence, using O(target) space.

Template Parameters
TIntegral type.
Parameters
[in]valuesArray of non-negative integers.
[in]targetTarget sum to achieve.
Returns
true if a subset summing to target exists, false otherwise.
Exceptions
ah_domain_errorif target or any value is negative.
Note
Complexity: Time O(n * target), Space O(target).

Definition at line 240 of file Subset_Sum.H.

References and, Aleph::Array< T >::create(), Aleph::subset_sum_detail::extract_values_checked(), Aleph::Array< T >::size(), and Aleph::subset_sum_detail::to_size_checked().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ subset_sum_mitm()

template<std::integral T>
Subset_Sum_Result< T > Aleph::subset_sum_mitm ( const Array< T > &  values,
T  target 
)

Solve the subset sum problem via meet-in-the-middle (MITM).

This algorithm is efficient when the target sum is very large, making classical DP impractical, but the number of elements is small. It splits the input into two halves, enumerates all 2^(n/2) sums for each half, and uses sorting and binary search to find complementary pairs.

Template Parameters
TIntegral type.
Parameters
[in]valuesArray of integers.
[in]targetTarget sum to achieve.
Returns
A Subset_Sum_Result with the existence flag and selected indices.
Exceptions
ah_out_of_range_errorif either half of the input would contain 64 or more elements (limited by 64-bit mask representation), which effectively restricts the total size to at most 127 elements.
Note
Complexity: Time O(n * 2^(n/2)), Space O(2^(n/2)).
Recommended for n up to ~40.

Definition at line 329 of file Subset_Sum.H.

References and, Aleph::Array< T >::append(), Aleph::subset_sum_detail::enumerate_sums(), introsort(), and Aleph::Array< T >::size().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ successive_shortest_paths()

template<class Net >
std::pair< typename Net::Flow_Type, typename Net::Flow_Type > Aleph::successive_shortest_paths ( Net &  net)

Compute minimum cost maximum flow using Successive Shortest Paths.

The SSP algorithm works by repeatedly:

  1. Finding the shortest (minimum cost) augmenting path
  2. Sending as much flow as possible along this path
  3. Updating node potentials to maintain non-negative reduced costs

This is equivalent to primal-dual method for min-cost flow.

With a floating flow, the arc that bounds a path is filled to its capacity exactly, and the residues of rounding that the paths leave go back at the end, as those of the maximum flows (see net_detail::return_dust()): every arc keeps its flow within [0, cap], and every node within the tolerance of check_node(), so that the network simplex takes the flow.

Complexity

O(V * U * (E + V log V)) where U is the max flow value. Best when flow value is small.

Algorithm Steps

  1. Initialize the potentials with Bellman-Ford, from the flow that the network has, whose residual graph must have no negative cycle
  2. While augmenting path exists (Dijkstra with reduced costs): a. Find minimum capacity on path b. Augment flow c. Update potentials: π(v) += d(v)
Template Parameters
NetNetwork type (must be Net_Cost_Graph or compatible).
Parameters
[in,out]netFlow network with costs (flow values are modified in place).
Returns
Pair of (max_flow, min_cost), of the whole flow, with what the network had: on a second run, the same.
Exceptions
std::domain_errorIf the network does not have a single source and single sink, if the initial residual graph has a negative-cost cycle, wherever it is (via ssp_init_potentials): no path from the source cancels it, and the flow would not be of least cost; or if the maximum flow is infinite, as through a path from the source to the sink of arcs of infinite capacity, which has no cost to minimize: the paths of less cost may have been taken before it, and their flows go back.
Note
Exception safety: strong guarantee — if the function throws, the network's flow values are not modified.
Warning
With a floating flow, a relaxation of the potentials must improve a distance by more than 4 n^2 epsilons of the largest finite cost of the whole network, where n is the number of nodes, and Dijkstra takes a negative reduced cost, of at most that tolerance, as zero. They keep the residues of rounding from making a run loop, or a second run throw, at any scale of the costs; but a difference below that tolerance counts as zero, and it holds for each arc, not for a whole path: a path or a cycle of m arcs can come out up to m times it off, and only a path cheaper by more than n times it is sure to be taken first. So a cost of a far larger magnitude, even on an arc without flow, as a large penalty, can hide the cheaper paths among the other arcs, and the flow is not of least cost, without notice: with 100 nodes, a cost of 5e11 can hide the differences of cost 1; with 7 nodes, a cost of 1e13 makes it take an arc of cost -0.6 instead of a path of 5 arcs of -0.4, of cost -2. Keep the largest cost below the smallest difference of cost that matters over 4 n^3 epsilons, as by scaling the costs, or take an integer flow, which compares exactly. solve_transshipment(), solve_assignment() and solve_transportation() run it.
Example
// ... build network with costs ...
auto [flow, cost] = successive_shortest_paths(net);
std::pair< typename Net::Flow_Type, typename Net::Flow_Type > successive_shortest_paths(Net &net)
Compute minimum cost maximum flow using Successive Shortest Paths.
See also
max_flow_min_cost_by_cycle_canceling
max_flow_min_cost_by_network_simplex

Definition at line 467 of file tpl_mincost.H.

References Aleph::net_detail::add_flow(), ah_domain_error_if, and, Aleph::Net_Graph< NodeT, ArcT >::flow_value(), GraphCommon< GT, Node, Arc >::get_num_arcs(), Aleph::Net_Graph< NodeT, ArcT >::get_sink(), Aleph::Net_Graph< NodeT, ArcT >::get_source(), Aleph::Net_Graph< NodeT, ArcT >::is_single_sink(), Aleph::Net_Graph< NodeT, ArcT >::is_single_source(), Aleph::Filter_Iterator< Container, It, Show_Item >::next_ne(), NODE_COOKIE, Aleph::net_detail::return_dust(), ssp_init_potentials(), ssp_shortest_path(), Aleph::net_detail::subtract_flow(), and GraphCommon< GT, Node, Arc >::vsize().

Referenced by Aleph::Successive_Shortest_Paths< Net >::operator()(), solve_assignment(), solve_transportation(), solve_transshipment(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ suffix()

◆ suffix_array()

Array< size_t > Aleph::suffix_array ( const std::string_view  text)
inline

Build suffix array with doubling algorithm.

Uses two-pass counting sort per doubling phase, achieving O(n) per phase and O(n log n) total.

Parameters
[in]textInput text.
Returns
Array sa where sa[i] is the start index of the i-th suffix in lexicographic order.
Complexity
O(n log n) time, O(n) space.

Definition at line 98 of file Suffix_Structures.H.

References counting_sort_indices(), Aleph::Array< T >::create(), k, and Aleph::Array< T >::size().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ sum() [1/2]

template<class Container , typename T = typename Container::Item_Type>
T Aleph::sum ( const Container &  container,
const T &  init = T{} 
)
inline

Compute sum of all elements.

Parameters
containerSource container.
initStarting value (defaults to T{}).
Returns
Sum of all elements plus init.

Definition at line 2357 of file ahFunctional.H.

References sum().

Referenced by __advance_to_leftmost_in_level(), __advance_to_rightmost_in_level(), Aleph::Johnson< GT, Distance, Ait, NAit, SA >::add(), Aleph::Johnson< GT, Distance, Ait, NAit, SA >::add(), Aleph::NTT< MOD, ROOT >::add_mod(), advance_to_leftmost_in_level(), advance_to_rightmost_in_level(), Aleph::howard_detail::best_cycle_exactly(), Aleph::RevisedSimplex< T >::btran(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::check_finite(), Aleph::FFT< Real >::choose_remez_extrema(), compute_maximum_weight_general_matching(), compute_minimum_cost_general_matching(), Aleph::negative_cycles_detail::cycle_cost(), Aleph::CA::ca_ising_detail::delta_energy(), demo_dynarray(), demo_fold_reduce(), demo_folding(), demo_matrix_arithmetic(), demo_perm_predicates(), demo_practical(), demo_traverse(), demo_vector_arithmetic(), demonstrate_functional(), demonstrate_functional_features(), example_parallel_aggregations(), example_parallel_building_blocks(), example_parallel_fold(), example_parallel_zip(), Moved_From_Case< Dense_Cell_Storage< int, 2 > >::fingerprint(), Moved_From_Case< Entropy >::fingerprint(), Moved_From_Case< Ghost_Grid >::fingerprint(), Moved_From_Case< Graph_Lattice< int > >::fingerprint(), Aleph::Bounded_Cycle_Index< GT >::for_each_cycle_below(), Aleph::RevisedSimplex< T >::ftran(), Aleph::Net_Graph< NodeT, ArcT >::get_in_cap(), Aleph::Net_Graph< NodeT, ArcT >::get_in_flow(), Aleph::Net_Graph< NodeT, ArcT >::get_out_cap(), Aleph::Net_Graph< NodeT, ArcT >::get_out_flow(), Aleph::Triangle::incenter(), Aleph::howard_detail::karp_by_component(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::last_relax_and_prepare_check_negative_cycle(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::last_relax_and_test_negative_cycle(), Aleph::Bounded_Cycle_Index< GT >::look_at(), main(), main(), Aleph::FFT< Real >::Plan::mixed_radix_transform_recursive(), Aleph::FFT< Real >::modified_bessel_i0(), monte_carlo_simulation(), Aleph::CA::Reproductions::morans_i_binary(), Aleph::Net_Graph< NodeT, ArcT >::nodes_tolerance(), Aleph::RevisedSimplex< T >::objective_value(), Aleph::Simplex< T >::objetive_value(), Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::offer(), Aleph::CA::Totalistic_Rule< F >::operator()(), partial_sum(), partial_sum(), Aleph::Polygon::perimeter(), Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::plain_sum(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::relax_arcs(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::relax_arcs(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::relaxes(), Aleph::Polygon::signed_area(), Aleph::GeomPolygonUtils::signed_double_area(), Aleph::RevisedSimplex< T >::solve(), Aleph::FFT< Real >::solve_dense_system(), HashStats< HashTbl >::stats(), Aleph::ODhashTable< Key, Cmp >::stats(), Aleph::OLhashTable< Key, Cmp >::stats(), stl_sum(), stl_zip_sum(), sum(), sum(), Aleph::Bounded_Cycle_Index< GT >::sum_at(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), Aleph::MCF_Graph< NodeT, ArcT >::total_cost(), Aleph::multi_poly_detail::total_degree(), Aleph::MCF_Arc< Arc_Info, FT >::total_flow(), Aleph::FlowDecomposition< Net >::total_flow(), Aleph::Net_Graph< NodeT, ArcT >::total_sink_in_flow(), Aleph::Net_Graph< NodeT, ArcT >::total_source_out_flow(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST_P(), TYPED_TEST_P(), uni_sum(), Aleph::Simplex< T >::verify_solution(), and Aleph::Johnson< GT, Distance, Ait, NAit, SA >::wide_potentials().

◆ sum() [2/2]

template<typename Container >
auto Aleph::sum ( const Container &  data) -> std::decay_t<decltype(*std::begin(data))>

Compute the sum of elements.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
Returns
Sum of all elements

Definition at line 172 of file stat_utils.H.

References sum().

◆ SuperFastHash() [1/3]

size_t Aleph::SuperFastHash ( const char *  key,
std::uint32_t  seed = 0 
)
inlinenoexcept

Definition at line 758 of file hash-fct.H.

References seed, and SuperFastHash().

◆ SuperFastHash() [2/3]

template<typename Key >
requires (std::is_trivially_copyable_v<Key> and (not std::is_pointer_v<Key>) and (not std::is_array_v<Key>))
size_t Aleph::SuperFastHash ( const Key &  key,
std::uint32_t  seed = 0 
)
inlinenoexcept

Definition at line 617 of file hash-fct.H.

References seed, and SuperFastHash().

◆ SuperFastHash() [3/3]

size_t Aleph::SuperFastHash ( const std::string &  key,
std::uint32_t  seed = 0 
)
inlinenoexcept

Definition at line 838 of file hash-fct.H.

References seed, and SuperFastHash().

◆ swap()

template<class T >
T & Aleph::swap ( T &  t1,
T &  t2 
)

◆ swap< char >()

template<>
char & Aleph::swap< char > ( char &  t1,
char &  t2 
)
inline

Definition at line 144 of file ahTypes.H.

◆ swap< double >()

template<>
double & Aleph::swap< double > ( double &  t1,
double &  t2 
)
inline

Definition at line 155 of file ahTypes.H.

◆ swap< float >()

template<>
float & Aleph::swap< float > ( float &  t1,
float &  t2 
)
inline

Definition at line 154 of file ahTypes.H.

◆ swap< int >()

template<>
int & Aleph::swap< int > ( int &  t1,
int &  t2 
)
inline

Definition at line 148 of file ahTypes.H.

◆ swap< long >()

template<>
long & Aleph::swap< long > ( long &  t1,
long &  t2 
)
inline

Definition at line 150 of file ahTypes.H.

◆ swap< long double >()

template<>
long double & Aleph::swap< long double > ( long double &  t1,
long double &  t2 
)
inline

Definition at line 156 of file ahTypes.H.

◆ swap< long long >()

template<>
long long & Aleph::swap< long long > ( long long &  t1,
long long &  t2 
)
inline

Definition at line 152 of file ahTypes.H.

◆ swap< short >()

template<>
short & Aleph::swap< short > ( short &  t1,
short &  t2 
)
inline

Definition at line 146 of file ahTypes.H.

◆ swap< unsigned char >()

template<>
unsigned char & Aleph::swap< unsigned char > ( unsigned char &  t1,
unsigned char &  t2 
)
inline

Definition at line 145 of file ahTypes.H.

◆ swap< unsigned int >()

template<>
unsigned int & Aleph::swap< unsigned int > ( unsigned int &  t1,
unsigned int &  t2 
)
inline

Definition at line 149 of file ahTypes.H.

◆ swap< unsigned long >()

template<>
unsigned long & Aleph::swap< unsigned long > ( unsigned long &  t1,
unsigned long &  t2 
)
inline

Definition at line 151 of file ahTypes.H.

◆ swap< unsigned long long >()

template<>
unsigned long long & Aleph::swap< unsigned long long > ( unsigned long long &  t1,
unsigned long long &  t2 
)
inline

Definition at line 153 of file ahTypes.H.

◆ swap< unsigned short >()

template<>
unsigned short & Aleph::swap< unsigned short > ( unsigned short &  t1,
unsigned short &  t2 
)
inline

Definition at line 147 of file ahTypes.H.

◆ swap_ranges()

template<class Itor1 , class Itor2 >
Itor2 Aleph::swap_ranges ( Itor1  beg1,
const Itor1 &  end1,
Itor2  beg2 
)
inline

Swap elements between two ranges.

Swaps elements in the range [beg1, end1) with corresponding elements starting at beg2.

Template Parameters
Itor1First range iterator type.
Itor2Second range iterator type.
Parameters
beg1Iterator to the first element of the first range.
end1Iterator past the last element of the first range.
beg2Iterator to the first element of the second range.
Returns
Iterator past the last swapped element in the second range.

Definition at line 686 of file ahAlgo.H.

Referenced by TEST().

◆ syslog()

void Aleph::syslog ( const char *  format,
va_list  ap 
)
extern

Write a message to syslog.

Parameters
formatPrintf-style format string.
apVariable argument list.

◆ t_enum_zip()

template<class... Cs>
auto Aleph::t_enum_zip ( const Cs &...  cs)
inline

Materialize enumerated zipped tuples into a DynList.

Each tuple includes the index as its last element.

Parameters
csContainers to zip.
Returns
DynList of tuples with index.

Definition at line 1442 of file ah-zip.H.

References Aleph::DynList< T >::append(), and get_enum_zip_it().

Referenced by demo_enum_zip(), main(), and TEST_F().

◆ t_enum_zip_eq()

template<class... Cs>
auto Aleph::t_enum_zip_eq ( const Cs &...  cs)
inline

Materialize enumerated zipped tuples; throw if containers differ in length.

Parameters
csContainers to zip.
Returns
DynList of tuples with index.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 1461 of file ah-zip.H.

References ah_length_error_if, Aleph::DynList< T >::append(), and get_enum_zip_it().

Referenced by TEST_F(), and TEST_F().

◆ t_unzip()

template<class... Ts>
auto Aleph::t_unzip ( const DynList< std::tuple< Ts... > > &  tuples)
inline

Unzip a list of tuples into a tuple of lists.

Parameters
tuplesInput list of tuples.
Returns
Tuple of DynLists, one per tuple element.

Definition at line 1491 of file ah-zip.H.

References t_unzip_impl().

Referenced by demo_tuple_operations(), main(), TEST(), TEST(), and TEST_F().

◆ t_unzip_impl()

template<typename... Ts, size_t... is>
static auto Aleph::t_unzip_impl ( const DynList< std::tuple< Ts... > > &  l,
std::index_sequence< is... >   
)
inlinestatic

Definition at line 1475 of file ah-zip.H.

References LocateFunctions< Container, Type >::get_it(), and l.

Referenced by t_unzip().

◆ t_zip()

template<class... Cs>
auto Aleph::t_zip ( const Cs &...  cs)
inline

Materialize zipped tuples into a DynList.

Collects all zipped tuples into a DynList. This is useful when you need to store the zipped result for later use or multiple iterations. Iterates over the minimum length of all containers.

Template Parameters
CsContainer types.
Parameters
csContainers to zip together.
Returns
DynList of tuples containing all zipped elements.
Example:
DynList<int> xs = {1, 2, 3};
DynList<std::string> ys = {"a", "b", "c"};
auto zipped = t_zip(xs, ys);
// zipped is DynList<std::tuple<int, string>> containing:
// {(1, "a"), (2, "b"), (3, "c")}
// Can iterate multiple times
for (auto& t : zipped) { ... }
for (auto& t : zipped) { ... }
auto t_zip(const Cs &...cs)
Materialize zipped tuples into a DynList.
Definition ah-zip.H:1174
See also
t_zip_eq for version that verifies equal lengths
t_unzip for the inverse operation

Definition at line 1174 of file ah-zip.H.

References Aleph::DynList< T >::append(), and zip_it().

Referenced by demo_practical_example(), demo_tuple_operations(), demo_zip_utilities(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ t_zip_eq()

template<class... Cs>
auto Aleph::t_zip_eq ( const Cs &...  cs)
inline

Materialize zipped tuples; throw if containers differ in length.

Parameters
csContainers to zip.
Returns
DynList of tuples.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 1193 of file ah-zip.H.

References ah_length_error_if, Aleph::DynList< T >::append(), and zip_it().

Referenced by demo_length_checking(), and TEST_F().

◆ take_while()

template<class Container , class Pred >
requires PredicateWith<Pred &, functional_detail::get_curr_cref_t<Container>>
DynList< typename Container::Item_Type > Aleph::take_while ( const Container &  c,
Pred  pred 
)
inline

Return elements while predicate is true (take_while).

Parameters
cSource container.
predPredicate to test.
Returns
DynList with initial elements satisfying pred.

Definition at line 2422 of file ahFunctional.H.

References Aleph::DynList< T >::append(), and pred.

Referenced by demo_grouping(), TEST(), and TEST().

◆ test_black_condition_rk()

template<class Node >
bool Aleph::test_black_condition_rk ( Node *  p,
int &  max,
int  bh = 0 
)

Test the black height condition for a red-black tree.

Parameters
proot of tree
maxreference to store the black height
bhcurrent black height
Returns
true if condition is satisfied

Definition at line 95 of file rbNodeRk.H.

References and, BLACK, COLOR, LLINK, max(), RLINK, and test_black_condition_rk().

Referenced by is_red_black_rk(), and test_black_condition_rk().

◆ test_sorted()

template<template< typename > class Container, typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
std::pair< bool, size_t > Aleph::test_sorted ( const Container< T > &  cont,
const Compare &  cmp = Compare() 
)

Test if a container is sorted, returning the inversion position.

Similar to is_sorted() but returns additional information about where the ordering test failed or how many elements were checked.

Time complexity: O(n), where n is the container size.

Template Parameters
ContainerTemplate container type.
TElement type stored in the container.
CompareComparison functor type (default: Aleph::less<T>).
Parameters
contThe container to test.
cmpComparison functor defining "less than" relationship.
Returns
A pair where:
  • first is true if sorted, false if an inversion exists.
  • second is the index where the test failed (if not sorted), or the total number of elements (if sorted).
See also
is_sorted(), search_inversion()

Definition at line 290 of file tpl_sort_utils.H.

References cmp(), Aleph::Const_Iterator< It >::get_curr(), Aleph::Const_Iterator< It >::has_curr(), and Aleph::Const_Iterator< It >::next_ne().

◆ tikz_area_style()

Tikz_Style Aleph::tikz_area_style ( const std::string &  draw_color = "black",
const std::string &  fill_color = "gray!25",
const double  opacity = 0.6 
)
inline

Creates a style for drawing filled polygons.

This style is used for representing areas, like polygon intersections or Voronoi cells. It enables filling and sets an opacity for visualization.

Parameters
draw_colorThe stroke color for the polygon boundary.
fill_colorThe fill color for the polygon's interior.
opacityThe opacity of the fill (0.0 to 1.0).
Returns
A Tikz_Style for filled shapes.

Definition at line 390 of file tikzgeom_algorithms.H.

References Aleph::Tikz_Style::draw_color, Aleph::Tikz_Style::fill, Aleph::Tikz_Style::fill_color, and Aleph::Tikz_Style::opacity.

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ tikz_bold_wire_style()

Tikz_Style Aleph::tikz_bold_wire_style ( const std::string &  color,
const double  width_mm = 1.2 
)
inline

Creates a solid wireframe style with an explicit line width.

Used to visually distinguish a "result" outline (e.g. a simplified, offset, or smoothed polygon) from a faded original, without relying on dashed. tikz_wire_style(color, width) would silently set dashed instead (its second parameter is a bool), which is why this exists.

Parameters
colorThe stroke color.
width_mmLine width in millimeters (see Tikz_Style::line_width_mm).
Returns
A solid, non-dashed Tikz_Style with the given line width.

Definition at line 373 of file tikzgeom_algorithms.H.

References color(), Aleph::Tikz_Style::line_width_mm, and tikz_wire_style().

◆ tikz_path_style()

Tikz_Style Aleph::tikz_path_style ( const std::string &  color = "red",
const bool  with_arrow = false 
)
inline

Creates a style optimized for polyline paths.

This style is intended for highlighting paths, such as the result of a shortest-path algorithm. It defaults to a thick, solid line.

Parameters
colorThe path color.
with_arrowWhether to add an arrowhead to the path segments.
Returns
A prominent Tikz_Style for paths.

Definition at line 355 of file tikzgeom_algorithms.H.

References color(), Aleph::Tikz_Style::thick, tikz_wire_style(), and with_arrow.

Referenced by main().

◆ tikz_points_style()

Tikz_Style Aleph::tikz_points_style ( const std::string &  color = "black",
const double  opacity = -1.0 
)
inline

Creates a style optimized for point clouds.

Generates a Tikz_Style where points are drawn as small filled circles. The draw and fill colors are set to the same value.

Parameters
colorThe color for the points.
opacityThe opacity for the points (0.0 to 1.0). -1 means default.
Returns
A Tikz_Style suitable for put_points.

Definition at line 320 of file tikzgeom_algorithms.H.

References color(), Aleph::Tikz_Style::draw_color, Aleph::Tikz_Style::fill_color, and Aleph::Tikz_Style::opacity.

Referenced by main(), main(), put_funnel_trace_step(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ tikz_wire_style()

Tikz_Style Aleph::tikz_wire_style ( const std::string &  color = "black",
const bool  dashed = false,
const bool  with_arrow = false 
)
inline

Creates a style optimized for wireframe segments and polygons.

Parameters
colorThe stroke color.
dashedWhether to use a dashed line style.
with_arrowWhether to add an arrowhead to segments.
Returns
A Tikz_Style suitable for drawing outlines.

Definition at line 336 of file tikzgeom_algorithms.H.

References color(), Aleph::Tikz_Style::dashed, Aleph::Tikz_Style::draw_color, Aleph::Tikz_Style::with_arrow, and with_arrow.

Referenced by main(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), tikz_bold_wire_style(), and tikz_path_style().

◆ timsort() [1/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::timsort ( Array< T > &  a,
const Compare &  cmp = Compare() 
)

Timsort for Array.

Template Parameters
TElement type.
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]aArray to sort.
[in]cmpComparison functor.

Definition at line 7051 of file tpl_sort_utils.H.

References cmp(), Aleph::Array< T >::size(), and timsort().

◆ timsort() [2/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::timsort ( DynArray< T > &  a,
const Compare &  cmp = Compare() 
)

Timsort for DynArray.

Template Parameters
TElement type.
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]aDynArray to sort.
[in]cmpComparison functor.

Definition at line 7032 of file tpl_sort_utils.H.

References cmp(), and timsort().

◆ timsort() [3/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::timsort ( DynDlist< T > &  list,
const Compare &  cmp = Compare() 
)

Timsort for DynDlist.

Template Parameters
TElement type.
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]listDynDlist to sort.
[in]cmpComparison functor.
Complexity
Time O(n log n), Space O(n) due to temporary array copy.

Definition at line 7110 of file tpl_sort_utils.H.

References cmp(), and timsort().

◆ timsort() [4/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::timsort ( DynList< T > &  list,
const Compare &  cmp = Compare() 
)

Timsort for DynList.

Template Parameters
TElement type.
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]listDynList to sort.
[in]cmpComparison functor.
Complexity
Time O(n log n), Space O(n) due to temporary array copy.

Definition at line 7088 of file tpl_sort_utils.H.

References cmp(), and timsort().

◆ timsort() [5/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::timsort ( T *  a,
const long  l,
const long  r,
const Compare &  cmp = Compare() 
)

Timsort on a sub-range [l, r] (inclusive indices).

Template Parameters
TElement type.
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array.
[in]lLeft index (inclusive).
[in]rRight index (inclusive).
[in]cmpComparison functor.

Delegate to the shared implementation over the [l, r] sub-range.

Definition at line 7006 of file tpl_sort_utils.H.

References ah_invalid_argument_if, ah_range_error_if, cmp(), l, r, and Aleph::timsort_detail::timsort_impl().

◆ timsort() [6/7]

template<typename T , StrictWeakOrder< T > Compare = Aleph::less<T>>
void Aleph::timsort ( T *  a,
const size_t  n,
const Compare &  cmp = Compare() 
)

Timsort — adaptive, stable, natural merge sort.

Timsort is a hybrid sorting algorithm derived from merge sort and insertion sort. It identifies existing ordered subsequences (runs) in the data and merges them efficiently. This makes it particularly fast for real-world data that often contains pre-existing order.

Template Parameters
TElement type (must be move-assignable).
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]aPointer to the array to sort.
[in]nNumber of elements.
[in]cmpComparison functor.
Exceptions
std::invalid_argumentif a is null and n > 0.
Complexity
  • Best: O(n) — already sorted data (single run).
  • Average/Worst: O(n log n).
  • Space: O(n) for merge buffer.
Stability
Stable — equal elements preserve their original relative order.
See also
mergesort, insertion_sort, quicksort

Delegate to the shared run-detection-and-merge implementation.

Definition at line 6979 of file tpl_sort_utils.H.

References ah_invalid_argument_if, cmp(), and Aleph::timsort_detail::timsort_impl().

Referenced by bucket_sort(), lazy_permutations(), Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), Aleph::FlatMap< Key, T, Compare >::sort_and_unique(), Aleph::FlatSet< Key, Compare >::sort_and_unique(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::sort_by(), timsort(), timsort(), timsort(), timsort(), and timsort().

◆ timsort() [7/7]

template<typename T , size_t N, StrictWeakOrder< T > Compare = Aleph::less<T>>
requires std::is_invocable_r_v<bool, Compare, const T &, const T &>
void Aleph::timsort ( T(&)  a[N],
const Compare &  cmp = Compare() 
)

Timsort for fixed-size C arrays.

Template Parameters
TElement type.
NArray size.
CompareComparison functor (default: Aleph::less<T>).
Parameters
[in,out]aThe array to sort.
[in]cmpComparison functor.

Definition at line 7070 of file tpl_sort_utils.H.

References cmp(), and timsort().

◆ tindexes()

template<class Container >
DynList< std::tuple< size_t, typename Container::Key_Type > > Aleph::tindexes ( const Container &  c)
inline

Return tuples of (index, key).

Definition at line 1494 of file ahFunctional.H.

References Tuple.

Referenced by TEST_F().

◆ to_Array() [1/2]

template<class C >
requires AlephArrayConvertible<C>
Array< typename C::Item_Type > Aleph::to_Array ( const C &  c)

Convert a container to an Array.

Creates a new Array containing copies of all elements from the given container. The container must provide a get_it() method that returns an iterator with has_curr(), next_ne(), and get_curr() methods.

Template Parameters
CThe container type. Must expose Item_Type and provide a compatible iterator interface.
Parameters
cThe source container.
Returns
An Array containing copies of all elements from c.

Definition at line 168 of file ah-convert.H.

References Aleph::Array< T >::append().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and to_array().

◆ to_array()

template<class C >
Array< typename C::Item_Type > Aleph::to_array ( const C &  c)

Convenience wrapper identical to to_Array (copy contents).

Accepts any Aleph container with Item_Type and get_it().

Definition at line 181 of file ah-convert.H.

References to_Array().

Referenced by benchmark_contiguous_array(), demonstrate_complexity(), TEST(), and TEST().

◆ to_Array() [2/2]

template<typename T >
Array< T > Aleph::to_Array ( const std::vector< T > &  v)
inline

Convert a std::vector to an Array.

Template Parameters
TElement type.
Parameters
vSource vector.
Returns
Array containing copies of all elements from the vector.

Definition at line 155 of file ah-stl-utils.H.

References Aleph::Array< T >::append().

◆ to_days()

size_t Aleph::to_days ( const time_t  t)
inline

Return the number of whole days represented by t.

Definition at line 131 of file ah-date.H.

References ah_domain_error_if, and Aleph::detail::seconds_per_day.

Referenced by TEST().

◆ to_deque()

template<class C >
std::deque< typename C::Item_Type > Aleph::to_deque ( const C &  c)

Convert a container to a std::deque.

Creates a new std::deque containing copies of all elements from the given Aleph-w container.

Template Parameters
CThe container type. Must expose Item_Type and provide a compatible iterator interface.
Parameters
cThe source container.
Returns
A std::deque containing copies of all elements from c.

Definition at line 326 of file ah-convert.H.

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ to_DynArray()

template<class C >
DynArray< typename C::Item_Type > Aleph::to_DynArray ( const C &  c)

Convert a container to a DynArray.

Creates a new DynArray containing copies of all elements from the given container. The container must provide a get_it() method that returns an iterator with has_curr(), next_ne(), and get_curr().

Template Parameters
CThe container type. Must expose Item_Type and provide a compatible iterator interface.
Parameters
cThe source container.
Returns
A DynArray containing copies of all elements from c.

Definition at line 265 of file ah-convert.H.

References Aleph::DynArray< T >::append().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ to_DynList() [1/2]

template<class T >
DynList< T > Aleph::to_DynList ( const Array< T > &  a)

Convert an Array to a DynList.

Creates a new DynList containing copies of all elements from the given Array.

Template Parameters
TThe element type.
Parameters
aThe source Array.
Returns
A DynList containing copies of all elements from a.

Definition at line 148 of file ah-convert.H.

Referenced by demo_integration(), demo_map_transformations(), demo_vector_dynlist(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ to_dynlist()

template<class Container >
DynList< typename Container::Item_Type > Aleph::to_dynlist ( const Container &  c)
inline

◆ to_DynList() [2/2]

template<typename T >
DynList< T > Aleph::to_DynList ( const std::vector< T > &  v)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Alias for vector_to_DynList.

Accepts the same parameters.

Template Parameters
TElement type.
See also
vector_to_DynList For parameter documentation.

Definition at line 122 of file ah-stl-utils.H.

References vector_to_DynList().

◆ to_DynSetTree()

template<class C >
DynSetTree< typename C::Item_Type > Aleph::to_DynSetTree ( const C &  c)

Convert a container to a DynSetTree (AVL by default).

Creates a new DynSetTree containing unique elements from the given container.

Template Parameters
CThe container type. Must expose Item_Type.
Parameters
cThe source container.
Returns
A DynSetTree containing unique elements from c.

Definition at line 983 of file ah-convert.H.

References Aleph::DynSetTree< Key, Tree, Compare >::insert().

Referenced by TEST().

◆ to_lower()

std::string Aleph::to_lower ( const std::string &  str)
inline

Convert a std::string to lower-case (byte-wise).

Parameters
[in]strInput std::string.
Returns
Lowercased copy.

Definition at line 626 of file ah-string-utils.H.

Referenced by TEST(), and TEST().

◆ to_name()

std::string Aleph::to_name ( const std::string &  str)
inline

Uppercase the first character of str and return the resulting copy.

Parameters
[in]strInput std::string.
Returns
Copy with first character converted to upper-case.

Definition at line 652 of file ah-string-utils.H.

Referenced by demo_case_conversion(), and TEST().

◆ to_Pascalcase()

std::string Aleph::to_Pascalcase ( const std::string &  str)
inline

Convert an identifier-like std::string to PascalCase.

Splits on the delimiter set " _-" and uppercases the first character of each token.

Parameters
[in]strInput std::string.
Returns
PascalCased std::string.

Definition at line 806 of file ah-string-utils.H.

References FunctionalMethods< Container, T >::foldl(), FunctionalMethods< Container, T >::mutable_for_each(), split_to_list(), and toupper().

Referenced by demo_case_conversion(), and TEST().

◆ to_set()

template<class C >
std::set< typename C::Item_Type > Aleph::to_set ( const C &  c)

Convert a container to a std::set.

Creates a new std::set containing copies of all unique elements from the given Aleph-w container. Duplicates are automatically removed.

Template Parameters
CThe container type. Must expose Item_Type.
Parameters
cThe source container.
Returns
A std::set containing unique elements from c.

Definition at line 661 of file ah-convert.H.

References Aleph::DynArray< T >::insert().

Referenced by TEST(), TEST(), and TEST().

◆ to_stdvector()

template<class Container >
std::vector< typename Container::Item_Type > Aleph::to_stdvector ( const Container &  c)
inline

Definition at line 729 of file tpl_array.H.

◆ to_str() [1/2]

std::string Aleph::to_str ( const double  d)
inline

Convert double to a std::string with maximum round-trip precision.

Uses std::numeric_limits<double>::max_digits10.

Parameters
[in]dValue to format.
Returns
String representation.

Definition at line 296 of file ah-string-utils.H.

References to_string().

Referenced by main(), Aleph::Dft_Write< Node >::operator()(), ProcessWriter::operator()(), Aleph::Matrix< Trow, Tcol, NumType >::print(), TEST(), Aleph::Matrix< Trow, Tcol, NumType >::to_str(), and Aleph::AlDomain< T >::to_str().

◆ to_str() [2/2]

template<typename Type >
std::string Aleph::to_str ( const Type &  d)
inline

Converts any streamable value to string.

Parameters
dValue to convert
Returns
String representation

Definition at line 184 of file ahDry.H.

◆ to_string() [1/6]

template<typename T >
std::string Aleph::to_string ( const Array< T > &  v)

Convert an Aleph::Array<T> to a comma-separated std::string.

Template Parameters
TElement type streamable to std::ostream.
Parameters
[in]vArray to stringify.
Returns
Comma-separated representation (empty std::string if v is empty).

Definition at line 105 of file ah-string-utils.H.

References LocateFunctions< Container, Type >::get_it().

◆ to_string() [2/6]

std::string Aleph::to_string ( const double  d,
const size_t  precision 
)
inline

Format a double using fixed notation with the given precision.

Parameters
[in]dValue to format.
[in]precisionNumber of digits after the decimal point.
Returns
Formatted std::string.

Definition at line 281 of file ah-string-utils.H.

◆ to_string() [3/6]

std::string Aleph::to_string ( const DynList< DynList< std::string > > &  mat)
inline

Convert a matrix of strings to a single std::string.

Rows are concatenated as-is and separated by newlines.

Parameters
[in]matInput matrix.
Returns
String representation.

Definition at line 1036 of file ah-string-utils.H.

References FunctionalMethods< Container, T >::for_each(), and row.

◆ to_string() [4/6]

std::string Aleph::to_string ( const DynList< std::string > &  lines)
inline

Join lines into a single std::string separated by newlines.

Parameters
[in]linesLines to join.
Returns
Text with "\n" separators.

Definition at line 1079 of file ah-string-utils.H.

References LocateFunctions< Container, Type >::get_it(), and Aleph::DynList< T >::get_last().

◆ to_string() [5/6]

template<typename T >
std::string Aleph::to_string ( const std::vector< T > &  v)

Convert a std::vector<T> to a comma-separated std::string.

Template Parameters
TElement type streamable to std::ostream.
Parameters
[in]vVector to stringify.
Returns
Comma-separated representation (empty std::string if v is empty).

Definition at line 86 of file ah-string-utils.H.

◆ to_string() [6/6]

std::string Aleph::to_string ( const time_t  t,
const std::string &  format 
)
inline

Format a time_t value into a string using format.

Definition at line 140 of file ah-date.H.

References ah_range_error_if, and ah_runtime_error_if.

Referenced by OHashTest< HashTbl >::OHashTest(), align_text_to_left_except_first(), build_complete_graph(), build_crown_graph(), build_grid_network(), build_random_graph(), build_random_graph(), build_tree_graph(), color_legend(), demo_algorithm_comparison(), demo_conversion(), demo_density(), demo_dirac(), demo_erdos_renyi(), demo_folding(), demo_map_filter(), demo_map_transformations(), demo_text_processor(), demo_transformation(), demo_transformations(), demo_variadic_dispatcher(), destroy_mutex(), example_spfa_comparison(), generate_random_graph(), init_mutex(), justify_line_except_first(), FloydIntGraphTest::latex_temp_filename(), main(), nonplanar_certificate_to_dot(), nonplanar_certificate_to_json(), on_temp_up(), TestIndexFormatter< Mat >::operator()(), TestPathFormatter< Mat >::operator()(), TestDistFormatter< Mat >::operator()(), WriteNode::operator()(), Write::operator()(), parse_graph_definition(), print_dewey_view(), run_modern_example(), ParseUtilsTest::SetUp(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), test_performance_sw(), to_str(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST_P(), and write_coloring_dot().

◆ to_time_t() [1/3]

time_t Aleph::to_time_t ( const size_t  dd,
const size_t  mm,
const size_t  yy 
)
inline

Convert a (day, month, year) triple to a POSIX time_t value.

Definition at line 92 of file ah-date.H.

References ah_domain_error_if, Aleph::detail::max_supported_year, Aleph::detail::tm_epoch_year, and valid_day().

Referenced by TEST(), TEST(), TEST(), TEST(), and to_time_t().

◆ to_time_t() [2/3]

time_t Aleph::to_time_t ( const std::string &  s)
inline

Convenience overload for ISO strings (YYYY-MM-DD HH:MM:SS).

Definition at line 125 of file ah-date.H.

References to_time_t().

◆ to_time_t() [3/3]

time_t Aleph::to_time_t ( const std::string &  s,
const std::string &  format 
)
inline

Convert a formatted string to time_t using the provided format.

Definition at line 113 of file ah-date.H.

References ah_domain_error_if.

◆ to_upper()

std::string Aleph::to_upper ( const std::string &  str)
inline

Convert a std::string to upper-case (byte-wise).

Parameters
[in]strInput std::string.
Returns
Uppercased copy.

Definition at line 639 of file ah-string-utils.H.

Referenced by TEST().

◆ to_vector()

template<class C >
std::vector< typename C::Item_Type > Aleph::to_vector ( const C &  c)

Convert a container to a std::vector.

Creates a new std::vector containing copies of all elements from the given container, in the order of its iterator. The container is traversed with get_it() if it has it, as the Aleph-w containers do, and with a range-based for loop otherwise.

Template Parameters
CThe container type. Must expose Item_Type and either get_it(), whose iterator has has_curr(), next_ne() and get_curr(), or begin() and end().
Parameters
cThe source container.
Returns
A std::vector containing copies of all elements from c.

Definition at line 72 of file ah-convert-common.H.

Referenced by demo_integration(), demo_vector_dynlist(), other_unit_to_vector(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ token_type_to_string()

std::string Aleph::token_type_to_string ( TokenType  type)
inline

Convert TokenType to string for debugging.

Definition at line 1518 of file parse_utils.H.

References CHAR, COMMENT, END_OF_FILE, FLOAT, IDENTIFIER, INTEGER, KEYWORD, OPERATOR, PUNCTUATION, STRING, token_type_to_string(), and UNKNOWN.

Referenced by TEST(), Aleph::Token::to_string(), and token_type_to_string().

◆ tolower() [1/2]

std::string Aleph::tolower ( const char *  str)
inline

Convert a C std::string to lower-case.

Parameters
[in]strNull-terminated input std::string.
Returns
Lowercased copy.

Definition at line 306 of file ah-string-utils.H.

Referenced by demo_case_conversion(), demo_practical(), demo_text_processor(), TEST(), TEST(), and tolower().

◆ tolower() [2/2]

std::string Aleph::tolower ( const std::string &  str)
inline

Convert a std::string to lower-case.

Parameters
[in]strInput std::string.
Returns
Lowercased copy.

Definition at line 332 of file ah-string-utils.H.

References tolower().

◆ toupper() [1/2]

std::string Aleph::toupper ( const char *  str)
inline

Convert a C std::string to upper-case.

Parameters
[in]strNull-terminated input std::string.
Returns
Uppercased copy.

Definition at line 319 of file ah-string-utils.H.

Referenced by demo_case_conversion(), demo_text_processor(), TEST(), TEST(), to_Pascalcase(), and toupper().

◆ toupper() [2/2]

std::string Aleph::toupper ( const std::string &  str)
inline

Convert a std::string to upper-case.

Parameters
[in]strInput std::string.
Returns
Uppercased copy.

Definition at line 342 of file ah-string-utils.H.

References toupper().

◆ transform() [1/2]

template<class Itor1 , class Itor2 , class Itor3 , class BinaryFunc >
Itor3 Aleph::transform ( Itor1  source1Beg,
Itor1  source1End,
Itor2  source2Beg,
Itor3  destBeg,
BinaryFunc  op 
)
inline

Transform elements using a binary operation.

Applies op to corresponding elements from two ranges and stores the result starting at destBeg.

Template Parameters
Itor1First source iterator type.
Itor2Second source iterator type.
Itor3Destination iterator type.
BinaryFuncTransformation function type.
Parameters
source1BegIterator to the first element of the first source.
source1EndIterator past the last element of the first source.
source2BegIterator to the first element of the second source.
destBegIterator to the first destination position.
opBinary operation to apply.
Returns
Iterator past the last transformed element in destination.

Definition at line 660 of file ahAlgo.H.

◆ transform() [2/2]

template<class Itor1 , class Itor2 , class UnaryFunc >
Itor2 Aleph::transform ( Itor1  sourceBeg,
Itor1  sourceEnd,
Itor2  destBeg,
UnaryFunc  op 
)
inline

Transform elements using a unary operation.

Applies op to each element in [sourceBeg, sourceEnd) and stores the result in the range starting at destBeg.

Template Parameters
Itor1Source iterator type.
Itor2Destination iterator type.
UnaryFuncTransformation function type.
Parameters
sourceBegIterator to the first source element.
sourceEndIterator past the last source element.
destBegIterator to the first destination position.
opUnary operation to apply.
Returns
Iterator past the last transformed element in destination.

Definition at line 632 of file ahAlgo.H.

Referenced by TEST(), and TEST().

◆ transform_tuple()

template<class Op , class Tuple >
auto Aleph::transform_tuple ( Op &&  op,
Tuple &&  t 
)

Transform each element of a tuple, returning a new tuple.

Creates a new tuple by applying a transformation function to each element of the input tuple. The result types are deduced from the return type of the transformation applied to each element. Uses std::index_sequence for compile-time iteration.

Template Parameters
OpTransformation callable type.
TupleInput tuple type.
Parameters
opTransformation to apply to each element.
tInput tuple.
Returns
New tuple containing transformed values.
Example:
auto t = std::make_tuple(1, 2, 3);
// Double each element
auto doubled = transform_tuple([](auto x) { return x * 2; }, t);
// doubled is (2, 4, 6)
// Convert to strings
auto strings = transform_tuple([](auto x) {
return std::to_string(x);
}, t);
// strings is ("1", "2", "3") with type std::tuple<string, string, string>
auto transform_tuple(Op &&op, Tuple &&t)
Transform each element of a tuple, returning a new tuple.
Definition ah-zip.H:1951

Definition at line 1951 of file ah-zip.H.

References Aleph::zip_index_detail::transform_tuple_impl().

Referenced by TEST(), TEST(), and TEST().

◆ transpose()

template<typename T >
DynList< DynList< T > > Aleph::transpose ( const DynList< DynList< T > > &  l)
inline

*‍/

Transpose a matrix represented as a list of lists.

Given a matrix \(M\), returns \(M^T\). The input is expected to be rectangular (all rows with the same length).

Template Parameters
TElement type.
Parameters
[in]lInput matrix as a DynList of DynLists.
Returns
The transposed matrix.
Note
If l is empty, an empty matrix is returned.
In debug builds, non-rectangular inputs trigger an assertion.
Complexity: Time O(rows * cols), Space O(rows * cols).

Definition at line 250 of file ah-comb.H.

References Aleph::Array< T >::append(), Aleph::DynList< T >::append(), LocateFunctions< Container, Type >::get_it(), Aleph::HTList::is_empty(), l, row, Aleph::Array< T >::size(), and size().

Referenced by demo_transpose(), test(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ traverse_perm() [1/2]

template<typename T , class Op >
bool Aleph::traverse_perm ( const DynList< DynList< T > > &  l,
Op &&  op 
)
inline

Convenience overload accepting an rvalue callable.

Definition at line 465 of file ah-comb.H.

References l, and traverse_perm().

◆ traverse_perm() [2/2]

template<typename T , class Op >
bool Aleph::traverse_perm ( const DynList< DynList< T > > &  l,
Op &  op 
)
inline

*‍/

Traverse the Cartesian product of a list of lists.

Given a list of lists \(L = \{l_1, l_2, \dots, l_n\}\), this function generates all possible sequences \(\{a_1, a_2, \dots, a_n\}\)where each \(a_i \in l_i\).

For each generated sequence, it invokes op(sequence).

Template Parameters
TElement type.
OpCallable signature: bool op(const DynList<T> &).
Parameters
[in]lA DynList containing multiple DynLists of elements.
[in]opCallback function. If it returns false, traversal stops.
Returns
true if all sequences were traversed; false if op aborted.
Complexity: Time O(total_sequences * n), Space O(n) recursion depth.

Definition at line 443 of file ah-comb.H.

References LocateFunctions< Container, Type >::get_it(), l, and Aleph::DynList< T >::rev().

Referenced by all_perm(), demo_traverse(), exists_perm(), fold_perm(), for_each_perm(), test(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and traverse_perm().

◆ tree_max_distance()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Array< size_t > Aleph::tree_max_distance ( const GT &  g,
typename GT::Node *  root,
SA  sa = SA() 
)

Compute the maximum distance from each node to any leaf.

Uses rerooting DP to compute the eccentricity (max distance) for every node.

Parameters
[in]gThe graph (tree).
[in]rootRoot node.
[in]saArc filter.
Returns
Array of max distances indexed by internal node id.
Note
Complexity: O(n).

Definition at line 767 of file Tree_DP.H.

References Aleph::Array< T >::create(), root(), Aleph::Gen_Reroot_DP< GT, T, SA >::size(), and Aleph::Gen_Reroot_DP< GT, T, SA >::values().

Referenced by main(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ tree_subtree_sizes()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Array< size_t > Aleph::tree_subtree_sizes ( const GT &  g,
typename GT::Node *  root,
SA  sa = SA() 
)

Compute subtree sizes for every node.

Parameters
[in]gThe graph (tree).
[in]rootRoot node.
[in]saArc filter.
Returns
Array of subtree sizes indexed by internal node id.
Note
Complexity: O(n).

Definition at line 732 of file Tree_DP.H.

References Aleph::Array< T >::create(), root(), Aleph::Gen_Tree_DP< GT, T, SA >::size(), and Aleph::Gen_Tree_DP< GT, T, SA >::values().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ tree_sum_of_distances()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Array< size_t > Aleph::tree_sum_of_distances ( const GT &  g,
typename GT::Node *  root,
SA  sa = SA() 
)

Compute sum of distances from each node to all others.

Uses rerooting DP with (count, sum_dist) pairs.

Parameters
[in]gThe graph (tree).
[in]rootRoot node.
[in]saArc filter.
Returns
Array of sum-of-distances indexed by internal node id.
Note
Complexity: O(n).

Definition at line 805 of file Tree_DP.H.

References Aleph::Array< T >::create(), root(), Aleph::Gen_Reroot_DP< GT, T, SA >::size(), and Aleph::Gen_Reroot_DP< GT, T, SA >::values().

Referenced by main(), TEST(), TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), and TYPED_TEST().

◆ trim()

std::string Aleph::trim ( const std::string &  s)
inline

Return a trimmed copy of a std::string (leading + trailing whitespace removed).

Parameters
[in]sInput std::string.
Returns
Trimmed copy of s.

Definition at line 244 of file ah-string-utils.H.

References ltrim(), rtrim(), and trim().

Referenced by csv_trim_fields(), demo_practical(), demo_trimming(), TEST(), TEST(), TEST(), TEST(), and trim().

◆ trim_in_place()

std::string & Aleph::trim_in_place ( std::string &  s)
inline

Trim a std::string in-place (leading + trailing whitespace removed).

Parameters
[in,out]sString to modify.
Returns
Reference to s.

Definition at line 257 of file ah-string-utils.H.

References ltrim(), and rtrim().

Referenced by TEST().

◆ try_char()

bool Aleph::try_char ( std::ifstream &  input_stream,
char  ch 
)
inline

Try to match a character without throwing.

Checks if the next non-whitespace character matches. If it does, consumes it and returns true. Otherwise, returns false without consuming anything.

Parameters
input_streamThe input file stream
chThe character to try to match
Returns
true if matched and consumed, false otherwise

Definition at line 1328 of file parse_utils.H.

References mark_position(), read_char_from_stream(), restore_position(), skip_white_spaces(), and try_char().

Referenced by TEST_F(), TEST_F(), and try_char().

◆ tunzip()

template<template< typename > class Container, typename T1 , typename T2 >
std::tuple< Container< T1 >, Container< T2 > > Aleph::tunzip ( const Container< std::tuple< T1, T2 > > &  l)
inline

Separate a list of tuples into two containers.

The inverse of tzip(). Takes a container of 2-tuples and produces two separate containers with the first and second elements respectively.

Template Parameters
ContainerContainer template type.
T1Type of first tuple elements.
T2Type of second tuple elements.
Parameters
lSource container of tuples.
Returns
std::tuple of two containers (firsts, seconds).
Example:
{1, 1.1}, {2, 2.2}, {3, 3.3}
};
auto [ints, doubles] = tunzip<DynList>(tuples);
// ints = {1, 2, 3}
// doubles = {1.1, 2.2, 3.3}
See also
tzip() for the inverse operation.
unzip() for pair-based version.

Definition at line 1437 of file ahFunctional.H.

References Aleph::DynList< T >::append(), LocateFunctions< Container, Type >::get_it(), l, l1, and l2.

Referenced by TEST_F().

◆ tuple_for_each() [1/2]

template<class F , class... Ts>
void Aleph::tuple_for_each ( const std::tuple< Ts... > &  tuple,
F  func 
)
inline

Convenience overload that automatically generates the index sequence.

Template Parameters
FCallable type.
TsTypes in the tuple.
Parameters
tupleThe tuple to iterate over.
funcFunction to apply to each element.

Definition at line 105 of file ah-stl-utils.H.

References tuple_for_each().

◆ tuple_for_each() [2/2]

template<class F , class... Ts, std::size_t... Is>
void Aleph::tuple_for_each ( const std::tuple< Ts... > &  tuple,
F  func,
std::index_sequence< Is... >   
)
inline

Apply a function to each element in a tuple (tuple first).

Iterates over all elements in a tuple and applies the given function to each one.

Note
This function takes the tuple as the first argument, unlike Aleph::for_each_in_tuple in ah-zip.H which takes the operation first.
Template Parameters
FCallable type.
TsTypes in the tuple.
IsIndex sequence.
Parameters
tupleThe tuple to iterate over.
funcFunction to apply to each element.

Definition at line 85 of file ah-stl-utils.H.

Referenced by demo_tuple_conversions(), TEST(), TEST(), TEST(), TEST(), and tuple_for_each().

◆ tuple_to_array()

template<typename T , typename... U>
Array< T > Aleph::tuple_to_array ( const std::tuple< T, U... > &  t)
inline

Convert a tuple to an Array.

Template Parameters
TFirst element type (determines array element type).
URemaining element types (must all be T).
Parameters
tSource tuple.
Returns
Array containing all tuple elements.

Definition at line 350 of file ah-stl-utils.H.

Referenced by demo_tuple_conversions(), and TEST().

◆ tuple_to_container()

template<class Container , typename T , typename... U>
Container Aleph::tuple_to_container ( const std::tuple< T, U... > &  t)
inline

Convert a tuple to an Aleph-w container.

Converts all elements of a homogeneous tuple to the specified container type.

Template Parameters
ContainerTarget container type (must support build_container).
TFirst element type (determines container element type).
URemaining element types (must all be T).
Parameters
tSource tuple.
Returns
Container with all tuple elements.

Definition at line 319 of file ah-stl-utils.H.

◆ tuple_to_dynlist()

template<typename T , typename... U>
DynList< T > Aleph::tuple_to_dynlist ( const std::tuple< T, U... > &  t)
inline

Convert a tuple to a DynList.

Template Parameters
TFirst element type (determines list element type).
URemaining element types (must all be T).
Parameters
tSource tuple.
Returns
DynList containing all tuple elements.

Definition at line 335 of file ah-stl-utils.H.

Referenced by demo_tuple_conversions(), TEST(), TEST(), and TEST().

◆ tzip()

template<class Container1 , class Container2 >
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > Aleph::tzip ( const Container1 &  a,
const Container2 &  b 
)
inline

Zip two containers into a list of tuples.

Like zip() but returns tuples instead of pairs. Tuples provide better integration with structured bindings and tuple utilities.

Template Parameters
Container1Type of the first container.
Container2Type of the second container.
Parameters
aFirst container.
bSecond container.
Returns
DynList of tuples (a[i], b[i]).
Example:
DynList<int> xs = {1, 2};
DynList<double> ys = {1.1, 2.2};
auto tuples = tzip(xs, ys);
for (const auto& [x, y] : tuples)
std::cout << x << ", " << y << '\n';
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > tzip(const Container1 &a, const Container2 &b)
Zip two containers into a list of tuples.
See also
zip() for pair-based version.
tzipEq() for version that throws on length mismatch.
tzip_longest() for version that pads shorter container.

Definition at line 1067 of file ahFunctional.H.

References and, Aleph::DynList< T >::append(), LocateFunctions< Container, Type >::get_it(), and Tuple.

Referenced by TEST_F().

◆ tzip_longest()

template<class Container1 , class Container2 >
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > Aleph::tzip_longest ( const Container1 &  a,
const Container2 &  b,
const typename Container1::Item_Type &  fill_a = typename Container1::Item_Type(),
const typename Container2::Item_Type &  fill_b = typename Container2::Item_Type() 
)
inline

Zip two containers into tuples, padding the shorter one.

Like zip_longest() but returns tuples instead of pairs. This provides better integration with structured bindings and tuple utilities.

Template Parameters
Container1Type of the first container.
Container2Type of the second container.
Parameters
aFirst container.
bSecond container.
fill_aValue to use when container a is exhausted.
fill_bValue to use when container b is exhausted.
Returns
DynList of tuples containing all elements from both containers.
Example:
DynList<std::string> names = {"Alice", "Bob"};
DynList<int> scores = {100, 95, 88, 72};
auto result = tzip_longest(names, scores, "N/A", 0);
// result contains: {("Alice", 100), ("Bob", 95), ("N/A", 88), ("N/A", 72)}
// Using structured bindings:
for (const auto& [name, score] : result)
std::cout << name << ": " << score << '\n';
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > tzip_longest(const Container1 &a, const Container2 &b, const typename Container1::Item_Type &fill_a=typename Container1::Item_Type(), const typename Container2::Item_Type &fill_b=typename Container2::Item_Type())
Zip two containers into tuples, padding the shorter one.
See also
zip_longest() for pair-based version.
tzip() for version that stops at the shorter container.

Definition at line 2878 of file ahFunctional.H.

References and, Aleph::DynList< T >::append(), LocateFunctions< Container, Type >::get_it(), and Tuple.

Referenced by TEST().

◆ tzip_std()

template<typename... Cs>
auto Aleph::tzip_std ( const Cs &...  cs)

Build a vector of tuples from 2 or more STL containers (variadic).

Works with any STL-compatible containers that have begin(), end(), and value_type. Stops at the shortest container.

Example:

std::vector<int> v1 = {1, 2, 3};
std::vector<double> v2 = {1.1, 2.2, 3.3};
std::vector<std::string> v3 = {"a", "b", "c"};
auto result = tzip_std(v1, v2, v3);
// result is std::vector<std::tuple<int, double, std::string>>
auto tzip_std(const Cs &...cs)
Build a vector of tuples from 2 or more STL containers (variadic).
Definition ah-zip.H:1615

Definition at line 1615 of file ah-zip.H.

References Aleph::std_zip_detail::advance_all(), Aleph::std_zip_detail::all_valid(), and Aleph::std_zip_detail::deref_all().

Referenced by demo_stl_compatibility(), std_zip_n(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ tzipEq()

template<class Container1 , class Container2 >
DynList< std::tuple< typename Container1::Item_Type, typename Container2::Item_Type > > Aleph::tzipEq ( const Container1 &  a,
const Container2 &  b 
)
inline

Zip two containers into tuples; throw if lengths differ.

Like tzip() but verifies that both containers have equal length. Throws std::length_error if container sizes don't match.

Template Parameters
Container1Type of the first container.
Container2Type of the second container.
Parameters
aFirst container.
bSecond container.
Returns
DynList of tuples (a[i], b[i]).
Exceptions
std::length_errorif container sizes mismatch.
See also
tzip() for version that stops at shorter container.
zipEq() for pair-based version.

Definition at line 1144 of file ahFunctional.H.

References ah_length_error_if, and, Aleph::DynList< T >::append(), LocateFunctions< Container, Type >::get_it(), and Tuple.

Referenced by TEST_F().

◆ u_index()

constexpr size_t Aleph::u_index ( const size_t &  i)
inlineconstexpr

Map a binary heap index to the index of its parent.

For 1-based heaps, u_index(i) returns i/2.

Parameters
[in]iNode index.
Returns
Parent index.

Definition at line 204 of file ahUtils.H.

Referenced by Aleph::arrayheap_detail::sift_up(), TEST(), Aleph::arrayheap_detail::undo_sift_down(), Aleph::dynarrayheap_detail::up_index(), and valid_heap().

◆ unexpected()

template<class E >
Aleph::unexpected ( E  ) -> unexpected< E >

◆ uni_all()

template<typename Pred , typename Container >
bool Aleph::uni_all ( Pred &&  pred,
const Container &  c 
)

Check if all elements satisfy predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
true if all elements satisfy predicate.

Definition at line 404 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by demo_predicates(), main(), TEST(), and TEST().

◆ uni_any()

template<typename Pred , typename Container >
bool Aleph::uni_any ( Pred &&  pred,
const Container &  c 
)

Alias for uni_exists.

Definition at line 452 of file ah-uni-functional.H.

References pred, and uni_exists().

Referenced by demo_predicates().

◆ uni_compare()

template<typename Container1 , typename Container2 >
int Aleph::uni_compare ( const Container1 &  c1,
const Container2 &  c2 
)

Compare two containers lexicographically.

Efficiently compares containers element-by-element without materializing intermediate vectors. Handles all combinations of STL and Aleph containers.

Parameters
c1First container.
c2Second container.
Returns
-1 if c1 < c2, 0 if equal, 1 if c1 > c2.

Definition at line 1535 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and and.

Referenced by TEST().

◆ uni_concat()

template<typename Container1 , typename Container2 >
auto Aleph::uni_concat ( const Container1 &  c1,
const Container2 &  c2 
)

Concatenate two containers.

Parameters
c1First container.
c2Second container.
Returns
std::vector with all elements from c1 followed by c2.

Definition at line 1177 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

◆ uni_count()

template<typename Pred , typename Container >
size_t Aleph::uni_count ( Pred &&  pred,
const Container &  c 
)

Count elements satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
Number of elements satisfying predicate.

Definition at line 609 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), count(), and pred.

Referenced by demo_predicates(), and TEST().

◆ uni_distinct()

template<typename Container >
auto Aleph::uni_distinct ( const Container &  c)

Remove all duplicates (keeps first occurrence).

Uses linear search for all containers since we cannot assume hashability or consistent ordering across STL and Aleph containers.

Parameters
cContainer.
Returns
std::vector with all duplicates removed.

Definition at line 1310 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

◆ uni_drop()

template<typename Container >
auto Aleph::uni_drop ( size_t  n,
const Container &  c 
)

Drop first n elements, return the rest.

Parameters
nNumber of elements to skip.
cContainer.
Returns
std::vector with remaining elements.

Definition at line 702 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and count().

Referenced by demo_slicing(), and TEST().

◆ uni_drop_while()

template<typename Pred , typename Container >
auto Aleph::uni_drop_while ( Pred &&  pred,
const Container &  c 
)

Drop elements while predicate is true, return the rest.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::vector with remaining elements.

Definition at line 776 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and, and pred.

Referenced by demo_slicing(), and TEST().

◆ uni_equal()

template<typename Container1 , typename Container2 >
bool Aleph::uni_equal ( const Container1 &  c1,
const Container2 &  c2 
)

Check equality of two containers.

Efficiently compares containers element-by-element without materializing intermediate vectors. Handles all combinations of STL and Aleph containers.

Parameters
c1First container.
c2Second container.
Returns
true if containers have same elements in same order.

Definition at line 1475 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and and.

Referenced by main(), and TEST().

◆ uni_exists()

template<typename Pred , typename Container >
bool Aleph::uni_exists ( Pred &&  pred,
const Container &  c 
)

Check if any element satisfies predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
true if any element satisfies predicate.

Definition at line 432 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by demo_predicates(), main(), TEST(), TEST(), uni_any(), and uni_none().

◆ uni_filter()

template<typename Pred , typename Container >
auto Aleph::uni_filter ( Pred &&  pred,
const Container &  c 
)

Filter elements satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::vector with filtered elements.

Definition at line 269 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by demo_conversion(), demo_map_filter(), main(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ uni_filteri()

template<typename Pred , typename Container >
auto Aleph::uni_filteri ( Pred &&  pred,
const Container &  c 
)

Filter with index (filteri in ML).

Parameters
predPredicate (size_t idx, element) -> bool.
cContainer.
Returns
std::vector with filtered elements.

Definition at line 301 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by demo_map_filter(), and TEST().

◆ uni_find()

template<typename Pred , typename Container >
auto Aleph::uni_find ( Pred &&  pred,
const Container &  c 
)

Find first element satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::optional with element if found.

Definition at line 482 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by demo_access(), and TEST().

◆ uni_find_index()

template<typename Pred , typename Container >
std::optional< size_t > Aleph::uni_find_index ( Pred &&  pred,
const Container &  c 
)

Find index of first element satisfying predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::optional<size_t> with index if found.

Definition at line 512 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by TEST().

◆ uni_find_mapi()

template<typename Op , typename Container >
auto Aleph::uni_find_mapi ( Op &&  op,
const Container &  c 
)

Find and map with index (find_mapi in ML).

Parameters
opCallable (size_t idx, element) -> std::optional<R>.
cContainer.
Returns
First non-empty result from op.

Definition at line 545 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

◆ uni_first()

template<typename Container >
auto Aleph::uni_first ( const Container &  c)

Get first element.

Parameters
cContainer.
Returns
std::optional with first element if container is not empty.

Definition at line 821 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_access(), TEST(), TEST(), TEST(), and TEST().

◆ uni_flat_map()

template<typename Op , typename Container >
auto Aleph::uni_flat_map ( Op &&  op,
const Container &  c 
)

Flat map - map then flatten.

Parameters
opOperation (element) -> Container<R>.
cContainer.
Returns
std::vector with flattened mapped results.

Definition at line 1255 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

◆ uni_flatten()

template<typename Container >
auto Aleph::uni_flatten ( const Container &  c)

Flatten a container of containers.

Parameters
cContainer of containers.
Returns
std::vector with all nested elements.

Definition at line 1209 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

◆ uni_foldl()

template<typename T , typename Op , typename Container >
T Aleph::uni_foldl ( T  init,
Op &&  op,
const Container &  c 
)

Left fold (foldl) - reduce from left to right.

Parameters
initInitial accumulator value.
opBinary operation (acc, element) -> acc.
cContainer.
Returns
Final accumulated value.

Definition at line 335 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and init.

Referenced by demo_fold_reduce(), demo_statistics(), demo_unified_api(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), and uni_reduce().

◆ uni_for_each()

template<typename Op , typename Container >
void Aleph::uni_for_each ( Op &&  op,
const Container &  c 
)

Apply operation to each element (for_each).

Works with both STL and Aleph containers.

Parameters
opCallable (element) -> void.
cContainer (STL or Aleph).

Definition at line 164 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by TEST().

◆ uni_for_each_indexed()

template<typename Op , typename Container >
void Aleph::uni_for_each_indexed ( Op &&  op,
const Container &  c 
)

Apply operation to each element with index.

Parameters
opCallable (size_t idx, element) -> void.
cContainer.

Definition at line 184 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

◆ uni_group_by()

template<typename Key , typename Container >
auto Aleph::uni_group_by ( Key &&  key,
const Container &  c 
)

Group elements by key function.

Parameters
keyKey extractor (element) -> K.
cContainer.
Returns
std::vector of pairs (key, vector of elements with that key).

Definition at line 1342 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and k.

◆ uni_last()

template<typename Container >
auto Aleph::uni_last ( const Container &  c)

Get last element.

Parameters
cContainer.
Returns
std::optional with last element if container is not empty.

Definition at line 850 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_access(), TEST(), and TEST().

◆ uni_length()

template<typename Container >
size_t Aleph::uni_length ( const Container &  c)

Get container length.

Parameters
cContainer.
Returns
Number of elements.

Definition at line 638 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and count().

Referenced by demo_access(), demo_practical(), demo_statistics(), and TEST().

◆ uni_map()

template<typename Op , typename Container >
auto Aleph::uni_map ( Op &&  op,
const Container &  c 
)

Map operation - transform each element.

Parameters
opCallable (element) -> R.
cContainer.
Returns
std::vector<R> with transformed values.

Definition at line 206 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_conversion(), demo_map_filter(), demo_unified_api(), main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ uni_mapi()

template<typename Op , typename Container >
auto Aleph::uni_mapi ( Op &&  op,
const Container &  c 
)

Map with index (mapi in ML).

Parameters
opCallable (size_t idx, element) -> R.
cContainer.
Returns
std::vector<R> with transformed values.

Definition at line 237 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_map_filter(), and TEST().

◆ uni_max()

template<typename Container >
auto Aleph::uni_max ( const Container &  c)

Get maximum element.

Parameters
cContainer.
Returns
std::optional with maximum element.

Definition at line 962 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_practical(), demo_statistics(), TEST(), and TEST().

◆ uni_mem()

template<typename T , typename Container >
bool Aleph::uni_mem ( const T &  target,
const Container &  c 
)

Check if element exists in container (mem in ML).

Parameters
targetElement to search for.
cContainer.
Returns
true if target is found.

Definition at line 578 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_predicates(), and TEST().

◆ uni_min()

template<typename Container >
auto Aleph::uni_min ( const Container &  c)

Get minimum element.

Parameters
cContainer.
Returns
std::optional with minimum element.

Definition at line 916 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_statistics(), main(), TEST(), and TEST().

◆ uni_min_max()

template<typename Container >
auto Aleph::uni_min_max ( const Container &  c)

Get both min and max in a single pass.

Parameters
cContainer.
Returns
std::optional<std::pair<T, T>> with (min, max).

Definition at line 1008 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_statistics(), and TEST().

◆ uni_none()

template<typename Pred , typename Container >
bool Aleph::uni_none ( Pred &&  pred,
const Container &  c 
)

Check if no element satisfies predicate.

Definition at line 463 of file ah-uni-functional.H.

References pred, and uni_exists().

Referenced by demo_predicates().

◆ uni_nth()

template<typename Container >
auto Aleph::uni_nth ( size_t  n,
const Container &  c 
)

Get n-th element.

Parameters
nIndex (0-based).
cContainer.
Returns
std::optional with n-th element if exists.

Definition at line 879 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_access(), and TEST().

◆ uni_partition()

template<typename Pred , typename Container >
auto Aleph::uni_partition ( Pred &&  pred,
const Container &  c 
)

Partition elements by predicate.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
Pair of vectors: (elements satisfying pred, elements not satisfying pred).

Definition at line 1132 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by demo_slicing(), and TEST().

◆ uni_product()

template<typename Container >
auto Aleph::uni_product ( const Container &  c)

Product of all elements.

Parameters
cContainer of numeric values.
Returns
Product of all elements.

Definition at line 1090 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_fold_reduce(), and TEST().

◆ uni_reduce()

template<typename T , typename Op , typename Container >
T Aleph::uni_reduce ( T  init,
Op &&  op,
const Container &  c 
)

Alias for uni_foldl.

Definition at line 351 of file ah-uni-functional.H.

References init, and uni_foldl().

◆ uni_scan_left()

template<typename T , typename Op , typename Container >
std::vector< T > Aleph::uni_scan_left ( T  init,
Op &&  op,
const Container &  c 
)

Scan left - fold with all intermediate results.

Parameters
initInitial value.
opBinary operation (acc, element) -> acc.
cContainer.
Returns
std::vector containing init and all intermediate results.

Definition at line 367 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and init.

Referenced by TEST().

◆ uni_sum()

template<typename Container >
auto Aleph::uni_sum ( const Container &  c)

Sum all elements.

Parameters
cContainer of numeric values.
Returns
Sum of all elements.

Definition at line 1063 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and sum().

Referenced by demo_fold_reduce(), demo_practical(), main(), and TEST().

◆ uni_take()

template<typename Container >
auto Aleph::uni_take ( size_t  n,
const Container &  c 
)

Take first n elements.

Parameters
nNumber of elements to take.
cContainer.
Returns
std::vector with first n elements.

Definition at line 667 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and, and count().

Referenced by demo_slicing(), main(), and TEST().

◆ uni_take_while()

template<typename Pred , typename Container >
auto Aleph::uni_take_while ( Pred &&  pred,
const Container &  c 
)

Take elements while predicate is true.

Parameters
predPredicate (element) -> bool.
cContainer.
Returns
std::vector with elements taken while predicate is true.

Definition at line 737 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator(), and pred.

Referenced by demo_slicing(), and TEST().

◆ uni_tally()

template<typename Container >
auto Aleph::uni_tally ( const Container &  c)

Count occurrences of each element (frequency count).

Parameters
cContainer.
Returns
std::vector of pairs (element, count), ordered by first occurrence.

Definition at line 1390 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

◆ uni_to_vector()

template<typename Container >
auto Aleph::uni_to_vector ( const Container &  c)

Convert container to std::vector.

Parameters
cContainer (STL or Aleph).
Returns
std::vector with all elements.

Definition at line 1438 of file ah-uni-functional.H.

References Aleph::uni_functional_detail::aleph_iterator().

Referenced by demo_conversion(), demo_practical(), and TEST().

◆ uni_unzip()

template<typename Container >
auto Aleph::uni_unzip ( const Container &  c)

Unzip a container of pairs into two DynLists.

Works with any container (STL or Aleph) containing pairs. Returns DynList since this is for mixed container scenarios.

Parameters
cContainer of pairs to unzip.
Returns
Pair of DynLists containing separated elements.
Example:
std::vector<std::pair<int, std::string>> pairs = {{1, "a"}, {2, "b"}};
auto [nums, strs] = uni_unzip(pairs);
// nums is DynList<int>{1, 2}, strs is DynList<std::string>{"a", "b"}
auto uni_unzip(const Container &c)
Unzip a container of pairs into two DynLists.
Author
Leandro Rabindranath León

Definition at line 1331 of file ah-zip-utils.H.

References Aleph::DynList< T >::append(), and value.

Referenced by TEST(), and TEST().

◆ uni_unzip_tuple()

template<typename Container >
auto Aleph::uni_unzip_tuple ( const Container &  c)

Unzip a container of tuples into a tuple of DynLists.

Works with any container (STL or Aleph) containing tuples. Returns tuple of DynLists since this is for mixed container scenarios.

Parameters
cContainer of tuples to unzip.
Returns
Tuple of DynLists, one for each tuple element.
Example:
std::vector<std::tuple<int, double, char>> tuples = {
{1, 1.1, 'a'}, {2, 2.2, 'b'}
};
auto [ints, doubles, chars] = uni_unzip_tuple(tuples);
// Each is a DynList
auto uni_unzip_tuple(const Container &c)
Unzip a container of tuples into a tuple of DynLists.
Author
Leandro Rabindranath León

Definition at line 1399 of file ah-zip-utils.H.

References Aleph::uni_unzip_detail::append_tuple_elements(), and value.

Referenced by TEST(), and TEST().

◆ uni_zip()

template<typename... Containers>
auto Aleph::uni_zip ( const Containers &...  cs)

Create a lazy zip view over any combination of STL/Aleph containers.

Parameters
csContainers to zip (any mix of STL and Aleph).
Returns
UniZipView for lazy iteration.
Example:
std::vector<int> v = {1, 2, 3};
DynList<std::string> l = {"a", "b", "c"};
// Mix STL and Aleph!
for (auto [num, str] : uni_zip(v, l))
std::cout << num << ": " << str << "\n";
auto uni_zip(const Containers &...cs)
Create a lazy zip view over any combination of STL/Aleph containers.
Author
Leandro Rabindranath León

Definition at line 557 of file ah-zip-utils.H.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ uni_zip_all()

template<typename Pred , typename... Containers>
bool Aleph::uni_zip_all ( Pred &&  pred,
const Containers &...  cs 
)

Check if predicate holds for all zipped tuples.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip (STL or Aleph).
Returns
true if pred is true for all tuples.
Author
Leandro Rabindranath León

Definition at line 593 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by demo_predicates(), TEST(), TEST(), and TEST().

◆ uni_zip_all_eq()

template<typename Pred , typename... Containers>
bool Aleph::uni_zip_all_eq ( Pred &&  pred,
const Containers &...  cs 
)

Check if all tuples satisfy predicate AND containers have equal length.

Author
Leandro Rabindranath León

Definition at line 609 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by TEST().

◆ uni_zip_any()

template<typename Pred , typename... Containers>
bool Aleph::uni_zip_any ( Pred &&  pred,
const Containers &...  cs 
)

Alias for uni_zip_exists.

Definition at line 641 of file ah-zip-utils.H.

References pred, and uni_zip_exists().

◆ uni_zip_assoc()

template<typename Key , typename... Containers>
auto Aleph::uni_zip_assoc ( const Key &  key,
const Containers &...  cs 
)

Find value associated with key in zipped pairs (assoc in ML).

Parameters
keyThe key to search for.
csContainers to zip (first container contains keys).
Returns
Optional containing the full tuple if found.
Author
Leandro Rabindranath León

Definition at line 1193 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::get_curr(), and uni_zip_it().

Referenced by TEST().

◆ uni_zip_count()

template<typename Pred , typename... Containers>
size_t Aleph::uni_zip_count ( Pred &&  pred,
const Containers &...  cs 
)

Count tuples satisfying predicate.

Author
Leandro Rabindranath León

Definition at line 802 of file ah-zip-utils.H.

References count(), pred, and uni_zip_it().

Referenced by TEST().

◆ uni_zip_drop()

template<typename... Containers>
auto Aleph::uni_zip_drop ( size_t  n,
const Containers &...  cs 
)

Skip first n tuples, return the rest.

Author
Leandro Rabindranath León

Definition at line 886 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_utilities(), TEST(), and TEST().

◆ uni_zip_drop_while()

template<typename Pred , typename... Containers>
auto Aleph::uni_zip_drop_while ( Pred &&  pred,
const Containers &...  cs 
)

Skip tuples while predicate is true, return the rest.

Author
Leandro Rabindranath León

Definition at line 931 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by TEST(), and TEST().

◆ uni_zip_equal_by()

template<typename Eq , typename... Containers>
bool Aleph::uni_zip_equal_by ( Eq &&  eq,
const Containers &...  cs 
)

Check equality with custom comparator.

Parameters
eqEquality predicate (tuple) -> bool.
csContainers to zip.
Returns
true if all tuples satisfy eq AND containers have equal length.
Author
Leandro Rabindranath León

Definition at line 1153 of file ah-zip-utils.H.

References eq(), and uni_zip_it().

Referenced by TEST(), and TEST().

◆ uni_zip_equal_length()

template<typename... Containers>
bool Aleph::uni_zip_equal_length ( const Containers &...  cs)

Check if all containers have equal length.

Author
Leandro Rabindranath León

Definition at line 834 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_advanced(), TEST(), and TEST().

◆ uni_zip_exists()

template<typename Pred , typename... Containers>
bool Aleph::uni_zip_exists ( Pred &&  pred,
const Containers &...  cs 
)

Check if predicate holds for any zipped tuple.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
true if any tuple satisfies pred.
Author
Leandro Rabindranath León

Definition at line 630 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by demo_predicates(), TEST(), uni_zip_any(), and uni_zip_none().

◆ uni_zip_filter()

template<typename Pred , typename... Containers>
auto Aleph::uni_zip_filter ( Pred &&  pred,
const Containers &...  cs 
)

Filter zipped tuples by predicate.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
std::vector of tuples satisfying predicate.
Author
Leandro Rabindranath León

Definition at line 755 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by demo_practical(), demo_transformations(), TEST(), TEST(), and TEST().

◆ uni_zip_filteri()

template<typename Pred , typename... Containers>
auto Aleph::uni_zip_filteri ( Pred &&  pred,
const Containers &...  cs 
)

Filter with index (filteri in ML).

Parameters
predPredicate (size_t idx, tuple) -> bool.
csContainers to zip.
Returns
std::vector of tuples satisfying predicate.
Author
Leandro Rabindranath León

Definition at line 1072 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by TEST().

◆ uni_zip_find_first()

template<typename Pred , typename... Containers>
auto Aleph::uni_zip_find_first ( Pred &&  pred,
const Containers &...  cs 
)

Find first tuple satisfying predicate.

Parameters
predPredicate to test.
csContainers to zip.
Returns
std::optional containing tuple if found.
Author
Leandro Rabindranath León

Definition at line 781 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by TEST().

◆ uni_zip_find_mapi()

template<typename Op , typename... Containers>
auto Aleph::uni_zip_find_mapi ( Op &&  op,
const Containers &...  cs 
)

Find and map with index (find_mapi in ML).

Parameters
opCallable (size_t idx, tuple) -> std::optional<R>.
csContainers to zip.
Returns
First non-empty result from op, or std::nullopt.
Author
Leandro Rabindranath León

Definition at line 1126 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by TEST().

◆ uni_zip_first()

template<typename... Containers>
auto Aleph::uni_zip_first ( const Containers &...  cs)

Get first tuple.

Author
Leandro Rabindranath León

Definition at line 954 of file ah-zip-utils.H.

References uni_zip_nth().

Referenced by TEST(), and TEST().

◆ uni_zip_foldl()

template<typename T , typename Op , typename... Containers>
T Aleph::uni_zip_foldl ( T  init,
Op &&  op,
const Containers &...  cs 
)

Left fold over zipped tuples.

Parameters
initInitial value.
opBinary operation (acc, tuple) -> acc.
csContainers to zip.
Returns
Final accumulated value.
Author
Leandro Rabindranath León

Definition at line 705 of file ah-zip-utils.H.

References init, and uni_zip_it().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and uni_zip_reduce().

◆ uni_zip_for_each()

template<typename Op , typename... Containers>
void Aleph::uni_zip_for_each ( Op &&  op,
const Containers &...  cs 
)

Apply operation to each zipped tuple.

Parameters
opCallable (tuple) -> void.
csContainers to zip.
Author
Leandro Rabindranath León

Definition at line 668 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_practical(), demo_predicates(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ uni_zip_for_each_indexed()

template<typename Op , typename... Containers>
void Aleph::uni_zip_for_each_indexed ( Op &&  op,
const Containers &...  cs 
)

Apply operation to each tuple with index.

Parameters
opCallable (size_t idx, tuple) -> void.
csContainers to zip.
Author
Leandro Rabindranath León

Definition at line 685 of file ah-zip-utils.H.

References uni_zip_it().

◆ uni_zip_it()

◆ uni_zip_last()

template<typename... Containers>
auto Aleph::uni_zip_last ( const Containers &...  cs)

Get last tuple.

Author
Leandro Rabindranath León

Definition at line 966 of file ah-zip-utils.H.

References Aleph::UniZipIterator< Containers >::get_curr(), and uni_zip_it().

Referenced by TEST().

◆ uni_zip_length()

template<typename... Containers>
size_t Aleph::uni_zip_length ( const Containers &...  cs)

Get zip length (minimum of all container sizes).

Author
Leandro Rabindranath León

Definition at line 819 of file ah-zip-utils.H.

References count(), and uni_zip_it().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ uni_zip_map()

template<typename Op , typename... Containers>
auto Aleph::uni_zip_map ( Op &&  op,
const Containers &...  cs 
)

Map operation over zipped tuples.

Parameters
opTransformation (tuple) -> R.
csContainers to zip.
Returns
std::vector of transformed values.
Author
Leandro Rabindranath León

Definition at line 732 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_practical(), demo_transformations(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ uni_zip_mapi()

template<typename Op , typename... Containers>
auto Aleph::uni_zip_mapi ( Op &&  op,
const Containers &...  cs 
)

Map with index (mapi in ML).

Parameters
opCallable (size_t idx, tuple) -> R.
csContainers to zip (STL or Aleph).
Returns
std::vector of transformed values.
Author
Leandro Rabindranath León

Definition at line 1048 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_transformations(), and TEST().

◆ uni_zip_max()

template<typename... Containers>
auto Aleph::uni_zip_max ( const Containers &...  cs)

Get maximum tuple.

Parameters
csContainers to zip.
Returns
Optional containing the maximum tuple.
Author
Leandro Rabindranath León

Definition at line 1246 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_utilities(), and TEST().

◆ uni_zip_mem()

template<typename Tuple , typename... Containers>
bool Aleph::uni_zip_mem ( const Tuple &  target,
const Containers &...  cs 
)

Check if a tuple exists in the zipped sequence (mem in ML).

Parameters
targetThe tuple to search for.
csContainers to zip.
Returns
true if target is found.
Author
Leandro Rabindranath León

Definition at line 1174 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by TEST().

◆ uni_zip_min()

template<typename... Containers>
auto Aleph::uni_zip_min ( const Containers &...  cs)

Get minimum tuple.

Parameters
csContainers to zip.
Returns
Optional containing the minimum tuple.
Author
Leandro Rabindranath León

Definition at line 1216 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_utilities(), and TEST().

◆ uni_zip_min_max()

template<typename... Containers>
auto Aleph::uni_zip_min_max ( const Containers &...  cs)

Get both min and max in a single pass.

Parameters
csContainers to zip.
Returns
Optional pair of (min, max) tuples.
Author
Leandro Rabindranath León

Definition at line 1276 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by TEST().

◆ uni_zip_none()

template<typename Pred , typename... Containers>
bool Aleph::uni_zip_none ( Pred &&  pred,
const Containers &...  cs 
)

Check if no tuple satisfies the predicate.

Author
Leandro Rabindranath León

Definition at line 653 of file ah-zip-utils.H.

References pred, and uni_zip_exists().

Referenced by demo_predicates().

◆ uni_zip_nth()

template<typename... Containers>
auto Aleph::uni_zip_nth ( size_t  n,
const Containers &...  cs 
)

Get n-th tuple from zipped containers.

Author
Leandro Rabindranath León

Definition at line 849 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by TEST(), and uni_zip_first().

◆ uni_zip_partition()

template<typename Pred , typename... Containers>
auto Aleph::uni_zip_partition ( Pred &&  pred,
const Containers &...  cs 
)

Partition tuples by predicate.

Author
Leandro Rabindranath León

Definition at line 983 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by TEST(), and TEST().

◆ uni_zip_reduce()

template<typename T , typename Op , typename... Containers>
T Aleph::uni_zip_reduce ( T  init,
Op &&  op,
const Containers &...  cs 
)

Alias for uni_zip_foldl.

Definition at line 716 of file ah-zip-utils.H.

References init, and uni_zip_foldl().

◆ uni_zip_scan_left()

template<typename T , typename Op , typename... Containers>
auto Aleph::uni_zip_scan_left ( T  init,
Op &&  op,
const Containers &...  cs 
)

Scan left - fold with intermediate results.

Parameters
initInitial value.
opBinary operation (acc, tuple) -> acc.
csContainers to zip.
Returns
std::vector containing init and all intermediate results.
Author
Leandro Rabindranath León

Definition at line 1100 of file ah-zip-utils.H.

References init, and uni_zip_it().

Referenced by demo_advanced(), and TEST().

◆ uni_zip_take()

template<typename... Containers>
auto Aleph::uni_zip_take ( size_t  n,
const Containers &...  cs 
)

Take first n tuples.

Author
Leandro Rabindranath León

Definition at line 867 of file ah-zip-utils.H.

References count(), and uni_zip_it().

Referenced by demo_utilities(), TEST(), and TEST().

◆ uni_zip_take_while()

template<typename Pred , typename... Containers>
auto Aleph::uni_zip_take_while ( Pred &&  pred,
const Containers &...  cs 
)

Take tuples while predicate is true.

Author
Leandro Rabindranath León

Definition at line 908 of file ah-zip-utils.H.

References pred, and uni_zip_it().

Referenced by TEST(), and TEST().

◆ uni_zip_to_dynlist()

template<typename... Containers>
auto Aleph::uni_zip_to_dynlist ( const Containers &...  cs)

Materialize a zipped view into a DynList of tuples.

Converts a lazy zip view into a concrete DynList.

Parameters
csContainers to zip (STL or Aleph).
Returns
DynList of tuples.
Author
Leandro Rabindranath León

Definition at line 1432 of file ah-zip-utils.H.

References Aleph::DynList< T >::append(), and uni_zip_it().

Referenced by demo_conversion(), and TEST().

◆ uni_zip_to_vector()

template<typename... Containers>
auto Aleph::uni_zip_to_vector ( const Containers &...  cs)

Materialize zipped tuples into a vector.

Author
Leandro Rabindranath León

Definition at line 1007 of file ah-zip-utils.H.

References uni_zip_it().

Referenced by demo_conversion(), and TEST().

◆ uni_zip_traverse()

template<typename Pred , typename... Containers>
bool Aleph::uni_zip_traverse ( Pred &&  pred,
const Containers &...  cs 
)

Traverse while predicate returns true.

Author
Leandro Rabindranath León

Definition at line 1024 of file ah-zip-utils.H.

References pred, and uni_zip_it().

◆ unique() [1/2]

template<typename T , template< typename > class Container>
DynList< T > Aleph::unique ( const Container< T > &  c)
inline

Return elements that appear exactly once across the container.

Definition at line 1084 of file tpl_dynSetHash.H.

References GenericItems< Container, T >::keys().

◆ unique() [2/2]

template<class Itor , class BinaryPredicate = Aleph::equal_to<typename Itor::value_type>>
Itor Aleph::unique ( Itor  __first,
Itor  __last,
BinaryPredicate  __binary_pred = BinaryPredicate() 
)
inline

Remove consecutive duplicates in place.

Removes consecutive elements that compare equal according to the predicate by moving unique elements forward.

Template Parameters
ItorIterator type.
BinaryPredicateComparison predicate.
Parameters
__firstIterator to the first element.
__lastIterator past the last element.
__binary_predBinary predicate for comparison.
Returns
Iterator to the new logical end of the range.

Definition at line 1058 of file ahAlgo.H.

References adjacent_find().

Referenced by generate_random_data(), hull_signature(), Aleph::HalfPlaneIntersection::operator()(), run_performance_comparison(), Aleph::AndrewMonotonicChainConvexHull::sorted_unique_points(), Aleph::GrahamScanConvexHull::sorted_unique_points(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ unique_copy() [1/2]

template<class In_Itor , class Out_Itor >
Out_Itor Aleph::unique_copy ( In_Itor  __first,
In_Itor  __last,
Out_Itor  __result 
)
inline

Copy unique elements.

Copies elements from [first, last) to result, eliminating consecutive duplicates.

Template Parameters
In_ItorInput iterator type.
Out_ItorOutput iterator type.
Parameters
__firstIterator to the first source element.
__lastIterator past the last source element.
__resultIterator to the first destination position.
Returns
Iterator past the last copied element in destination.

Definition at line 1006 of file ahAlgo.H.

Referenced by TEST().

◆ unique_copy() [2/2]

template<class In_Itor , class Out_Itor , class BinaryPredicate >
Out_Itor Aleph::unique_copy ( In_Itor  __first,
In_Itor  __last,
Out_Itor  __result,
BinaryPredicate  __binary_pred 
)
inline

Copy unique elements with custom comparison.

Copies elements from [first, last) to result, eliminating consecutive elements that compare equal according to the predicate.

Template Parameters
In_ItorInput iterator type.
Out_ItorOutput iterator type.
BinaryPredicateComparison predicate.
Parameters
__firstIterator to the first source element.
__lastIterator past the last source element.
__resultIterator to the first destination position.
__binary_predBinary predicate for comparison.
Returns
Iterator past the last copied element in destination.

Definition at line 1032 of file ahAlgo.H.

◆ unique_sequential() [1/2]

template<typename T , template< typename > class Container, class Equal = std::equal_to<T>>
std::pair< DynList< T >, size_t > Aleph::unique_sequential ( const Container< T > &  c,
Equal &&  eq = Equal() 
)

Overload of unique_sequential.

Definition at line 1705 of file ahFunctional.H.

References eq(), and unique_sequential().

◆ unique_sequential() [2/2]

template<typename T , template< typename > class Container, class Equal >
std::pair< DynList< T >, size_t > Aleph::unique_sequential ( const Container< T > &  c,
Equal &  eq 
)

Extract unique consecutive items.

Removes consecutive duplicates from a container, keeping only the first element of each run of equal elements. Similar to Unix uniq command.

Template Parameters
TElement type.
ContainerContainer template type.
EqualEquality predicate type.
Parameters
cSource container.
eqEquality predicate for comparing elements.
Returns
Pair of (list of unique elements, count).
Example:
DynList<int> nums = {1, 1, 2, 2, 2, 3, 1, 1};
auto [unique, count] = unique_sequential(nums);
// unique = {1, 2, 3, 1}
// count = 4
std::pair< DynList< T >, size_t > unique_sequential(const Container< T > &c, Equal &eq)
Extract unique consecutive items.
Itor unique(Itor __first, Itor __last, BinaryPredicate __binary_pred=BinaryPredicate())
Remove consecutive duplicates in place.
Definition ahAlgo.H:1058
Note
Only removes consecutive duplicates. Non-consecutive duplicates are preserved. For global unique, sort first.
See also
sequential_groups() for getting groups of consecutive equals.

Definition at line 1675 of file ahFunctional.H.

References Aleph::DynList< T >::append(), count(), and eq().

Referenced by TEST(), and unique_sequential().

◆ unitarian_DynList()

template<typename T >
DynList< T > Aleph::unitarian_DynList ( const T &  item)
inline

Definition at line 2103 of file htlist.H.

◆ unzip()

template<class Container >
auto Aleph::unzip ( const Container &  l)
inline

Separate a list of pairs into two lists.

The inverse of zip(). Takes a container of pairs and produces two separate containers with the first and second elements respectively.

Template Parameters
ContainerContainer type holding pairs.
Parameters
lSource container of pairs.
Returns
std::pair of two DynLists (firsts, seconds).
Example:
{1, "one"}, {2, "two"}, {3, "three"}
};
auto [nums, names] = unzip(pairs);
// nums = {1, 2, 3}
// names = {"one", "two", "three"}
auto unzip(const Container &l)
Separate a list of pairs into two lists.
See also
zip() for the inverse operation.
tunzip() for tuple-based version.

Definition at line 1394 of file ahFunctional.H.

References Aleph::DynList< T >::append(), Aleph::DynList< T >::get_first(), LocateFunctions< Container, Type >::get_it(), l, l1, and l2.

Referenced by demo_zipping(), and TEST_F().

◆ update_flow()

template<class Rnet >
void Aleph::update_flow ( const Rnet &  rnet)
inline

Propagate residual arc flows back to their original arcs.

Definition at line 2223 of file tpl_net.H.

Referenced by TEST(), and TYPED_TEST().

◆ upper_bound() [1/2]

template<class Itor , class T >
Itor Aleph::upper_bound ( Itor  beg,
Itor  end,
const T &  value 
)
inline

Find upper bound in a sorted range.

Returns an iterator to the first element greater than value in the sorted range [beg, end).

Template Parameters
ItorForward iterator type.
TValue type.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to compare against.
Returns
Iterator to the upper bound.

Definition at line 1239 of file ahAlgo.H.

References and, and value.

Referenced by equal_range(), equal_range(), TEST(), and Aleph::Reservoir_Sampler< T >::update().

◆ upper_bound() [2/2]

template<class Itor , class T , class BinaryPredicate >
Itor Aleph::upper_bound ( Itor  beg,
Itor  end,
const T &  value,
BinaryPredicate  op 
)
inline

Find upper bound with custom comparison.

Template Parameters
ItorForward iterator type.
TValue type.
BinaryPredicateComparison predicate.
Parameters
begIterator to the first element.
endIterator past the last element.
valueValue to compare against.
opBinary comparison predicate.
Returns
Iterator to the upper bound.

Definition at line 1261 of file ahAlgo.H.

References and, and value.

◆ valid_day()

bool Aleph::valid_day ( const size_t  yy,
const size_t  mm,
const size_t  dd 
)
inlinenoexcept

Check whether a given day exists for the supplied month/year.

Definition at line 77 of file ah-date.H.

References and, is_leap_year(), and valid_month().

Referenced by TEST(), and to_time_t().

◆ valid_heap()

template<typename T , class Compare = Aleph::less<T>>
requires StrictWeakOrder<Compare, T>
bool Aleph::valid_heap ( T *  array,
const size_t  l,
const size_t  r,
const Compare &  cmp = Compare() 
)

Check whether a range satisfies the heap property.

Template Parameters
Telement type
Comparecomparator defining the heap order
Parameters
[in]array1-based array backing the heap
[in]lleft boundary (inclusive)
[in]rright boundary (inclusive)
[in]cmpcomparison criteria
Returns
true if [l, r] satisfies the heap property under cmp

Definition at line 402 of file tpl_arrayHeap.H.

References cmp(), l, l_index(), r, and u_index().

Referenced by is_min_heap(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ valid_month()

bool Aleph::valid_month ( const size_t  mm)
inlinenoexcept

Check whether the month number is within the [1, 12] range.

Definition at line 71 of file ah-date.H.

References and.

Referenced by valid_day().

◆ validate_bytecode_function()

◆ validate_bytecode_module()

◆ validate_cfg_function()

◆ validate_cfg_module()

Compiler_CFG_Validation_Report Aleph::validate_cfg_module ( const Compiler_CFG_Module &  module)
inline

Validates all CFGs in a lowered module.

Parameters
moduleCFG module to validate.
Returns
Aggregated validation report.

Definition at line 846 of file Compiler_CFG.H.

References Aleph::DynArray< T >::append(), Aleph::Compiler_CFG_Validation_Report::errors, Aleph::Compiler_CFG_Module::functions, merge(), Aleph::Compiler_CFG_Module::top_level, Aleph::Compiler_CFG_Validation_Report::valid, validate_cfg_function(), and Aleph::Compiler_CFG_Validation_Report::warnings.

Referenced by main(), TEST(), and TEST().

◆ validate_dataflow_analysis()

Compiler_Dataflow_Validation_Report Aleph::validate_dataflow_analysis ( const Compiler_IR_Function &  function,
const Compiler_Dataflow_Function_Analysis &  analysis 
)
inline

◆ validate_dead_code_elimination()

Compiler_Dataflow_Validation_Report Aleph::validate_dead_code_elimination ( const Compiler_Dead_Code_Elimination_Result &  result,
const Compiler_IR_Module *  module = nullptr 
)
inline

Validates the result of dead-code elimination.

Checks that the optimised function has valid IR, that no foldable branches remain, and (when a module is provided) that global slot counts are consistent.

Parameters
resultDCE result produced by eliminate_dead_code().
moduleOptional IR module used to validate global-slot consistency; pass nullptr to skip module-level checks.
Returns
Compiler_Dataflow_Validation_Report with valid==true if all post-elimination invariants hold.
Note
Complexity: O(B·S). Not thread-safe.

Definition at line 1601 of file Compiler_Dataflow.H.

References Aleph::DynArray< T >::access(), analyze_dataflow_function(), and, Aleph::DynArray< T >::append(), Aleph::Compiler_IR_Detail::block_name(), Aleph::Compiler_IR_Function::blocks, Branch, compiler_ir_invalid_id(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_SSA_Terminator::condition_value, Aleph::Compiler_Dataflow_Validation_Report::errors, Aleph::Compiler_IR_Function::exit_block, Aleph::Compiler_Dead_Code_Elimination_Result::function, Aleph::Compiler_Dataflow_Detail::instruction_is_trivially_dead(), Aleph::Compiler_SSA_Block::instructions, Aleph::Compiler_SSA_Terminator::kind, Load, Aleph::Compiler_IR_Function::local_slots, Aleph::Compiler_Dataflow_Detail::mark_value_used(), message(), Aleph::Compiler_IR_Function::name, Aleph::Compiler_IR_Function::next_value_id, Return, Aleph::Compiler_SSA_Terminator::return_value, Store, Aleph::Compiler_SSA_Block::terminator, Aleph::Compiler_Dataflow_Validation_Report::valid, validate_ir_function(), and Aleph::Compiler_Dataflow_Validation_Report::warnings.

Referenced by main(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ validate_ir_function()

◆ validate_ir_module()

◆ validate_ssa_function()

Compiler_SSA_Validation_Report Aleph::validate_ssa_function ( const Compiler_SSA_Function &  function,
const Compiler_SSA_Module *  module = nullptr 
)
inline

◆ validate_ssa_module()

◆ variadic_to_DynList()

template<typename T , typename... Args>
DynList< T > Aleph::variadic_to_DynList ( Args &&...  args)
inline

Convert a variadic parameter pack to a DynList.

Template Parameters
TTarget element type.
ArgsArgument types (must be convertible to T).
Parameters
argsArguments to pack into a DynList.
Returns
DynList containing all arguments.

Definition at line 210 of file ah-stl-utils.H.

◆ variadic_to_vector()

template<typename T , typename... Args>
std::vector< T > Aleph::variadic_to_vector ( Args &&...  args)
inline

Convert a variadic parameter pack to a std::vector.

Template Parameters
TTarget element type.
ArgsArgument types (must be convertible to T).
Parameters
argsArguments to pack into a vector.
Returns
std::vector containing all arguments.

Definition at line 195 of file ah-stl-utils.H.

◆ variance()

template<typename Container >
auto Aleph::variance ( const Container &  data,
bool  population = false 
) -> std::decay_t<decltype(*std::begin(data))>

Compute variance using Welford's numerically stable algorithm.

This algorithm avoids numerical instability that can occur with the traditional formula when dealing with large values or values close to each other.

Template Parameters
ContainerContainer type with begin()/end()
Parameters
dataInput container
populationIf true, compute population variance (divide by n); if false (default), compute sample variance (divide by n-1)
Returns
Variance
Exceptions
std::invalid_argumentif container has fewer than 2 elements (sample) or is empty (population)

Definition at line 220 of file stat_utils.H.

References ah_invalid_argument_if, m, and variance().

Referenced by compute_all_stats(), demo_practical(), monte_carlo_simulation(), stddev(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and variance().

◆ vector_to_Array() [1/2]

template<class T >
Array< T > Aleph::vector_to_Array ( const std::vector< T > &  v)

Convert a std::vector to an Array.

Creates a new Array containing copies of all elements from the given std::vector.

Template Parameters
TThe element type.
Parameters
vThe source std::vector.
Returns
An Array containing copies of all elements from v.

Definition at line 240 of file ah-convert.H.

References Aleph::Array< T >::append(), and Aleph::Array< T >::reserve().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ vector_to_Array() [2/2]

template<class T >
Array< T > Aleph::vector_to_Array ( std::vector< T > &&  v)

Convert a std::vector to an Array using move semantics.

Creates a new Array by moving all elements from the given std::vector. After conversion, the source vector's elements are in a valid but unspecified state.

Template Parameters
TThe element type.
Parameters
vThe source std::vector (rvalue reference).
Returns
An Array containing moved elements from v.

Definition at line 530 of file ah-convert.H.

References Aleph::Array< T >::append().

◆ vector_to_DynArray() [1/2]

template<class T >
DynArray< T > Aleph::vector_to_DynArray ( const std::vector< T > &  v)

Convert a std::vector to a DynArray.

Creates a new DynArray containing copies of all elements from the given std::vector.

Template Parameters
TThe element type.
Parameters
vThe source std::vector.
Returns
A DynArray containing copies of all elements from v.

Definition at line 122 of file ah-convert-common.H.

References Aleph::DynArray< T >::append().

Referenced by demo_vector_dynarray(), other_unit_vector_to_DynArray(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ vector_to_DynArray() [2/2]

template<class T >
DynArray< T > Aleph::vector_to_DynArray ( std::vector< T > &&  v)

Convert a std::vector to a DynArray using move semantics.

Creates a new DynArray by moving all elements from the given std::vector. After conversion, the source vector's elements are in a valid but unspecified state.

Template Parameters
TThe element type.
Parameters
vThe source std::vector (rvalue reference).
Returns
A DynArray containing moved elements from v.

Definition at line 551 of file ah-convert.H.

References Aleph::DynArray< T >::append().

◆ vector_to_DynDlist() [1/2]

template<class T >
DynDlist< T > Aleph::vector_to_DynDlist ( const std::vector< T > &  v)

Convert a std::vector to a DynDlist.

Creates a new DynDlist containing copies of all elements from the given std::vector.

Template Parameters
TThe element type.
Parameters
vThe source std::vector.
Returns
A DynDlist containing copies of all elements from v.

Definition at line 486 of file ah-convert.H.

References Aleph::DynDlist< T >::append().

Referenced by TEST(), TEST(), and TEST().

◆ vector_to_DynDlist() [2/2]

template<class T >
DynDlist< T > Aleph::vector_to_DynDlist ( std::vector< T > &&  v)

Convert a std::vector to a DynDlist using move semantics.

Creates a new DynDlist by moving all elements from the given std::vector. After conversion, the source vector's elements are in a valid but unspecified state.

Template Parameters
TThe element type.
Parameters
vThe source std::vector (rvalue reference).
Returns
A DynDlist containing moved elements from v.

Definition at line 572 of file ah-convert.H.

References Aleph::DynDlist< T >::append().

◆ vector_to_DynList() [1/2]

template<class T >
DynList< T > Aleph::vector_to_DynList ( const std::vector< T > &  v)

Convert a std::vector to a DynList.

Creates a new DynList containing copies of all elements from the given std::vector.

Template Parameters
TThe element type.
Parameters
vThe source std::vector.
Returns
A DynList containing copies of all elements from v.

Definition at line 102 of file ah-convert-common.H.

References Aleph::DynList< T >::append().

Referenced by demo_vector_dynlist(), other_unit_vector_to_DynList(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and to_DynList().

◆ vector_to_DynList() [2/2]

template<class T >
DynList< T > Aleph::vector_to_DynList ( std::vector< T > &&  v)

Convert a std::vector to a DynList using move semantics.

Creates a new DynList by moving all elements from the given std::vector. After conversion, the source vector's elements are in a valid but unspecified state.

Template Parameters
TThe element type.
Parameters
vThe source std::vector (rvalue reference).
Returns
A DynList containing moved elements from v.

Definition at line 509 of file ah-convert.H.

References Aleph::DynList< T >::append().

◆ vector_to_DynSetTree()

template<class T >
DynSetTree< T > Aleph::vector_to_DynSetTree ( const std::vector< T > &  v)

Convert a std::vector to a DynSetTree.

Template Parameters
TThe element type.
Parameters
vThe source std::vector.
Returns
A DynSetTree containing unique elements from v.

Definition at line 1000 of file ah-convert.H.

References Aleph::DynSetTree< Key, Tree, Compare >::insert().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ verify_container_and_iterator()

template<typename Container , typename Iterator >
void Aleph::verify_container_and_iterator ( const Container &  container,
const Iterator &  itor 
)
inline

Verifies that an iterator belongs to a specific container.

Checks that the iterator is associated with the given container. Throws std::domain_error if the verification fails.

Template Parameters
ContainerThe container type.
IteratorThe iterator type (must have verify(Container&) method).
Parameters
containerThe container to check against.
itorThe iterator to verify.
Exceptions
std::domain_errorif the iterator does not belong to the container.

Example

DynList<int> list = {1, 2, 3};
auto it = list.begin();
DynList<int> other_list;
// verify_container_and_iterator(other_list, it); // throws!
iterator begin() noexcept
Return an STL-compatible iterator to the first element.
void verify_container_and_iterator(const Container &container, const Iterator &itor)
Verifies that an iterator belongs to a specific container.

Definition at line 105 of file ah_stdc++_utils.H.

References ah_domain_error_if.

Referenced by TEST(), TEST(), TEST(), TEST(), verify_container_and_iterators(), and verify_container_and_iterators().

◆ verify_container_and_iterators() [1/2]

template<typename Container , typename Iterator >
void Aleph::verify_container_and_iterators ( const Container &  container,
const Iterator &  itor1,
const Iterator &  itor2 
)
inline

Verifies that two iterators both belong to a specific container.

A simpler overload that just checks both iterators belong to the given container.

Template Parameters
ContainerThe container type.
IteratorThe iterator type.
Parameters
containerThe container to check against.
itor1First iterator.
itor2Second iterator.
Exceptions
std::domain_errorif either iterator doesn't belong to the container.

Example

DynList<int> list = {1, 2, 3, 4, 5};
auto first = list.begin();
auto last = list.end();
verify_container_and_iterators(list, first, last); // OK
iterator end() noexcept
Return an STL-compatible end iterator.
void verify_container_and_iterators(const Container &container, const Iterator &itor_container, const Iterator &itor1, const Iterator &itor2)
Verifies container-iterator relationships with distinctness check.

Definition at line 198 of file ah_stdc++_utils.H.

References verify_container_and_iterator().

◆ verify_container_and_iterators() [2/2]

template<typename Container , typename Iterator >
void Aleph::verify_container_and_iterators ( const Container &  container,
const Iterator &  itor_container,
const Iterator &  itor1,
const Iterator &  itor2 
)
inline

Verifies container-iterator relationships with distinctness check.

This overload performs three verifications:

  1. itor_container belongs to container
  2. itor1 and itor2 belong to the same container (as each other)
  3. itor_container is distinct from itor1 (they reference different containers)

This is useful when you have a "destination" iterator (itor_container) and a "source" range (itor1, itor2), and you need to ensure they don't overlap.

Template Parameters
ContainerThe container type.
IteratorThe iterator type.
Parameters
containerThe destination container.
itor_containerIterator into the destination container.
itor1Start of source range.
itor2End of source range.
Exceptions
std::domain_errorif any verification fails.

Definition at line 163 of file ah_stdc++_utils.H.

References ah_domain_error_if, verify_container_and_iterator(), and verify_iterators().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ verify_iterators()

template<typename Iterator >
void Aleph::verify_iterators ( const Iterator &  itor1,
const Iterator &  itor2 
)
inline

Verifies that two iterators belong to the same container.

Checks that both iterators are associated with the same underlying container. Throws std::domain_error if they belong to different containers.

Template Parameters
IteratorThe iterator type (must have verify(Iterator&) method).
Parameters
itor1First iterator.
itor2Second iterator.
Exceptions
std::domain_errorif iterators belong to different containers.

Example

DynList<int> list = {1, 2, 3, 4, 5};
auto first = list.begin();
auto last = list.end();
verify_iterators(first, last); // OK - same container
DynList<int> other;
auto other_it = other.begin();
// verify_iterators(first, other_it); // throws!
void verify_iterators(const Iterator &itor1, const Iterator &itor2)
Verifies that two iterators belong to the same container.

Definition at line 137 of file ah_stdc++_utils.H.

References ah_domain_error_if.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and verify_container_and_iterators().

◆ visualize_aabb_tree()

AABBTree::DebugSnapshot Aleph::visualize_aabb_tree ( Tikz_Plane &  plane,
const AABBTree &  tree,
const Tikz_Style &  node_bbox_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  leaf_bbox_style = tikz_wire_style("blue!70") 
)
inline

Visualize AABB tree hierarchy.

Definition at line 1068 of file tikzgeom_algorithms.H.

References Aleph::AABBTree::debug_snapshot(), and put_aabb_tree_result().

Referenced by Aleph::Tikz_Scene::visualize_aabb_tree().

◆ visualize_aabb_tree_query()

AABBTreeQueryVizResult Aleph::visualize_aabb_tree_query ( Tikz_Plane &  plane,
const AABBTree &  tree,
const Rectangle &  query_rect,
const Tikz_Style &  node_bbox_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  leaf_bbox_style = tikz_wire_style("blue!70"),
const Tikz_Style &  query_rect_style = tikz_wire_style("red", true),
const Tikz_Style &  query_hit_style = tikz_wire_style("red") 
)
inline

◆ visualize_alpha_shape()

AlphaShape::Result Aleph::visualize_alpha_shape ( Tikz_Plane &  plane,
const DynList< Point > &  points,
const Geom_Number &  alpha_squared,
const AlphaShape &  algorithm = {},
const bool  draw_kept_triangles = false,
const Tikz_Style &  triangle_style = tikz_wire_style("gray!55"),
const Tikz_Style &  boundary_style = tikz_path_style("orange!90!black"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black") 
)
inline

Compute and insert alpha-shape for input points.

Definition at line 1569 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_alpha_shape().

◆ visualize_boolean_operation()

Array< Polygon > Aleph::visualize_boolean_operation ( Tikz_Plane &  plane,
const Polygon &  a,
const Polygon &  b,
const BooleanPolygonOperations::Op  op,
const BooleanPolygonOperations &  bop = {},
const Tikz_Style &  a_style = tikz_area_style("blue", "blue!15", 0.35),
const Tikz_Style &  b_style = tikz_area_style("green!60!black", "green!20", 0.35),
const Tikz_Style &  result_style = tikz_area_style("red", "red!35", 0.65),
const int  input_layer = Tikz_Plane::Layer_Default,
const int  result_layer = Tikz_Plane::Layer_Foreground 
)
inline

Visualizes a boolean operation (union, intersection, difference) on two polygons.

Draws the two input polygons (a and b) with semi-transparent fills and overlays the result of the boolean operation with a distinct style. This function can handle non-convex polygons.

Parameters
planeThe target TikZ plane.
aThe subject polygon.
bThe clip polygon.
opThe boolean operation to perform (e.g., Op::Union).
bopThe boolean operations algorithm object.
a_styleThe style for polygon a.
b_styleThe style for polygon b.
result_styleThe style for the resulting polygon(s).
input_layerThe base layer for the input polygons.
result_layerThe layer for the resulting polygon(s).
Returns
An Array<Polygon> containing the result of the operation. The result can be multiple disjoint polygons.

Definition at line 659 of file tikzgeom_algorithms.H.

Referenced by main(), and Aleph::Tikz_Scene::visualize_boolean_operation().

◆ visualize_cdt()

ConstrainedDelaunayTriangulation::Result Aleph::visualize_cdt ( Tikz_Plane &  plane,
const DynList< Point > &  points,
const DynList< Segment > &  constraints,
const ConstrainedDelaunayTriangulation &  algorithm = {},
const Tikz_Style &  triangle_style = tikz_wire_style("blue!60"),
const Tikz_Style &  constraint_style = tikz_path_style("red"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black") 
)
inline

Compute and insert constrained Delaunay triangulation.

Definition at line 1850 of file tikzgeom_algorithms.H.

Referenced by main().

◆ visualize_chaikin_smoothing()

Polygon Aleph::visualize_chaikin_smoothing ( Tikz_Plane &  plane,
const Polygon &  poly,
const size_t  iterations,
const Geom_Number &  ratio = Geom_Number(1, 4),
const Tikz_Style &  original_style = tikz_wire_style("gray!50"),
const Tikz_Style &  smoothed_style = tikz_bold_wire_style("violet!80"),
const bool  draw_vertices = true,
const Tikz_Style &  vertex_style = tikz_points_style("red") 
)
inline

Smooth a polygon with Chaikin subdivision and draw the result.

Returns
The smoothed polygon.

Definition at line 2044 of file tikzgeom_algorithms.H.

References put_smoothing_result(), and Aleph::ChaikinSmoothing::smooth_polygon().

Referenced by main().

◆ visualize_closest_pair()

ClosestPairDivideAndConquer::Result Aleph::visualize_closest_pair ( Tikz_Plane &  plane,
const DynList< Point > &  points,
const ClosestPairDivideAndConquer &  algorithm = {},
const Tikz_Style &  points_style = tikz_points_style("black"),
const Tikz_Style &  pair_style = tikz_path_style("red"),
const Tikz_Style &  pair_points_style = tikz_points_style("red") 
)
inline

Compute and draw the closest pair from an input point set.

Definition at line 1631 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_closest_pair().

◆ visualize_convex_decomposition()

Array< Polygon > Aleph::visualize_convex_decomposition ( Tikz_Plane &  plane,
const Polygon &  polygon,
const ConvexPolygonDecomposition &  algorithm = {},
const bool  draw_input_polygon = true,
const Tikz_Style &  input_style = tikz_wire_style("black", true),
const bool  color_parts_by_index = true,
const Tikz_Style &  part_style = tikz_area_style("blue!60!black", "blue!15", 0.40),
const int  input_layer = Tikz_Plane::Layer_Default,
const int  part_layer = Tikz_Plane::Layer_Foreground 
)
inline

Compute and insert convex decomposition for a polygon.

Definition at line 1521 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_convex_decomposition().

◆ visualize_convex_hull()

template<typename HullAlgorithm >
Polygon Aleph::visualize_convex_hull ( Tikz_Plane &  plane,
const DynList< Point > &  points,
const HullAlgorithm &  hull_algorithm,
const Tikz_Style &  point_style = tikz_points_style("black", 0.6),
const Tikz_Style &  hull_style = tikz_wire_style("red"),
const Tikz_Style &  hull_vertex_style = tikz_points_style("red"),
const int  point_layer = Tikz_Plane::Layer_Default,
const int  hull_layer = Tikz_Plane::Layer_Foreground,
const bool  draw_hull_vertices = true 
)

Runs a convex hull algorithm and visualizes the result.

This helper function takes a list of points, computes their convex hull using the provided algorithm object, and inserts both the original points and the resulting hull polygon into the Tikz_Plane.

Template Parameters
HullAlgorithmThe type of the convex hull algorithm object. It must be a callable that takes a DynList<Point> and returns a Polygon.
Parameters
planeThe target TikZ plane.
pointsThe input point cloud.
hull_algorithmAn instance of the hull algorithm to use.
point_styleThe style for the input points.
hull_styleThe style for the convex hull polygon's outline.
hull_vertex_styleThe style for the vertices of the hull.
point_layerThe layer for the input points.
hull_layerThe layer for the hull polygon and its vertices.
draw_hull_verticesIf true, the vertices of the hull are drawn.
Returns
The computed convex hull Polygon.

Definition at line 584 of file tikzgeom_algorithms.H.

References and, put_in_plane(), put_points(), put_polygon_vertices(), and Aleph::Polygon::size().

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_convex_hull().

◆ visualize_convex_intersection()

Polygon Aleph::visualize_convex_intersection ( Tikz_Plane &  plane,
const Polygon &  subject,
const Polygon &  clip,
const ConvexPolygonIntersectionBasic &  intersection_algorithm = {},
const Tikz_Style &  subject_style = tikz_area_style("blue", "blue!15", 0.45),
const Tikz_Style &  clip_style = tikz_area_style("orange", "orange!20", 0.45),
const Tikz_Style &  result_style = tikz_area_style("red", "red!30", 0.60),
const int  input_layer = Tikz_Plane::Layer_Default,
const int  result_layer = Tikz_Plane::Layer_Foreground 
)
inline

Visualizes the intersection of two convex polygons.

Draws the subject and clip polygons with semi-transparent fills and overlays their intersection with a distinct, solid fill.

Parameters
planeThe target TikZ plane.
subjectThe subject polygon.
clipThe clipping polygon.
intersection_algorithmThe algorithm to use for intersection.
subject_styleThe style for the subject polygon.
clip_styleThe style for the clip polygon.
result_styleThe style for the resulting intersection polygon.
input_layerThe base layer for the input polygons.
result_layerThe layer for the intersection polygon.
Returns
The Polygon representing the intersection.

Definition at line 621 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_convex_intersection().

◆ visualize_delaunay()

DelaunayTriangulationBowyerWatson::Result Aleph::visualize_delaunay ( Tikz_Plane &  plane,
const DynList< Point > &  points,
const DelaunayTriangulationBowyerWatson &  algorithm = {},
const Tikz_Style &  triangle_style = tikz_wire_style("blue"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black") 
)
inline

Compute and insert Delaunay triangulation as triangle outlines.

Definition at line 700 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_delaunay().

◆ visualize_douglas_peucker()

Polygon Aleph::visualize_douglas_peucker ( Tikz_Plane &  plane,
const Polygon &  poly,
const Geom_Number &  epsilon,
const DouglasPeuckerSimplification &  algorithm = {},
const Tikz_Style &  original_style = tikz_wire_style("gray!50"),
const Tikz_Style &  simplified_style = tikz_bold_wire_style("blue!80"),
const bool  draw_vertices = true,
const Tikz_Style &  vertex_style = tikz_points_style("red") 
)
inline

Simplify a polygon with Douglas-Peucker and draw the result.

Returns
The simplified polygon.

Definition at line 1932 of file tikzgeom_algorithms.H.

Referenced by main().

◆ visualize_half_plane_intersection()

Polygon Aleph::visualize_half_plane_intersection ( Tikz_Plane &  plane,
const Array< HalfPlaneIntersection::HalfPlane > &  halfplanes,
const HalfPlaneIntersection &  algorithm = {},
const Tikz_Style &  boundary_style = tikz_wire_style("gray!60", true, true),
const Tikz_Style &  result_style = tikz_area_style("red", "red!25", 0.50) 
)
inline

Compute and draw bounded half-plane intersection.

Definition at line 1699 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_half_plane_intersection().

◆ visualize_kdtree_partitions()

KDTreePointSearch::DebugSnapshot Aleph::visualize_kdtree_partitions ( Tikz_Plane &  plane,
const KDTreePointSearch &  kd_tree,
const bool  draw_partition_boxes = false,
const bool  draw_points = true,
const Tikz_Style &  partition_style = tikz_wire_style("gray!55", true),
const Tikz_Style &  split_style = tikz_wire_style("blue!70"),
const Tikz_Style &  point_style = tikz_points_style("red") 
)
inline

Visualize KD-tree recursive space partitions.

Definition at line 938 of file tikzgeom_algorithms.H.

References Aleph::KDTreePointSearch::debug_snapshot(), and put_kdtree_partitions_result().

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_kdtree_partitions().

◆ visualize_line_sweep()

Array< SweepLineSegmentIntersection::Intersection > Aleph::visualize_line_sweep ( Tikz_Plane &  plane,
const Array< Segment > &  segments,
const SweepLineSegmentIntersection &  algorithm = {},
const Tikz_Style &  segment_style = tikz_wire_style("blue!60"),
const Tikz_Style &  intersection_style = tikz_points_style("red") 
)
inline

Compute and draw Bentley-Ottmann line-sweep intersections.

Definition at line 1806 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_line_sweep().

◆ visualize_mec()

MinimumEnclosingCircle::Circle Aleph::visualize_mec ( Tikz_Plane &  plane,
const DynList< Point > &  points,
const MinimumEnclosingCircle &  algorithm = {},
const Tikz_Style &  circle_style = tikz_wire_style("blue!70"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black") 
)
inline

Compute minimum enclosing circle and insert into plane.

Returns
The computed circle.

Definition at line 1890 of file tikzgeom_algorithms.H.

Referenced by main().

◆ visualize_minkowski_sum()

Polygon Aleph::visualize_minkowski_sum ( Tikz_Plane &  plane,
const Polygon &  first,
const Polygon &  second,
const MinkowskiSumConvex &  algorithm = {},
const Tikz_Style &  first_style = tikz_area_style("blue", "blue!14", 0.30),
const Tikz_Style &  second_style = tikz_area_style("green!60!black", "green!16", 0.30),
const Tikz_Style &  result_style = tikz_area_style("red", "red!26", 0.60) 
)
inline

Compute and draw Minkowski sum of two convex polygons.

Definition at line 1726 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_minkowski_sum().

◆ visualize_monotone_triangulation()

DynList< Triangle > Aleph::visualize_monotone_triangulation ( Tikz_Plane &  plane,
const Polygon &  polygon,
const MonotonePolygonTriangulation &  algorithm = {},
const Tikz_Style &  polygon_style = tikz_wire_style("black"),
const Tikz_Style &  triangle_style = tikz_wire_style("blue!65") 
)
inline

Compute and draw triangulation via monotone partition pipeline.

Definition at line 1752 of file tikzgeom_algorithms.H.

Referenced by TEST(), and Aleph::Tikz_Scene::visualize_monotone_triangulation().

◆ visualize_polygon_offset()

PolygonOffset::Result Aleph::visualize_polygon_offset ( Tikz_Plane &  plane,
const Polygon &  poly,
const Geom_Number &  distance,
const PolygonOffset &  algorithm = {},
PolygonOffset::JoinType  join = PolygonOffset::JoinType::Miter,
const Geom_Number &  miter_limit = Geom_Number(2),
const Tikz_Style &  original_style = tikz_wire_style("gray!50"),
const Tikz_Style &  offset_style = tikz_bold_wire_style("blue!80"),
const bool  draw_vertices = true,
const Tikz_Style &  vertex_style = tikz_points_style("red") 
)
inline

Offset a polygon and draw the result.

Returns
The offset result.

Definition at line 1999 of file tikzgeom_algorithms.H.

Referenced by main().

◆ visualize_power_diagram()

PowerDiagram::Result Aleph::visualize_power_diagram ( Tikz_Plane &  plane,
const Array< PowerDiagram::WeightedSite > &  sites,
const PowerDiagram &  algorithm = {},
const bool  draw_cells = true,
const Tikz_Style &  cell_style = tikz_area_style("violet", "violet!18", 0.35),
const Tikz_Style &  edge_style = tikz_wire_style("violet"),
const Tikz_Style &  site_style = tikz_points_style("purple") 
)
inline

Compute and insert Power diagram for weighted sites.

Definition at line 817 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_power_diagram().

◆ visualize_range_tree()

RangeTree2D::DebugSnapshot Aleph::visualize_range_tree ( Tikz_Plane &  plane,
const RangeTree2D &  tree,
const bool  draw_points = true,
const Tikz_Style &  split_style = tikz_wire_style("purple"),
const Tikz_Style &  point_style = tikz_points_style("black") 
)
inline

Visualize range-tree structure without a query overlay.

Definition at line 998 of file tikzgeom_algorithms.H.

References Aleph::RangeTree2D::debug_snapshot(), and put_range_tree_result().

Referenced by Aleph::Tikz_Scene::visualize_range_tree().

◆ visualize_range_tree_query()

RangeTreeQueryVizResult Aleph::visualize_range_tree_query ( Tikz_Plane &  plane,
const RangeTree2D &  tree,
const Rectangle &  query_rect,
const bool  draw_points = true,
const Tikz_Style &  split_style = tikz_wire_style("purple"),
const Tikz_Style &  point_style = tikz_points_style("black"),
const Tikz_Style &  query_rect_style = tikz_wire_style("red", true),
const Tikz_Style &  query_hit_style = tikz_points_style("red") 
)
inline

◆ visualize_regular_triangulation()

RegularTriangulationBowyerWatson::Result Aleph::visualize_regular_triangulation ( Tikz_Plane &  plane,
const Array< RegularTriangulationBowyerWatson::WeightedSite > &  weighted_sites,
const RegularTriangulationBowyerWatson &  algorithm = {},
const Tikz_Style &  triangle_style = tikz_wire_style("blue!60"),
const bool  draw_sites = true,
const Tikz_Style &  site_style = tikz_points_style("black") 
)
inline

Compute and insert regular (weighted Delaunay) triangulation.

Definition at line 1604 of file tikzgeom_algorithms.H.

Referenced by TEST(), and Aleph::Tikz_Scene::visualize_regular_triangulation().

◆ visualize_rotating_calipers()

RotatingCalipersResult Aleph::visualize_rotating_calipers ( Tikz_Plane &  plane,
const Polygon &  polygon,
const Tikz_Style &  polygon_style = tikz_wire_style("gray!55"),
const Tikz_Style &  diameter_style = tikz_path_style("red"),
const Tikz_Style &  width_style = tikz_path_style("blue"),
const Tikz_Style &  witness_style = tikz_points_style("orange!90!black") 
)
inline

◆ visualize_rtree()

template<typename Payload , size_t MaxEntries, size_t MinEntries, RTreeVariant Variant>
RTree< Payload, MaxEntries, MinEntries, Variant >::DebugSnapshot Aleph::visualize_rtree ( Tikz_Plane &  plane,
const RTree< Payload, MaxEntries, MinEntries, Variant > &  tree,
const Tikz_Style &  node_bbox_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  leaf_bbox_style = tikz_wire_style("blue!70"),
const Tikz_Style &  entry_bbox_style = tikz_wire_style("gray!55") 
)
inline

Visualize an R-tree/R*-tree hierarchy (node MBRs by depth, plus leaf entry boxes).

Definition at line 1149 of file tikzgeom_algorithms.H.

References Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::debug_snapshot(), and put_rtree_result().

Referenced by TEST().

◆ visualize_rtree_query()

template<typename Payload , size_t MaxEntries, size_t MinEntries, RTreeVariant Variant>
RTreeQueryVizResult< Payload, MaxEntries, MinEntries, Variant > Aleph::visualize_rtree_query ( Tikz_Plane &  plane,
const RTree< Payload, MaxEntries, MinEntries, Variant > &  tree,
const Rectangle &  query_rect,
const Tikz_Style &  node_bbox_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  leaf_bbox_style = tikz_wire_style("blue!70"),
const Tikz_Style &  entry_bbox_style = tikz_wire_style("gray!55"),
const Tikz_Style &  query_rect_style = tikz_wire_style("red", true),
const Tikz_Style &  query_hit_style = tikz_wire_style("red") 
)
inline

◆ visualize_segment_arrangement()

SegmentArrangement::Result Aleph::visualize_segment_arrangement ( Tikz_Plane &  plane,
const Array< Segment > &  segments,
const SegmentArrangement &  algorithm = {},
const bool  draw_faces = true,
const bool  draw_vertices = true,
const bool  draw_unbounded_face = false,
const Tikz_Style &  face_style = tikz_area_style("teal!60!black", "teal!12", 0.30),
const Tikz_Style &  edge_style = tikz_wire_style("teal!70!black"),
const Tikz_Style &  vertex_style = tikz_points_style("teal!70!black"),
const bool  color_faces_by_index = false 
)
inline

Compute and insert arrangement for input segments.

Definition at line 883 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), TEST(), and Aleph::Tikz_Scene::visualize_segment_arrangement().

◆ visualize_shortest_path_in_polygon()

DynList< Point > Aleph::visualize_shortest_path_in_polygon ( Tikz_Plane &  plane,
const Polygon &  polygon,
const Point &  source,
const Point &  target,
const ShortestPathInPolygon &  algorithm = {},
const Tikz_Style &  polygon_style = tikz_area_style("black", "gray!15", 0.25),
const Tikz_Style &  source_style = tikz_points_style("green!50!black"),
const Tikz_Style &  target_style = tikz_points_style("blue"),
const Tikz_Style &  path_style = tikz_path_style("red"),
const bool  draw_waypoints = true,
const Tikz_Style &  waypoint_style = tikz_points_style("red"),
const int  polygon_layer = Tikz_Plane::Layer_Default,
const int  path_layer = Tikz_Plane::Layer_Foreground 
)
inline

Visualize the shortest path inside a simple polygon.

Definition at line 1442 of file tikzgeom_algorithms.H.

Referenced by TEST(), and Aleph::Tikz_Scene::visualize_shortest_path_in_polygon().

◆ visualize_shortest_path_with_portals()

ShortestPathDebugResult Aleph::visualize_shortest_path_with_portals ( Tikz_Plane &  plane,
const Polygon &  polygon,
const Point &  source,
const Point &  target,
const ShortestPathInPolygon &  algorithm = {},
const Tikz_Style &  polygon_style = tikz_area_style("black", "gray!15", 0.25),
const Tikz_Style &  source_style = tikz_points_style("green!50!black"),
const Tikz_Style &  target_style = tikz_points_style("blue"),
const Tikz_Style &  portal_style = tikz_wire_style("purple", true),
const Tikz_Style &  path_style = tikz_path_style("red"),
const bool  draw_waypoints = true,
const Tikz_Style &  waypoint_style = tikz_points_style("red"),
const int  polygon_layer = Tikz_Plane::Layer_Default,
const int  portal_layer = Tikz_Plane::Layer_Foreground,
const int  path_layer = Tikz_Plane::Layer_Overlay 
)
inline

Visualize the shortest path plus funnel portals.

This helper draws:

  • polygon, source and target points
  • funnel portals (dashed segments)
  • final shortest path

Definition at line 1469 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_shortest_path_with_portals().

◆ visualize_trapezoidal_map() [1/2]

TrapezoidalMapPointLocation::Result Aleph::visualize_trapezoidal_map ( Tikz_Plane &  plane,
const Array< Segment > &  segments,
const Tikz_Style &  segment_style = tikz_path_style("red"),
const Tikz_Style &  extension_style = tikz_wire_style("gray!60", true),
const bool  draw_trapezoids = true,
const double  trapezoid_opacity = 0.3 
)
inline

Build a trapezoidal map and draw it.

Convenience wrapper that constructs the map and draws it in one call.

Definition at line 2214 of file tikzgeom_algorithms.H.

References put_trapezoidal_map_result().

Referenced by main().

◆ visualize_trapezoidal_map() [2/2]

TrapezoidalMapPointLocation::Result Aleph::visualize_trapezoidal_map ( Tikz_Plane &  plane,
const Polygon &  polygon,
const Tikz_Style &  segment_style = tikz_path_style("red"),
const Tikz_Style &  extension_style = tikz_wire_style("gray!60", true),
const bool  draw_trapezoids = true,
const double  trapezoid_opacity = 0.3 
)
inline

Build a trapezoidal map from a polygon and draw it.

Definition at line 2230 of file tikzgeom_algorithms.H.

References put_trapezoidal_map_result().

◆ visualize_visibility_polygon()

Polygon Aleph::visualize_visibility_polygon ( Tikz_Plane &  plane,
const Polygon &  polygon,
const Point &  query_point,
const VisibilityPolygon &  algorithm = {},
const Tikz_Style &  polygon_style = tikz_wire_style("black"),
const Tikz_Style &  visibility_style = tikz_area_style("orange!90!black", "orange!25", 0.50),
const Tikz_Style &  query_style = tikz_points_style("red") 
)
inline

Compute and draw visibility polygon from a query point.

Definition at line 1778 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_visibility_polygon().

◆ visualize_visvalingam_whyatt()

Polygon Aleph::visualize_visvalingam_whyatt ( Tikz_Plane &  plane,
const Polygon &  poly,
const Geom_Number &  area_threshold,
const VisvalingamWhyattSimplification &  algorithm = {},
const Tikz_Style &  original_style = tikz_wire_style("gray!50"),
const Tikz_Style &  simplified_style = tikz_bold_wire_style("green!70!black"),
const bool  draw_vertices = true,
const Tikz_Style &  vertex_style = tikz_points_style("red") 
)
inline

Simplify a polygon with Visvalingam-Whyatt and draw the result.

Returns
The simplified polygon.

Definition at line 1950 of file tikzgeom_algorithms.H.

◆ visualize_voronoi()

VoronoiDiagram::Result Aleph::visualize_voronoi ( Tikz_Plane &  plane,
const DynList< Point > &  sites,
const VoronoiDiagram &  algorithm = {},
const bool  draw_cells = false,
const Tikz_Style &  cell_style = tikz_area_style("gray!50!black", "gray!15", 0.35),
const Tikz_Style &  edge_style = tikz_wire_style("black"),
const Tikz_Style &  unbounded_edge_style = tikz_wire_style("black", true, true),
const Tikz_Style &  site_style = tikz_points_style("red"),
const Geom_Number &  unbounded_ray_length = Geom_Number(50) 
)
inline

Compute and insert Voronoi diagram for input sites.

Returns the generated Voronoi result so callers can reuse it.

Definition at line 769 of file tikzgeom_algorithms.H.

Referenced by main(), TEST(), and Aleph::Tikz_Scene::visualize_voronoi().

◆ warning()

void Aleph::warning ( const char *  file,
int  line,
const char *  format,
  ... 
)
extern

Print a warning message with file and line info.

Parameters
fileSource file name (use FILE).
lineLine number (use LINE).
formatPrintf-style format string.
...Format arguments.

Definition at line 151 of file ahDefs.C.

References aleph_message_mutex, and file.

◆ write_le32()

static void Aleph::write_le32 ( std::uint8_t *  p,
std::uint32_t  value 
)
inlinestaticnoexcept

Definition at line 149 of file hash-fct.C.

References value.

Referenced by MurmurHash3_x86_128(), MurmurHash3_x86_32(), and write_le64().

◆ write_le64()

static void Aleph::write_le64 ( std::uint8_t *  p,
std::uint64_t  value 
)
inlinestaticnoexcept

Definition at line 157 of file hash-fct.C.

References value, and write_le32().

Referenced by MurmurHash3_x64_128().

◆ wyhash_hash() [1/3]

size_t Aleph::wyhash_hash ( const char *  key,
std::uint64_t  seed = Default_Hash_Seed 
)
inlinenoexcept

Definition at line 769 of file hash-fct.H.

References seed, and wyhash_hash().

◆ wyhash_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::wyhash_hash ( const Key &  key,
std::uint64_t  seed = Default_Hash_Seed 
)
noexcept

Definition at line 632 of file hash-fct.H.

References seed, and wyhash_hash().

◆ wyhash_hash() [3/3]

size_t Aleph::wyhash_hash ( const std::string &  key,
std::uint64_t  seed = Default_Hash_Seed 
)
inlinenoexcept

Definition at line 849 of file hash-fct.H.

References seed, and wyhash_hash().

◆ wyhash_mix()

static std::uint64_t Aleph::wyhash_mix ( std::uint64_t  lhs,
std::uint64_t  rhs 
)
inlinestaticnoexcept

Definition at line 215 of file hash-fct.C.

References mul_xor_fold64().

Referenced by wyhash_hash().

◆ xor_hash() [1/3]

size_t Aleph::xor_hash ( const char *  key)
inlinenoexcept

Definition at line 658 of file hash-fct.H.

References h.

◆ xor_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::xor_hash ( const Key &  key)
inlinenoexcept

Definition at line 551 of file hash-fct.H.

References xor_hash().

◆ xor_hash() [3/3]

size_t Aleph::xor_hash ( const std::string &  key)
inlinenoexcept

Definition at line 791 of file hash-fct.H.

References xor_hash().

◆ xxh64_merge_round()

static std::uint64_t Aleph::xxh64_merge_round ( std::uint64_t  acc,
std::uint64_t  value 
)
inlinestaticnoexcept

Definition at line 204 of file hash-fct.C.

References value, and xxh64_round().

Referenced by xxhash64_hash().

◆ xxh64_round()

static std::uint64_t Aleph::xxh64_round ( std::uint64_t  acc,
std::uint64_t  input 
)
inlinestaticnoexcept

Definition at line 193 of file hash-fct.C.

References ROTL64.

Referenced by xxh64_merge_round(), and xxhash64_hash().

◆ xxhash64_hash() [1/3]

size_t Aleph::xxhash64_hash ( const char *  key,
std::uint64_t  seed = Default_Hash_Seed 
)
inlinenoexcept

Definition at line 763 of file hash-fct.H.

References seed, and xxhash64_hash().

◆ xxhash64_hash() [2/3]

template<typename Key >
requires std::is_trivially_copyable_v<Key>
size_t Aleph::xxhash64_hash ( const Key &  key,
std::uint64_t  seed = Default_Hash_Seed 
)
noexcept

Definition at line 624 of file hash-fct.H.

References seed, and xxhash64_hash().

◆ xxhash64_hash() [3/3]

size_t Aleph::xxhash64_hash ( const std::string &  key,
std::uint64_t  seed = Default_Hash_Seed 
)
inlinenoexcept

Definition at line 843 of file hash-fct.H.

References seed, and xxhash64_hash().

◆ z_algorithm()

Array< size_t > Aleph::z_algorithm ( const std::string_view  s)
inline

Compute Z-array for a string.

z[i] equals the longest length L such that s[0..L-1] == s[i..i+L-1].

Parameters
[in]sInput string.
Returns
Z-array with size s.size(). When non-empty, z[0] = s.size().
Exceptions
None.
Complexity
O(n) time and O(n) space.

Definition at line 222 of file String_Search.H.

References and, Aleph::Array< T >::create(), l, r, and Aleph::Array< T >::size().

Referenced by main(), TEST(), and z_search().

◆ z_search()

Array< size_t > Aleph::z_search ( const std::string_view  text,
const std::string_view  pattern 
)
inline

Find all occurrences of a pattern using the Z-algorithm.

Parameters
[in]textText where matches are searched.
[in]patternPattern to find.
Returns
Array with all match start indices (0-based).
Exceptions
None.
Note
If no delimiter byte is available between pattern and text, this function falls back to kmp_search.
If pattern is empty, returns all positions in [0, text.size()].
Complexity
O(n + m) time and O(n + m) space.

Definition at line 269 of file String_Search.H.

References Aleph::string_search_detail::all_match_positions(), Aleph::Array< T >::append(), Aleph::string_search_detail::find_unused_delimiter(), kmp_search(), offset, Aleph::Array< T >::size(), and z_algorithm().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

◆ zip()

template<class Container1 , class Container2 >
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > Aleph::zip ( const Container1 &  a,
const Container2 &  b 
)
inline

Zip two containers into a list of pairs.

Combines elements from two containers pairwise. Iteration stops when the shorter container is exhausted.

Template Parameters
Container1Type of the first container.
Container2Type of the second container.
Parameters
aFirst container.
bSecond container.
Returns
DynList of pairs (a[i], b[i]).
Example:
DynList<int> nums = {1, 2, 3};
DynList<std::string> names = {"one", "two", "three"};
auto pairs = zip(nums, names);
// pairs = {(1, "one"), (2, "two"), (3, "three")}
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > zip(const Container1 &a, const Container2 &b)
Zip two containers into a list of pairs.
See also
zipEq() for version that throws on length mismatch.
zip_longest() for version that pads shorter container.
tzip() for tuple-based version.

Definition at line 1025 of file ahFunctional.H.

References and, Aleph::DynList< T >::append(), and LocateFunctions< Container, Type >::get_it().

Referenced by Aleph::Net_Cost_Graph< NodeT, ArcT >::Net_Cost_Graph(), Aleph::Net_Graph< NodeT, ArcT >::Net_Graph(), demo_zipping(), format_string(), format_string(), format_string(), main(), TEST(), TEST(), TEST_F(), Aleph::Matrix< Trow, Tcol, NumType >::to_str(), TYPED_TEST_P(), and TYPED_TEST_P().

◆ zip_all()

template<class Op , class... Cs>
bool Aleph::zip_all ( Op &&  op,
const Cs &...  cs 
)
inline

Return true if op returns true for all tuples and containers have equal length.

This is like ML's forall but also verifies that all containers have the same length. Use zip_all_short if you don't need length verification.

Parameters
opPredicate.
csContainers to zip.
Returns
true iff op is true for all tuples and lengths match.

Definition at line 505 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TYPED_TEST_P(), TYPED_TEST_P(), and zip_forall().

◆ zip_all_short()

template<class Op , class... Cs>
bool Aleph::zip_all_short ( Op &&  op,
const Cs &...  cs 
)
inline

Return true if op returns true for all tuples (without length check).

Like ML's forall. Iterates over the minimum length of all containers. Does NOT verify that containers have equal length.

Parameters
opPredicate.
csContainers to zip.
Returns
true iff op is true for all tuples.

Definition at line 526 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and zip_forall_short().

◆ zip_any()

template<class Op , class... Cs>
bool Aleph::zip_any ( Op &&  op,
const Cs &...  cs 
)
inline

Alias for zip_exists.

Like Python/JS any().

See also
zip_exists

Definition at line 579 of file ah-zip.H.

References zip_exists().

Referenced by TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_cmp()

template<class Cmp , class... Cs>
bool Aleph::zip_cmp ( Cmp  cmp,
const Cs &...  cs 
)

Return true if cmp(t) is true for each built tuple t.

Let us suppose 3 containers of the same internal type T.

l1 = { 1, 2, 3}; l2 = { 1, 2, 3}; l3 = { 1, 2, 3};

This function, which receives a comparator cmp(i1, i2), returns true if the elements of each tuple resulting of the zip of three containers are the same. So, in the previous case the result is true.

If any item of any list variates, then the result should be false. For example with l2 = { 1, 4, 3}.

Note
All containers must have the same Item_Type for comparison to work.
Author
Leandro Rabindranath Leon

Definition at line 1054 of file ah-zip.H.

References cmp(), Aleph::zip_detail::compare_adjacent(), and get_zip_it().

Referenced by TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ zip_count()

template<class Op , class... Cs>
size_t Aleph::zip_count ( Op &&  op,
const Cs &...  cs 
)
inline

Count tuples that satisfy predicate op.

Parameters
opPredicate.
csContainers to zip.
Returns
Number of tuples for which op returns true.

Definition at line 607 of file ah-zip.H.

References count(), and zip_it().

Referenced by TEST(), TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_drop()

template<class... Cs>
auto Aleph::zip_drop ( const size_t  n,
const Cs &...  cs 
)

Skip n tuples and return the rest.

Parameters
nNumber of tuples to skip.
csContainers to zip.
Returns
DynList of remaining tuples after skipping n.

Definition at line 1765 of file ah-zip.H.

References and, Aleph::DynList< T >::append(), and zip_it().

Referenced by demo_zip_utilities(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_drop_while()

template<class Pred , class... Cs>
auto Aleph::zip_drop_while ( Pred &&  pred,
const Cs &...  cs 
)

Skip tuples while predicate pred returns true, then return the rest.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
DynList of tuples after pred becomes false.

Definition at line 1813 of file ah-zip.H.

References and, Aleph::DynList< T >::append(), pred, and zip_it().

Referenced by TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_exists()

template<class Op , class... Cs>
bool Aleph::zip_exists ( Op &&  op,
const Cs &...  cs 
)
inline

Return true if op returns true for at least one tuple.

Like ML's exists. Iterates over the minimum length of all containers.

Parameters
opPredicate.
csContainers to zip.
Returns
true if any tuple satisfies op.

Definition at line 565 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), zip_any(), and zip_none().

◆ zip_filter()

template<class Op , class... Cs>
auto Aleph::zip_filter ( Op  op,
const Cs &...  cs 
)

Filter zipped tuples by predicate op.

Selects tuples from the zipped containers where the predicate returns true. Iterates over the minimum length of all containers.

Parameters
opPredicate function that takes a tuple and returns bool.
csContainers to zip together.
Returns
DynList of tuples for which op returned true.
Example:
DynList<int> nums = {1, 2, 3, 4, 5};
DynList<int> vals = {10, 20, 30, 40, 50};
// Filter tuples where first element is even
auto result = zip_filter([](auto t) {
return std::get<0>(t) % 2 == 0;
}, nums, vals);
// result contains: {(2, 20), (4, 40)}
auto zip_filter(Op op, const Cs &...cs)
Filter zipped tuples by predicate op.
Definition ah-zip.H:959

Definition at line 959 of file ah-zip.H.

References Aleph::DynList< T >::append(), and zip_it().

Referenced by demo_zip_transformation(), main(), TEST(), TEST(), TEST(), and TEST_F().

◆ zip_filter_eq()

template<class Op , class... Cs>
auto Aleph::zip_filter_eq ( Op  op,
const Cs &...  cs 
)

Filter zipped tuples by predicate op; throw if containers differ in length.

Like zip_filter, but additionally verifies that all containers have the same length after iteration.

Parameters
opPredicate function that takes a tuple and returns bool.
csContainers to zip together.
Returns
DynList of tuples for which op returned true.
Exceptions
std::length_errorif container sizes mismatch.
Example:
DynList<int> nums = {1, 2, 3};
DynList<int> vals = {10, 20, 30};
// This will succeed (equal lengths)
auto result = zip_filter_eq([](auto t) {
return std::get<0>(t) > 1;
}, nums, vals);
DynList<int> short_list = {1, 2};
// This will throw std::length_error
auto bad = zip_filter_eq([](auto) { return true; }, nums, short_list);
auto zip_filter_eq(Op op, const Cs &...cs)
Filter zipped tuples by predicate op; throw if containers differ in length.
Definition ah-zip.H:1000

Definition at line 1000 of file ah-zip.H.

References ah_length_error_if, Aleph::DynList< T >::append(), and zip_it().

Referenced by TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_find_first()

template<class Op , class... Cs>
auto Aleph::zip_find_first ( Op &&  op,
const Cs &...  cs 
)

Return the first tuple that satisfies predicate op.

Parameters
opPredicate.
csContainers to zip.
Returns
A pair (tuple, found). If found is true, tuple contains the match. If found is false, tuple is default-constructed.

Definition at line 641 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_find_index()

template<class Op , class... Cs>
size_t Aleph::zip_find_index ( Op  op,
const Cs &...  cs 
)

Find the first index where op returns true.

Parameters
opPredicate.
csContainers to zip.
Returns
Index of the first matching tuple, or the total number of tuples if none match.

Definition at line 1077 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_find_last()

template<class Op , class... Cs>
auto Aleph::zip_find_last ( Op &&  op,
const Cs &...  cs 
)

Return the last tuple that satisfies predicate op.

Parameters
opPredicate.
csContainers to zip.
Returns
A pair (tuple, found). If found is true, tuple contains the match. If found is false, tuple is default-constructed.

Definition at line 662 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_first()

template<class... Cs>
auto Aleph::zip_first ( const Cs &...  cs)

Return the first tuple from zipped containers.

Parameters
csContainers to zip.
Returns
A pair (tuple, found). If found is true, tuple contains the element. If containers are empty, found is false.

Definition at line 710 of file ah-zip.H.

References zip_nth().

Referenced by TEST(), and TEST_F().

◆ zip_foldl()

template<typename T , class Op , class... Cs>
T Aleph::zip_foldl ( const T &  init,
Op  op,
const Cs &...  cs 
)

Left fold (reduce) over zipped tuples.

Accumulates a value by applying a binary operation to the accumulator and each tuple from the zipped containers, from left to right. This is equivalent to ML's foldl or JavaScript's reduce.

Template Parameters
TAccumulator type.
OpBinary operation type (T, tuple) -> T.
CsContainer types.
Parameters
initInitial accumulator value.
opBinary operation that combines accumulator with each tuple.
csContainers to zip together.
Returns
Final accumulated value after processing all tuples.
Example:
DynList<int> prices = {10, 20, 30};
DynList<int> quantities = {2, 3, 1};
// Calculate total cost: sum of (price * quantity)
int total = zip_foldl(0, [](int acc, auto t) {
return acc + std::get<0>(t) * std::get<1>(t);
}, prices, quantities);
// total = 0 + 10*2 + 20*3 + 30*1 = 110
T zip_foldl(const T &init, Op op, const Cs &...cs)
Left fold (reduce) over zipped tuples.
Definition ah-zip.H:806

Definition at line 806 of file ah-zip.H.

References init, and zip_it().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ zip_foldl_eq()

template<typename T , class Op , class... Cs>
T Aleph::zip_foldl_eq ( const T &  init,
Op  op,
const Cs &...  cs 
)

Left fold over zipped tuples; throw if containers differ in length.

Template Parameters
TAccumulator type.
Parameters
initInitial accumulator value.
opBinary operation (T, tuple) -> T.
csContainers to zip.
Returns
Final accumulated value.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 826 of file ah-zip.H.

References ah_length_error_if, init, and zip_it().

Referenced by TEST(), TEST_F(), and TEST_F().

◆ zip_for_each()

template<class Op , class... Cs>
void Aleph::zip_for_each ( Op &&  op,
const Cs &...  cs 
)
inline

Apply op to every zipped tuple.

Iterates over all zipped tuples, applying the callable to each. This is a side-effect operation (returns void). Iterates over the minimum length of all containers.

Template Parameters
OpCallable type (tuple) -> void.
CsContainer types.
Parameters
opCallable to invoke on each tuple (for side effects).
csContainers to zip together.
Example:
DynList<std::string> names = {"Alice", "Bob"};
DynList<int> ages = {30, 25};
zip_for_each([](auto t) {
std::cout << std::get<0>(t) << " is "
<< std::get<1>(t) << " years old\n";
}, names, ages);
// Output:
// Alice is 30 years old
// Bob is 25 years old
void zip_for_each(Op &&op, const Cs &...cs)
Apply op to every zipped tuple.
Definition ah-zip.H:471
See also
zip_for_each_eq for version that verifies equal lengths
zip_for_each_indexed for version with index

Definition at line 471 of file ah-zip.H.

References zip_it().

Referenced by main(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_for_each_eq()

template<class Op , class... Cs>
void Aleph::zip_for_each_eq ( Op &&  op,
const Cs &...  cs 
)
inline

Apply op to every zipped tuple; throw if containers differ in length.

Parameters
opCallable to invoke on each tuple.
csContainers to zip.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 485 of file ah-zip.H.

References ah_length_error_if, and get_zip_it().

Referenced by TEST_F(), and TEST_F().

◆ zip_for_each_indexed()

template<class Op , class... Cs>
void Aleph::zip_for_each_indexed ( Op &&  op,
const Cs &...  cs 
)
inline

Apply op to each zipped tuple along with its index.

More direct than using enum_zip_it manually.

Parameters
opCallable (size_t index, tuple) -> void.
csContainers to zip.

Definition at line 1712 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST_F(), and TEST_F().

◆ zip_for_each_indexed_eq()

template<class Op , class... Cs>
void Aleph::zip_for_each_indexed_eq ( Op &&  op,
const Cs &...  cs 
)
inline

Apply op to each zipped tuple with index; throw if lengths differ.

Parameters
opCallable (size_t index, tuple) -> void.
csContainers to zip.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 1727 of file ah-zip.H.

References ah_length_error_if, and zip_it().

Referenced by TEST_F(), and TEST_F().

◆ zip_forall()

template<class Op , class... Cs>
bool Aleph::zip_forall ( Op &&  op,
const Cs &...  cs 
)
inline

Alias for zip_all.

Like ML's forall with length verification.

See also
zip_all

Definition at line 540 of file ah-zip.H.

References zip_all().

Referenced by TEST_F().

◆ zip_forall_short()

template<class Op , class... Cs>
bool Aleph::zip_forall_short ( Op &&  op,
const Cs &...  cs 
)
inline

Alias for zip_all_short.

Like ML's forall without length verification.

See also
zip_all_short

Definition at line 550 of file ah-zip.H.

References zip_all_short().

Referenced by TEST_F().

◆ zip_it()

◆ zip_it_pos()

template<class... Cs>
ZipIterator< Cs... > Aleph::zip_it_pos ( size_t  pos,
const Cs &...  cs 
)
inline

Alias for get_zip_it_pos.

Definition at line 366 of file ah-zip.H.

References get_zip_it_pos().

Referenced by TEST_F(), and TEST_F().

◆ zip_length()

template<class... Cs>
size_t Aleph::zip_length ( const Cs &...  cs)
inline

Count all tuples (minimum length of containers).

Parameters
csContainers to zip.
Returns
Number of tuples that would be produced.

Definition at line 623 of file ah-zip.H.

References count(), and zip_it().

Referenced by TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ zip_lists()

template<class C , typename... Lists>
auto Aleph::zip_lists ( const C &  c,
const Lists &...  lists 
)

Take several container of same type and some length and builds a list of lists.

Example: l1 = { 1, 2, 3, 4} l2 = { 5, 6, 7, 8} l3 = { 9, 0, 10, 11}

Where each li is a DynList<int> (but they could be heterogeneous; i.e. they could be DynList, DynSetTree, etc)

Then zip_list(l1, l2, l3) produces a DynList<DynList<int>> with the following content:

{ {1, 5, 9}, {2, 6, 0}, {3, 7, 10}, {4, 8, 11} }

Definition at line 1515 of file ah-zip.H.

References Aleph::DynList< T >::append(), and get_zip_it().

Referenced by main(), and TEST_F().

◆ zip_lists_eq()

template<class C , typename... Lists>
auto Aleph::zip_lists_eq ( const C &  c,
const Lists &...  lists 
)

Like zip_lists but throws if containers differ in length.

Parameters
cFirst container.
listsAdditional containers.
Returns
DynList of DynLists.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 1534 of file ah-zip.H.

References ah_length_error_if, Aleph::DynList< T >::append(), and get_zip_it().

Referenced by TEST_F(), and TEST_F().

◆ zip_longest()

template<class Container1 , class Container2 >
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > Aleph::zip_longest ( const Container1 &  a,
const Container2 &  b,
const typename Container1::Item_Type &  fill_a = typename Container1::Item_Type(),
const typename Container2::Item_Type &  fill_b = typename Container2::Item_Type() 
)
inline

Zip two containers, padding the shorter one with a fill value.

Unlike zip() which stops at the shorter container, zip_longest() continues until both containers are exhausted. When one container is exhausted before the other, its corresponding values in the resulting pairs are filled with the specified fill value.

This is similar to Python's itertools.zip_longest().

Template Parameters
Container1Type of the first container.
Container2Type of the second container.
Parameters
aFirst container.
bSecond container.
fill_aValue to use when container a is exhausted.
fill_bValue to use when container b is exhausted.
Returns
DynList of pairs containing all elements from both containers.
Example:
DynList<int> short_list = {1, 2};
DynList<int> long_list = {10, 20, 30, 40};
auto result = zip_longest(short_list, long_list, 0, -1);
// result contains: {(1, 10), (2, 20), (0, 30), (0, 40)}
// With different fill values:
auto result2 = zip_longest(long_list, short_list, -1, 0);
// result2 contains: {(10, 1), (20, 2), (30, 0), (40, 0)}
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > zip_longest(const Container1 &a, const Container2 &b, const typename Container1::Item_Type &fill_a=typename Container1::Item_Type(), const typename Container2::Item_Type &fill_b=typename Container2::Item_Type())
Zip two containers, padding the shorter one with a fill value.
See also
zip() for version that stops at the shorter container.
tzip_longest() for tuple-based version.

Definition at line 2808 of file ahFunctional.H.

References and, Aleph::DynList< T >::append(), and LocateFunctions< Container, Type >::get_it().

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ zip_longest_opt()

template<class Container1 , class Container2 >
DynList< std::pair< std::optional< typename Container1::Item_Type >, std::optional< typename Container2::Item_Type > > > Aleph::zip_longest_opt ( const Container1 &  a,
const Container2 &  b 
)
inline

Zip two containers using optionals for missing values.

Like zip_longest() but uses std::optional to represent missing values instead of requiring explicit fill values. This is useful when there's no sensible default value, or when you need to distinguish between a real value and a fill value.

Template Parameters
Container1Type of the first container.
Container2Type of the second container.
Parameters
aFirst container.
bSecond container.
Returns
DynList of pairs of optionals.
Example:
DynList<int> a = {1, 2, 3};
DynList<std::string> b = {"x"};
auto result = zip_longest_opt(a, b);
// result contains:
// ({1}, {"x"})
// ({2}, nullopt)
// ({3}, nullopt)
for (const auto& [opt_a, opt_b] : result)
{
if (opt_a) std::cout << "a=" << *opt_a;
if (opt_b) std::cout << " b=" << *opt_b;
std::cout << '\n';
}
DynList< std::pair< std::optional< typename Container1::Item_Type >, std::optional< typename Container2::Item_Type > > > zip_longest_opt(const Container1 &a, const Container2 &b)
Zip two containers using optionals for missing values.
See also
zip_longest() for version with explicit fill values.

Definition at line 2951 of file ahFunctional.H.

References and, Aleph::DynList< T >::append(), and LocateFunctions< Container, Type >::get_it().

Referenced by TEST().

◆ zip_map()

template<class Op , class... Cs>
auto Aleph::zip_map ( Op &&  op,
const Cs &...  cs 
)

Map op over zipped tuples with auto-deduced return type.

Unlike zip_maps<T>, this version automatically deduces the result type from the return type of op.

Parameters
opTransformation callable.
csContainers to zip.
Returns
DynList of transformed values (type auto-deduced).

Definition at line 898 of file ah-zip.H.

References Aleph::DynList< T >::append(), and zip_it().

Referenced by demo_zip_transformation(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ zip_map_eq()

template<class Op , class... Cs>
auto Aleph::zip_map_eq ( Op &&  op,
const Cs &...  cs 
)

Map op over zipped tuples with auto-deduced return type; throw if lengths differ.

Parameters
opTransformation callable.
csContainers to zip.
Returns
DynList of transformed values (type auto-deduced).
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 919 of file ah-zip.H.

References ah_length_error_if, Aleph::DynList< T >::append(), and zip_it().

Referenced by TEST(), TEST_F(), and TEST_F().

◆ zip_maps()

template<typename T , class Op , class... Cs>
DynList< T > Aleph::zip_maps ( Op  op,
const Cs &...  cs 
)

Map op over zipped tuples, returning a list of results.

Applies a transformation function to each tuple from the zipped containers and collects the results in a DynList. The result type must be explicitly specified. For auto-deduced return type, use zip_map instead.

Template Parameters
TResult type (must be explicitly specified).
OpTransformation callable type.
CsContainer types.
Parameters
opTransformation callable that takes a tuple and returns T.
csContainers to zip together.
Returns
DynList<T> of transformed values.
Example:
DynList<int> xs = {1, 2, 3};
DynList<int> ys = {10, 20, 30};
// Create strings from each pair
auto result = zip_maps<std::string>([](auto t) {
return std::to_string(std::get<0>(t)) + "+" +
std::to_string(std::get<1>(t));
}, xs, ys);
// result contains: {"1+10", "2+20", "3+30"}
See also
zip_map for auto-deduced return type version
zip_maps_eq for version that verifies equal lengths

Definition at line 747 of file ah-zip.H.

References Aleph::DynList< T >::append(), and zip_it().

◆ zip_maps_eq()

template<typename T , class Op , class... Cs>
DynList< T > Aleph::zip_maps_eq ( Op  op,
const Cs &...  cs 
)

Map op over zipped tuples; throw if containers differ in length.

Template Parameters
TResult type.
Parameters
opTransformation callable.
csContainers to zip.
Returns
DynList of transformed values.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 849 of file ah-zip.H.

References ah_length_error_if, Aleph::DynList< T >::append(), and zip_it().

◆ zip_maps_if()

template<typename T , class Prop , class Op , class... Cs>
DynList< T > Aleph::zip_maps_if ( Prop  prop,
Op  op,
const Cs &...  cs 
)

Map op over zipped tuples that satisfy prop.

Template Parameters
TResult type.
Parameters
propPredicate selecting which tuples to transform.
opTransformation callable.
csContainers to zip.
Returns
DynList of transformed values for tuples where prop is true.

Definition at line 766 of file ah-zip.H.

References Aleph::DynList< T >::append(), and zip_it().

◆ zip_maps_if_eq()

template<typename T , class Prop , class Op , class... Cs>
DynList< T > Aleph::zip_maps_if_eq ( Prop  prop,
Op  op,
const Cs &...  cs 
)

Map op over zipped tuples that satisfy prop; throw if lengths differ.

Template Parameters
TResult type.
Parameters
propPredicate selecting which tuples to transform.
opTransformation callable.
csContainers to zip.
Returns
DynList of transformed values for tuples where prop is true.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 873 of file ah-zip.H.

References ah_length_error_if, Aleph::DynList< T >::append(), and zip_it().

◆ zip_none()

template<class Op , class... Cs>
bool Aleph::zip_none ( Op &&  op,
const Cs &...  cs 
)
inline

Return true if op returns false for all tuples.

This is the complement of zip_exists().

Parameters
opPredicate.
csContainers to zip.
Returns
true if no tuple satisfies op.

Definition at line 594 of file ah-zip.H.

References zip_exists().

Referenced by TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ zip_nth()

template<class... Cs>
auto Aleph::zip_nth ( size_t  n,
const Cs &...  cs 
)

Return the n-th tuple from zipped containers.

Parameters
nIndex (0-based).
csContainers to zip.
Returns
A pair (tuple, found). If found is true, tuple contains the element. If n >= zip_length, found is false and tuple is default-constructed.

Definition at line 689 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and zip_first().

◆ zip_partition()

template<class Op , class... Cs>
auto Aleph::zip_partition ( Op  op,
const Cs &...  cs 
)

Partition zipped tuples by predicate op.

Separates zipped tuples into two groups based on a predicate: those for which the predicate returns true, and those for which it returns false. Also returns the count of each group.

Template Parameters
OpPredicate type (tuple) -> bool.
CsContainer types.
Parameters
opPredicate to partition by.
csContainers to zip together.
Returns
A tuple of four elements:
  • std::get<0>: DynList of tuples where op returned true
  • std::get<1>: Count of matching tuples (size_t)
  • std::get<2>: DynList of tuples where op returned false
  • std::get<3>: Count of non-matching tuples (size_t)
Example:
DynList<int> nums = {1, 2, 3, 4, 5};
DynList<std::string> labels = {"a", "b", "c", "d", "e"};
// Partition by even numbers
auto [evens, even_count, odds, odd_count] =
zip_partition([](auto t) {
return std::get<0>(t) % 2 == 0;
}, nums, labels);
// evens contains: {(2, "b"), (4, "d")}
// even_count is 2
// odds contains: {(1, "a"), (3, "c"), (5, "e")}
// odd_count is 3
auto zip_partition(Op op, const Cs &...cs)
Partition zipped tuples by predicate op.
Definition ah-zip.H:1124

Definition at line 1124 of file ah-zip.H.

References Aleph::DynList< T >::append(), and zip_it().

Referenced by TEST(), and TEST_F().

◆ zip_take()

template<class... Cs>
auto Aleph::zip_take ( size_t  n,
const Cs &...  cs 
)

Take at most n tuples from the zipped containers.

Parameters
nMaximum number of tuples to take.
csContainers to zip.
Returns
DynList of up to n tuples.

Definition at line 1746 of file ah-zip.H.

References and, Aleph::DynList< T >::append(), count(), and zip_it().

Referenced by demo_zip_utilities(), TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_take_while()

template<class Pred , class... Cs>
auto Aleph::zip_take_while ( Pred &&  pred,
const Cs &...  cs 
)

Take tuples while predicate pred returns true.

Parameters
predPredicate (tuple) -> bool.
csContainers to zip.
Returns
DynList of tuples while pred is satisfied.

Definition at line 1790 of file ah-zip.H.

References Aleph::DynList< T >::append(), pred, and zip_it().

Referenced by demo_zip_utilities(), TEST(), TEST(), TEST_F(), TEST_F(), and TEST_F().

◆ zip_transform()

template<class Op , class... Cs>
auto Aleph::zip_transform ( Op &&  op,
const Cs &...  cs 
)

Transform zipped tuples using op and return results in a vector.

Similar to std::ranges::transform but operates on zipped containers.

Template Parameters
OpTransformation callable (tuple) -> R.
Parameters
opTransformation to apply.
csContainers to zip.
Returns
std::vector of transformed values.

Definition at line 1667 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST_F(), and TEST_F().

◆ zip_transform_eq()

template<class Op , class... Cs>
auto Aleph::zip_transform_eq ( Op &&  op,
const Cs &...  cs 
)

Transform zipped tuples; throw if containers differ in length.

Template Parameters
OpTransformation callable.
Parameters
opTransformation to apply.
csContainers to zip.
Returns
std::vector of transformed values.
Exceptions
std::length_errorif container sizes mismatch.

Definition at line 1689 of file ah-zip.H.

References ah_length_error_if, and zip_it().

Referenced by TEST_F(), and TEST_F().

◆ zip_traverse()

template<class Op , class... Cs>
bool Aleph::zip_traverse ( Op &&  op,
const Cs &...  cs 
)
inline

Traverse zipped containers while op returns true.

Iterates over zipped tuples, calling the predicate for each. Stops early if the predicate returns false. Iterates over the minimum length of all containers.

Template Parameters
OpPredicate type (tuple) -> bool.
CsContainer types.
Parameters
opCallable returning bool; traversal stops on false.
csContainers to zip together.
Returns
true if op returned true for every tuple, false otherwise.
Example:
DynList<int> xs = {1, 2, 3, 4};
DynList<int> ys = {10, 20, 30, 40};
// Check if all pairs have x < y
bool all_less = zip_traverse([](auto t) {
return std::get<0>(t) < std::get<1>(t);
}, xs, ys);
// all_less is true
bool zip_traverse(Op &&op, const Cs &...cs)
Traverse zipped containers while op returns true.
Definition ah-zip.H:415
See also
zip_traverse_eq for version that verifies equal lengths

Definition at line 415 of file ah-zip.H.

References zip_it().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ zip_traverse_eq()

template<class Op , class... Cs>
bool Aleph::zip_traverse_eq ( Op &&  op,
const Cs &...  cs 
)
inline

Traverse zipped containers while op returns true; verify equal lengths.

Parameters
opCallable returning bool; traversal stops on false.
csContainers to zip.
Returns
true if all containers have equal length and op returned true for every tuple.

Definition at line 432 of file ah-zip.H.

References zip_it().

Referenced by TEST_F(), and TEST_F().

◆ zipEq()

template<class Container1 , class Container2 >
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > Aleph::zipEq ( const Container1 &  a,
const Container2 &  b 
)
inline

Zip two containers; throw if lengths differ.

Like zip() but verifies that both containers have equal length. Throws std::length_error if container sizes don't match.

Template Parameters
Container1Type of the first container.
Container2Type of the second container.
Parameters
aFirst container.
bSecond container.
Returns
DynList of pairs (a[i], b[i]).
Exceptions
std::length_errorif container sizes mismatch.
Example:
DynList<int> xs = {1, 2, 3};
DynList<int> ys = {4, 5, 6};
auto pairs = zipEq(xs, ys); // OK, same length
DynList<int> zs = {7, 8};
// zipEq(xs, zs); // throws std::length_error!
DynList< std::pair< typename Container1::Item_Type, typename Container2::Item_Type > > zipEq(const Container1 &a, const Container2 &b)
Zip two containers; throw if lengths differ.
See also
zip() for version that stops at shorter container.
tzipEq() for tuple-based version.

Definition at line 1110 of file ahFunctional.H.

References ah_length_error_if, and, Aleph::DynList< T >::append(), and LocateFunctions< Container, Type >::get_it().

Referenced by TEST_F().

◆ ZipIterator()

Aleph::ZipIterator ( const HeadC &  head,
const TailC &...  tail 
)

Construct a zip iterator over multiple Aleph containers.

Iteration stops when any of the underlying iterators reaches its end.

Parameters
[in]headFirst container.
[in]tailRemaining containers.

Definition at line 170 of file ah-zip.H.

Variable Documentation

◆ Aleph_Snd_Hash_Seed

constexpr std::uint32_t Aleph::Aleph_Snd_Hash_Seed = 0x9e3779b9u
staticconstexpr

Fixed seed used by the secondary hash function.

Definition at line 1006 of file hash-fct.H.

Referenced by snd_hash_fct(), snd_hash_fct(), snd_hash_fct(), TEST(), and TEST_F().

◆ and

template<AlephSequentialIterableContainer Container, class Hash , class Equal >
requires (const typename Container::Item_Type &v, Hash h, Equal e)
and AlStreamable<T> Aleph::and
Initial value:
{
{ h(v) } -> std::convertible_to<size_t>
long double h
Definition btreepic.C:154

Check uniqueness with explicit hash + equality functors.

Write vec, as Vector::to_str() gives it, to s.

This overload is intended for custom equivalence relations where a matching hash function is available (for example, case-insensitive string equality).

Complexity:

  • Expected O(n) when DynSetLhash is complete in the current translation unit.
  • O(n²) fallback otherwise.
Parameters
containerSource container to check.
hashHash functor compatible with eq.
eqEquality comparator compatible with hash.
Returns
true if all elements are unique according to eq, false otherwise.

Definition at line 2708 of file ahFunctional.H.

Referenced by Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Array_Graph(), Aleph::Array_Iterator< T >::Array_Iterator(), Aleph::Array_Iterator< T >::Array_Iterator(), Aleph::FFT< Real >::BatchedISTFTProcessor::BatchedISTFTProcessor(), TimeoutQueue::Event::Event(), TimeoutQueue::Event::Event(), Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::Floyd_All_Shortest_Paths(), Aleph::CsvReader::Iterator::Iterator(), Aleph::Johnson< GT, Distance, Ait, NAit, SA >::Johnson(), Aleph::hamiltonian_detail::Simple_Graph< GT, SA >::Simple_Graph(), Aleph::SkipList< Key, Type >::SkipList(), Aleph::SkipList< Key, Type >::SkipList(), Aleph::AhArenaAllocator::~AhArenaAllocator(), Aleph::CA::JSON_Frame_Stream_Writer::~JSON_Frame_Stream_Writer(), __compute_cut_nodes(), __deway_search(), __generate_tree(), __random_select(), __random_select(), __random_select(), __search_deway(), __tree_preorder_traversal(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::_interpolated_factors_for_main_var(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::_try_lift_affine_linear_factor_for_main_var(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::_try_lift_primitive_affine_linear_factor_for_main_var(), Aleph::CA::Composite_Frame_Sink< Sinks >::accept(), Aleph::FFT< Real >::ISTFTProcessor::accumulate_frame(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::add_if_fits(), Aleph::shortest_path_detail::add_if_fits(), Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::add_if_fits(), Aleph::negative_cycles_detail::Exact_Sum< T >::add_multiple(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::add_overflows(), adjust_minimal_separation_with_letf_sibling(), Aleph::blossom_weighted_detail::mwmatching::adjust_weights_for_maximum_cardinality_matching(), Aleph::zip_index_detail::all_of_tuple_impl(), all_unique(), Aleph::stl_zip_detail::all_valid(), Aleph::std_zip_detail::all_valid(), Pointer_Table::allocate_above_heap(), Aleph::Test_Eulerian< GT, SN, SA >::analyze_digraph(), Aleph::Compiler_Typed_Semantic_Analyzer::analyze_function(), Aleph::Test_Eulerian< GT, SN, SA >::analyze_graph(), Aleph::Compiler_Semantic_Analyzer::analyze_imports(), Aleph::Compiler_Typed_Semantic_Analyzer::analyze_stmt(), Aleph::SegmentArrangement::angle_quad(), Aleph::VisibilityPolygon::angle_quadrant(), Aleph::MemArray< T >::annotate(), Aleph::Path< GT >::append(), Aleph::Dlink::append(), Aleph::HTList::append(), Aleph::Floyd_All_Shortest_Paths< GT, Distance, SA >::append_lightest_arc(), Aleph::mat_path_detail::append_node(), Aleph::Compiler_Typed_Semantic_Analyzer::append_unique_type_id(), Aleph::CA::Kernel2D< T, Rows, Cols >::apply(), Aleph::FFT< Real >::Plan::apply_bluestein_transform(), Aleph::NTT< MOD, ROOT >::Plan::apply_bluestein_transform(), Aleph::FFT< Real >::Plan::apply_butterflies(), Aleph::LineEq::approx_equal(), approximate_string_size(), Aleph::eulerian_detail::arcs_are_together(), are_eq(), are_tree_equal(), areEquivalents(), areSimilar(), assert_valid_tree_root(), assign_distance(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::assign_label_t(), assign_parrectangle(), assign_rectangle(), assign_triangle(), Aleph::Network_Simplex< Net >::augment_and_find_leaving(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::augment_blossom_rec(), aumenting_path_maximum_flow(), Aleph::FFT< Real >::Plan::automatic_batch_simd_candidate(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::autoreduce_groebner_basis(), Aleph::GenBinHeap< NodeType, Key, Compare >::back_under(), Aleph::Filter_Iterator< Container, It, Show_Item >::backward(), Aleph::graph_dry_detail::In_Arcs_Walk< GT, SA >::backward(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::balance_digraph_node(), Aleph::FFT< Real >::balance_polynomial_for_roots(), Aleph::Generator< T >::begin(), benchmark_array_algorithms(), benchmark_list_algorithms(), Aleph::Breadth_First_Traversal< GT, Operation, SA >::bft(), Aleph::NTT< MOD, ROOT >::bigint_multiply(), binary_search(), binary_search(), Aleph::Gen_Polynomial< Coefficient >::bisect_root(), Aleph::Compiler_Dataflow_Detail::bit_set_intersection(), Aleph::Compiler_Dataflow_Detail::bit_set_subtract(), Aleph::negative_cycles_detail::bit_span(), KnapsackDomain::bound(), Aleph::planarity_detail::bounding_boxes_intersect(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::box_contains_box(), Aleph::AABBTree::box_contains_point(), Aleph::AABBTree::boxes_overlap(), boyer_moore_horspool_search(), Aleph::detail::bplus_equiv(), breadth_first_traversal(), bucket_sort(), bucket_sort(), Aleph::Aho_Corasick::build(), Aleph::Gen_Cartesian_Tree< T, Comp >::build(), Aleph::Gen_Mo_On_Trees< GT, Policy >::build(), Aleph::RangeTree2D::build(), Aleph::Bounded_Cycle_Index< GT >::build(), Aleph::tree_dp_detail::Tree_Topology< GT, SA >::build_adjacency(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_combinatorial_embedding(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_combinatorial_embedding_bruteforce(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_combinatorial_embedding_linear_lr(), build_cross_net_graph(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::build_decomposition(), Aleph::MonotonePolygonTriangulation::build_faces_from_diagonals(), Aleph::RangeTree2D::build_node(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::build_nonplanar_certificate(), build_residual_net(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::build_simple_adjacency(), Aleph::tree_decomposition_detail::Rooted_Tree_Topology< GT, SA >::build_simple_adjacency(), Aleph::Network_Simplex< Net >::build_spanning_tree(), Aleph::k_shortest_paths_detail::build_suffix_index_with_itor(), Aleph::Find_Depth_First_Spanning_Tree< GT, SA >::build_tree(), Aleph::Find_Breadth_First_Spanning_Tree< GT, SA >::build_tree(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::build_tree(), Aleph::ShortestPathInPolygon::build_tris(), Aleph::FFT< Real >::build_weighted_frequency_grid(), adaptive_huffman_demo::byte_label(), capacity_scaling_maximum_flow(), cdt_has_edge(), char_to_nibble(), Aleph::Path< GT >::check(), OhashCommon< HashTbl, Key >::Iterator::check(), Aleph::Net_Arc< Arc_Info, F_Type >::check_arc(), check_baseball_elimination(), check_bst_range(), check_delaunay_for_non_constrained(), Aleph::Path< GT >::check_directed(), Aleph::blossom_weighted_detail::mwmatching::impl::check_input_graph(), Aleph::PatriciaSet< UInt >::check_invariants(), Aleph::PatriciaMap< UInt, T >::check_invariants(), Aleph::patricia_trie_detail::Bitwise_Trie_Utils< UInt >::check_invariants_rec(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::check_max(), Aleph::Net_Graph< NodeT, ArcT >::check_network(), Aleph::Net_Graph< NodeT, ArcT >::check_node(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::check_painted_arcs(), check_rank_tree(), check_residual_net(), Aleph::shortest_path_detail::checked_add(), Aleph::CA::ca_io_detail::checked_coord_add(), Aleph::Source_Manager::checked_index(), Aleph::Segment_Tree_Beats< T >::chmax_impl(), Aleph::Segment_Tree_Beats< T >::chmin_impl(), Aleph::FFT< Real >::choose_remez_extrema(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::choose_subtree(), chromatic_number(), Aleph::Compiler_Bytecode_Detail::classify_constant(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::classify_k33(), Aleph::MonotonePolygonTriangulation::classify_vertex(), clone_tree(), Aleph::ConvexPolygonDistanceGJK::closest_from_simplex(), Aleph::BruteForceConvexHull::CmpSegment::cmp_point(), Aleph::Tikz_Plane::collect_legend_entries(), Aleph::GenTdRbTree< NodeType, Key, Compare >::colorRootAsRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::colorRootAsRed(), Aleph::RadixTree< T, Char >::common_prefix_length(), Aleph::FFT< Real >::comp_ellint_1_impl(), Aleph::zip_detail::compare_adjacent(), Aleph::stl_zip_detail::compare_adjacent_impl(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::compare_fractions(), compiler_build_module_name_table(), compiler_bytecode_value_to_string(), compiler_dump_bytecode_function(), compiler_dump_bytecode_module(), compiler_dump_cfg_function(), compiler_dump_dataflow_analysis(), compiler_dump_ir_function(), compiler_dump_ir_module(), compiler_dump_ssa_function(), compiler_dump_ssa_module(), compiler_integer_binary(), compiler_link_module_surfaces(), compiler_resolve_module_name(), compiler_unquote_string_token(), completed(), Aleph::StlZipIterator< Containers >::completed_impl(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::compress(), Aleph::Compiler_Dataflow_Detail::compute_block_use_def(), Aleph::Unconnected_Components< GT, SA >::compute_blocks(), compute_cut_nodes(), Aleph::Compiler_SSA_Detail::compute_dominance_info(), compute_height(), Aleph::hld_detail::HLD_Tree_Data< GT, SA >::compute_hld_positions(), Aleph::Unconnected_Components< GT, SA >::compute_lists(), Aleph::Tikz_Plane::compute_mapping(), compute_maximum_cardinality_general_matching(), compute_maximum_weight_general_matching(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::compute_min_paths_tree(), Aleph::Dijkstra_Min_Paths< GT, Distance, Itor, SA, HeapT >::compute_min_paths_tree(), compute_minimum_cost_general_matching(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::compute_partial_min_paths_tree(), Aleph::Dijkstra_Min_Paths< GT, Distance, Itor, SA, HeapT >::compute_partial_min_paths_tree(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::compute_partial_path(), Aleph::Simplex< T >::compute_pivot_col(), Aleph::Simplex< T >::compute_pivot_row(), Aleph::Compiler_Dataflow_Detail::compute_reachability(), Aleph::Compiler_SSA_Detail::compute_reachable_blocks(), compute_shortest_path_funnel_trace(), Aleph::CA::ca_neighborhood_detail::compute_von_neumann_offsets(), concat(), Aleph::Compiler_Bytecode_Interpreter_Detail::constant_to_value(), Aleph::Filter_Iterator< Container, It, Show_Item >::container_set(), Aleph::OLhashTable< int >::contains(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::contains(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::contains(), Aleph::PatriciaSet< UInt >::contains(), Aleph::Triangle::contains(), Aleph::Rectangle::contains(), QuadNode::contains(), QuadTree::contains(), Aleph::Tetrahedron::contains(), Aleph::Segment::contains(), Aleph::Source_Span::contains(), Aleph::Naive_Suffix_Tree::contains(), Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::contains(), Aleph::Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::contains(), Aleph::Interval< T >::contains(), Aleph::AhArenaAllocator::contains(), Aleph::Aho_Corasick::contains_any(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains_in(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::contains_in(), QuadTree::contains_only(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::content(), Aleph::Gen_Polynomial< Coefficient >::content(), Aleph::GenLinearHashTable< Key, BucketType, Cmp >::contract(), Aleph::detail::copy_file_contents(), OhashCommon< HashTbl, Key >::copy_from_table(), QuadTree::copy_tree(), Aleph::MCF_Arc< Arc_Info, FT >::cost(), Aleph::Network_Simplex< Net >::count_non_tree_partial_arcs(), Aleph::timsort_detail::count_run_and_make_ascending(), Aleph::IO_Graph< GT, Load_Node, Store_Node, Load_Arc, Store_Arc, NF, AF >::count_shown_arcs(), counting_sort(), covariance(), Aleph::CA::Bench::cpu_string(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::create_p(), create_residual_arc(), create_residual_arc(), csv_filter_by_value(), csv_find_by_value(), csv_group_by(), csv_read_all(), csv_read_row(), csv_skip_bom(), csv_trim_fields(), Aleph::Dlink::cut_list(), Aleph::Compute_Cut_Nodes< GT, SA >::cut_nodes(), Aleph::Compute_Cut_Nodes< GT, SA >::cut_nodes(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::cycle_of_predecessors(), Aleph::negative_cycles_detail::cyclic_core(), Aleph::Compiler_Semantic_Analyzer::declare_symbol(), Aleph::Compiler_Bytecode_Detail::decode_escape_string(), decompose_flow(), Aleph::MonotonePolygonTriangulation::decompose_to_monotone_faces(), Aleph::Fibonacci_Heap< T, Compare >::decrease_key(), Aleph::Fibonacci_Heap< T, Compare >::decrease_key(), Aleph::eulerian_detail::degree(), Aleph::Dlink::Iterator::del(), Aleph::Dlink::del(), Aleph::Dlink::Iterator::del_ne(), demo_cache_filter(), demo_density(), demo_practical(), demo_prefix_search(), demo_set_operations(), demo_simple_bloom_filter(), demo_spell_checker(), demo_trie_structure(), Aleph::Gen_Link_Cut_Tree< T, Monoid, LazyTag >::destroy_vertex(), Aleph::tree_node_detail::detach_tree(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::detect_negative_cycle(), Aleph::Depth_First_Backtracking< Domain >::dfs_visited(), Aleph::CuttingEarsTriangulation::diagonal(), Aleph::CuttingEarsTriangulation::diagonalize(), Aleph::RotatingCalipersConvexPolygon::diameter(), Aleph::in_arcs_detail::digraph_in_degree(), dinic_maximum_flow(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::disconnect_arc(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::disconnect_arc(), Weighted_Graph::distances_from(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::do_compute(), graph_oracles::dominance_frontiers(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::dominance_frontiers(), graph_oracles::dominators(), Aleph::Gen_Avl_Tree< NodeType, Key, Compare >::doubleRotateLeft(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateLeft(), Aleph::Gen_Avl_Tree< NodeType, Key, Compare >::doubleRotateRight(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateRight(), Aleph::knapsack_detail::dp_add(), Aleph::FFT< Real >::ISTFTProcessor::drain_ready_samples(), Aleph::Tikz_Plane::draw_cartesian_axis(), Aleph::Tikz_Plane::draw_coordinate_grid(), Aleph::Tikz_Plane::draw_line_eq(), Aleph::Tikz_Plane::draw_options(), drop_while(), dsatur_coloring(), Aleph::Simplex< T >::dual_solve(), Aleph::ConstrainedDelaunayTriangulation::edge_opposite(), Aleph::FFT< Real >::effective_coeff_length(), eliminate_dead_code(), Aleph::TestVisual::emit_case_svg(), Aleph::Compiler_C_Backend::Emitter::emit_constant_expression(), Aleph::FFT< Real >::STFTProcessor::emit_ready_frames(), Aleph::FFT< Real >::ISTFTProcessor::emit_samples(), Aleph::ThreadPool::enqueue(), Aleph::ThreadPool::enqueue_batch(), Aleph::ThreadPool::enqueue_detached(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::ensure_child_has_extra(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::ensure_child_has_extra(), Aleph::Lengauer_Tarjan_Dominators< GT, SA >::ensure_computed(), eppstein_k_shortest_paths(), eq(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::equal(), Aleph::Matrix< Trow, Tcol, NumType >::equal_to(), Aleph::GenTdRbTree< NodeType, Key, Compare >::equals(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), Aleph::HtdRbTreeRk< Key, Compare >::equals(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::equals(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::equals(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::equals_key(), Aleph::detail::equiv(), Aleph::RadixTree< T, Char >::erase(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::erase(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::erase_descend(), Aleph::PersistentHashMap< Key, T, Cmp >::erase_impl(), Aleph::Bloom_Filter< T >::estimate(), Aleph::Compact_Quotient_Filter< T >::estimate(), Aleph::Quotient_Filter< T >::estimate(), graph_oracles::euler_class(), Aleph::Compiler_Dataflow_Detail::evaluate_binary(), Aleph::Interpreter_Runtime::evaluate_expr(), Graph_Traverse< GT, Itor, Q, Show_Arc >::exec(), Aleph::Compiler_Bytecode_VM::execute_host_call(), Aleph::Compiler_Bytecode_VM::execute_loop(), Aleph::MemArray< T >::expand(), Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA >::expand_frontier(), export_network_to_dot(), Aleph::Gen_Link_Cut_Tree_WithEdges< VT, ET, EdgeMonoid, LazyTag >::export_to_tree_node(), Aleph::Suffix_Automaton::extend(), Aleph::Bounded_Cycle_Index< GT >::extend(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::extract_max_rb(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::extract_min_rb(), Aleph::FFT< Real >::extract_repeated_unit_roots(), extrapolate_left(), extrapolate_right(), Aleph::Gen_Polynomial< Coefficient >::factor_mod_p(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::factor_recombination(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::factorize(), Aleph::Gen_Polynomial< Coefficient >::factorize(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::fails_component_euler_bound(), Aleph::Packed_Row< Cols >::fast_make(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::faster_paint_spanning_tree(), file_to_dynarrays(), Aleph::net_detail::fill_infinite_path(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::filled(), Aleph::RadixTree< T, Char >::find(), Aleph::RadixTree< T, Char >::find(), Aleph::PatriciaMap< UInt, T >::find(), Aleph::PatriciaMap< UInt, T >::find(), Aleph::Naive_Suffix_Tree::find_all(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::find_augmenting_path(), find_breadth_first_spanning_tree(), TimeoutQueue::find_by_id(), Aleph::TrapezoidalMapPointLocation::find_crossed_trapezoids(), Aleph::ConstrainedDelaunayTriangulation::find_crossing_edges(), find_disjoint_negative_cycles(), Aleph::Network_Simplex< Net >::find_entering_arc(), find_if(), Aleph::Network_Simplex< Net >::find_lca(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::find_leaf(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::find_leaf_page(), Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA >::find_path(), Aleph::Find_Path_Breadth_First< GT, Itor, SA >::find_path(), find_path_breadth_first(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record(), Aleph::Gen_File_BPlus_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::find_record(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::find_simplified_edge_id(), Aleph::ShortestPathInPolygon::find_sleeve(), find_test(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::finish_test(), Aleph::FFT< Real >::firls_impl(), Aleph::Diagnostic_Engine::first_primary_label(), Aleph::CA::Reproductions::fit_log_log_histogram(), Aleph::packed_matrix_detail::fits_in_int64(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_condition(), Aleph::Gen_Rb_Tree< NodeType, Key, Compare >::fix_red_condition(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::fix_red_violation(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::fix_underflow(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::fix_underflow(), Aleph::GenTdRbTree< NodeType, Key, Compare >::flipColors(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::flipColors(), Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::flush(), Aleph::FFT< Real >::OverlapAddBank::flush(), Aleph::Tikz_Plane::fmt_double(), Aleph::NTT< MOD, ROOT >::Plan::for_each_index(), Aleph::GeomTriangleAdjacencyUtils::for_each_sorted_edge_group(), graph_harness::for_each_spec(), Aleph::Network_Simplex< Net >::force_partial_arcs_into_tree(), forest_to_bin(), Aleph::Filter_Iterator< Container, It, Show_Item >::forward(), Aleph::graph_dry_detail::In_Arcs_Walk< GT, SA >::forward(), Aleph::FFT< Real >::frame_offsets_impl(), Aleph::Huffman_Encoder_Engine::free_inner_nodes(), Aleph::SweepLineSegmentIntersection::StatusTree::fresh_label_between(), Aleph::MonotonePolygonTriangulation::EdgeStatusTree::fresh_label_between(), Aleph::Compact_Quotient_Filter< T >::from_capacity(), Aleph::Quotient_Filter< T >::from_capacity(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::from_json(), Aleph::timsort_detail::gallop_left(), Aleph::timsort_detail::gallop_right(), generate_curve(), Aleph::k_shortest_paths_detail::generate_general_deviation_candidates(), generate_layered_network(), generate_tree(), generate_tree(), generate_tree_graphviz(), Aleph::SkipList< Key, Type >::generateRandomLevel(), generic_preflow_vertex_push_maximum_flow(), Aleph::Hungarian_Assignment< Cost_Type >::get_assignments(), Aleph::Dlink::Iterator::get_curr_ne(), Aleph::Slink_Nc::Iterator::get_curr_ne(), Aleph::Dial_Min_Paths< GT, Distance, Itor, SA >::get_distance(), Aleph::Shortest_Path_Base< GT, Distance, Itor, SA, HeapT >::get_distance(), Aleph::Matrix< Trow, Tcol, NumType >::get_entry(), Aleph::Matrix< Trow, Tcol, NumType >::get_entry(), Aleph::GiftWrappingConvexHull::get_lowest_point(), Aleph::Zero_One_BFS< GT, Distance, Itor, SA >::get_min_path(), Aleph::Dlink::get_next(), Aleph::Hungarian_Result< Cost_Type >::get_pairs(), get_partial_arcs(), Aleph::Dlink::get_prev(), Aleph::DynSlist< T >::get_previous_to_pos(), Aleph::PersistentVector< T >::get_ptr(), Aleph::Polar_Point::get_quadrant(), Aleph::QuickHull::get_right_points(), get_token(), Aleph::ArenaTreeAllocator< Node >::give_back(), Aleph::Dfs_Stack< T >::give_room_back(), Aleph::TestVisual::golden_output_dir(), Aleph::Out_Iterator< GT, Show_Arc >::goto_first_valid(), Aleph::In_Iterator< GT, SA >::goto_first_valid(), Aleph::Filter_Iterator< Container, It, Show_Item >::goto_first_valid_item(), Aleph::Out_Iterator< GT, Show_Arc >::goto_last_valid(), Aleph::In_Iterator< GT, SA >::goto_last_valid(), Aleph::Filter_Iterator< Container, It, Show_Item >::goto_last_valid_item(), Aleph::GenTdRbTree< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTree< NodeType, Key, Compare >::gotoRightAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), has_constrained_edge(), has_curr(), Aleph::Array_Iterator< T >::has_curr(), Aleph::Dlink::Iterator::has_curr(), OhashCommon< HashTbl, Key >::Iterator::has_curr(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::has_curr(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::has_curr(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::Iterator::has_curr(), Aleph::In_Arcs_Index< GT, SA >::Iterator::has_curr(), Aleph::GenLhashTable< Key, BucketType, Cmp >::Iterator::has_curr(), Aleph::BinTreeXt_Iterator< TreeType, Node, Key, Compare >::has_curr(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::has_curr(), Aleph::Path< GT >::Iterator::has_current_arc(), QuadTree::has_four_leaf_children(), Aleph::Bounded_Cycle_Index< GT >::has_length(), Aleph::CsvReader::has_next(), Aleph::Bloom_Filter< T >::have_same_hashes(), Aleph::Gen_Polynomial< Coefficient >::hensel_lift(), hlpp_maximum_flow(), hopcroft_karp_matching(), graph_oracles::hops(), hungarian_max_assignment(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::ideals_equal(), Aleph::FFT< Real >::iir_filter_impl(), graph_oracles::immediate_dominators(), import_network_from_dimacs(), Aleph::CuttingEarsTriangulation::in_cone(), Aleph::Ellipse::in_unit_interval(), includes(), inconnected_components(), Aleph::net_detail::infinite_arc_preflow(), Aleph::FFT< Real >::initialize_root_guesses(), inOrderThreaded(), Aleph::Path< GT >::insert(), Aleph::GenLhashTable< Key, BucketType, Cmp >::insert(), Aleph::PatriciaSet< UInt >::insert(), Aleph::Dlink::insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert(), GenTdSplayTreeRk< NodeType, Key, Compare >::insert(), Aleph::SkipList< Key, Type >::insert(), GenTdSplayTree< NodeType, Key, Compare >::insert(), Aleph::Gen_Rand_Tree< NodeType, Key, Compare >::insert(), Aleph::Gen_Rb_Tree< NodeType, Key, Compare >::insert(), Aleph::GenTdRbTree< NodeType, Key, Compare >::insert(), Aleph::List_SGraph< __Graph_Node, __Graph_Arc >::insert_arc(), Aleph::Net_Graph< NodeT, ArcT >::insert_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc(), Aleph::pdq_detail::insert_back(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::insert_descend(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::insert_dup(), GenTdSplayTreeRk< NodeType, Key, Compare >::insert_dup(), GenTdSplayTree< NodeType, Key, Compare >::insert_dup(), Aleph::Gen_Rand_Tree< NodeType, Key, Compare >::insert_dup(), Aleph::Gen_Rb_Tree< NodeType, Key, Compare >::insert_dup(), Aleph::GenTdRbTree< NodeType, Key, Compare >::insert_dup(), Aleph::PatriciaMap< UInt, T >::insert_impl(), Aleph::PersistentHashMap< Key, T, Cmp >::insert_impl(), Pointer_Table::insert_in_free_table(), Aleph::Gen_File_B_Map< Key, Value, Compare, MinDegree, KeyCodec, ValueCodec >::insert_or_assign(), Aleph::PersistentTreapMap< Key, T, Compare >::insert_or_assign_rec(), insert_sorted(), Aleph::Naive_Suffix_Tree::insert_suffix(), Aleph::Prefix_Tree::insert_word(), insertion_sort(), insertion_sort(), Aleph::AABBTree::insertion_sort_by_center(), insertion_sort_range(), Aleph::bucket_sort_detail::insertion_sort_range(), Aleph::CA::inspect_checkpoint(), Aleph::Compiler_Typed_Semantic_Analyzer::instantiate_type(), Aleph::Compiler_Dataflow_Detail::instruction_is_trivially_dead(), interpolate(), interpreter_values_equal(), Aleph::Rectangle::intersects(), Aleph::Segment::intersects_properly_with(), Pointer_Table::invariant(), Aleph::FFT< Real >::inverse_transform_real_optimized_impl(), invert_digraph(), Aleph::MonotonePolygonTriangulation::is_above(), Aleph::Is_Graph_Acyclique< GT, SA >::is_acyclique(), Aleph::lca_detail::Rooted_Tree_Data< GT, SA >::is_ancestor(), Aleph::Gen_Heavy_Light_Decomposition< GT, SA >::is_ancestor_id(), Aleph::Simplex< T >::is_artificial(), Aleph::Point::is_between(), Aleph::FFT< Real >::PoleZeroPair::is_cancellation(), Aleph::Gen_Polynomial< Coefficient >::is_constant(), is_double(), Aleph::Dlink::is_empty(), Aleph::MpscQueue< T >::is_empty(), Moved_From_Case< AABBTree >::is_empty(), Moved_From_Case< Aho_Corasick >::is_empty(), Moved_From_Case< Async_Life >::is_empty(), Moved_From_Case< Bit_Cell_Storage< 2 > >::is_empty(), Moved_From_Case< Centroid_Decomposition< Graph > >::is_empty(), Moved_From_Case< Cartesian_Tree< int > >::is_empty(), Moved_From_Case< Collector >::is_empty(), Moved_From_Case< CsvReader >::is_empty(), Moved_From_Case< Tree_DP< Graph, long > >::is_empty(), Moved_From_Case< Dense_Cell_Storage< int, 2 > >::is_empty(), Moved_From_Case< Density >::is_empty(), Moved_From_Case< Euler_Tour_LCA< int > >::is_empty(), Moved_From_Case< Floyd_All_Shortest_Paths< Dgraph > >::is_empty(), Moved_From_Case< F::ISTFTProcessor >::is_empty(), Moved_From_Case< F::LFilter >::is_empty(), Moved_From_Case< F::OverlapAdd >::is_empty(), Moved_From_Case< F::OverlapAddBank >::is_empty(), Moved_From_Case< F::OverlapSave >::is_empty(), Moved_From_Case< F::PartitionedConvolver >::is_empty(), Moved_From_Case< F::SOSFilter >::is_empty(), Moved_From_Case< F::STFTProcessor >::is_empty(), Moved_From_Case< Field_Grid >::is_empty(), Moved_From_Case< Field_Life >::is_empty(), Moved_From_Case< Ghost_Grid >::is_empty(), Moved_From_Case< Graph_Lattice< int > >::is_empty(), Moved_From_Case< Graph_Life >::is_empty(), Moved_From_Case< HLD_Sum< Graph, int > >::is_empty(), Moved_From_Case< Heavy_Light_Decomposition< Graph > >::is_empty(), Moved_From_Case< Hungarian_Assignment< long > >::is_empty(), Moved_From_Case< Hashlife_Engine >::is_empty(), Moved_From_Case< Binary_Lifting_LCA< Graph > >::is_empty(), Moved_From_Case< Euler_RMQ_LCA< Graph > >::is_empty(), Moved_From_Case< Li_Chao_Tree< long > >::is_empty(), Moved_From_Case< Life >::is_empty(), Moved_From_Case< Distinct_Count_Mo_On_Trees< Graph > >::is_empty(), Moved_From_Case< Distinct_Count_Mo_On_Tree_Node< int > >::is_empty(), Moved_From_Case< Naive_Suffix_Tree >::is_empty(), Moved_From_Case< Parallel_Life >::is_empty(), Moved_From_Case< PersistentHashMap< int, int > >::is_empty(), Moved_From_Case< PersistentVector< int > >::is_empty(), Moved_From_Case< Pointer_Table >::is_empty(), Moved_From_Case< HLD_Path_Query< Graph, int, Aleph::plus< int > > >::is_empty(), Moved_From_Case< Reroot_DP< Graph, long > >::is_empty(), Moved_From_Case< Rand_Tree< int > >::is_empty(), Moved_From_Case< Random_Life >::is_empty(), Moved_From_Case< RangeTree2D >::is_empty(), Moved_From_Case< Simplex< double > >::is_empty(), Moved_From_Case< RevisedSimplex< double > >::is_empty(), Moved_From_Case< Suffix_Automaton >::is_empty(), Moved_From_Case< Sum_Disjoint_Sparse_Table< int > >::is_empty(), Sparse_Table_Case< Table >::is_empty(), Moved_From_Case< Tiles >::is_empty(), Ordered_Tree_Case< Tree >::is_empty(), graph_oracles::is_euler_walk(), is_float(), Aleph::ThreadPool::is_idle(), Aleph::BinNodeInfixIterator< Node >::is_in_first(), Aleph::Killer_Move_Table< Move, true >::is_killer(), Aleph::Array_Iterator< T >::is_last(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::Node_Arc_Iterator::is_last(), Aleph::BinNodeInfixIterator< Node >::is_last(), Aleph::Rope< Char, LeafSize >::Node::is_leaf(), is_leaf(), Aleph::Gen_Cartesian_Tree< T, Comp >::is_leaf(), is_leap_year(), Aleph::Gen_Link_Cut_Tree< T, Monoid, LazyTag >::is_left(), Aleph::Gen_Polynomial< Coefficient >::is_monic(), Aleph::Bounded_Cycle_Result< GT, Cost_Type >::is_negative(), Aleph::Short_Cycle_Result< GT, Cost_Type >::is_negative(), graph_oracles::is_negative_cycle(), Aleph::FFT< Real >::is_one_sided_interior_bin(), Aleph::Network_Simplex< Net >::is_partial_flow(), Aleph::ConvexPolygonDecomposition::is_polygon_edge(), Aleph::FFT< Real >::is_power_of_two(), Aleph::NTT< MOD, ROOT >::is_power_of_two(), Aleph::Compiler_Dataflow_Detail::is_pure_instruction(), Event_Table< Signature >::is_registered(), Event_Table< void *(void *)>::is_registered(), Aleph::Gen_Link_Cut_Tree< T, Monoid, LazyTag >::is_root(), Aleph::Compact_Quotient_Filter< T >::is_run_start(), Aleph::Quotient_Filter< T >::is_run_start(), is_subsequence(), is_there_a_double_arc(), is_treap(), is_two_power(), Aleph::Dlink::is_unitarian(), Aleph::HTList::is_unitarian(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::is_updated(), Aleph::Source_Span::is_valid(), Pointer_Table::is_valid_index(), RingFileCache< T >::is_valid_position(), Aleph::detail::PersistentTreapNodeOps< Node, Key, Compare >::is_valid_under(), Aleph::Compiler_Dataflow_Detail::is_value_used(), Aleph::MonotonePolygonTriangulation::is_y_monotone(), Aleph::Matrix< Trow, Tcol, NumType >::is_zero(), Aleph::FFT< Real >::istft_impl(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join(), join(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_left(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_left_rb(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_right(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::join_right_rb(), Aleph::Random_Graph< GT, Init_Node, Init_Arc >::join_through_a_node(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::join_through_a_path(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_with_pivot(), graph_oracles::kahn_ranks(), Aleph::min_mean_cycle_detail::karp_answer(), Aleph::howard_detail::karp_by_component(), Aleph::min_mean_cycle_detail::karp_solve(), Aleph::min_mean_cycle_detail::karp_sums(), Aleph::min_mean_cycle_detail::karp_table(), kmp_prefix_function(), kmp_search(), knapsack_01_value(), knapsack_bounded(), knapsack_unbounded(), Aleph::Simplex< T >::latex_matrix(), Aleph::ConstrainedDelaunayTriangulation::lawson_flip(), lazy_post_order(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::lca(), lcp_array_kasai(), Aleph::patricia_trie_detail::Bitwise_Trie_Utils< UInt >::leaf_for(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::leftmost_leaf(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::leftmost_leaf_page(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::less(), lesser(), Aleph::Compiler_Lexer::lex_block_comment(), Aleph::Compiler_Lexer::lex_char_literal(), Aleph::Compiler_Lexer::lex_identifier_or_keyword(), Aleph::Compiler_Lexer::lex_line_comment(), Aleph::Compiler_Lexer::lex_number(), Aleph::Compiler_Lexer::lex_punctuation_or_operator(), Aleph::Compiler_Lexer::lex_token(), lexicographical_compare(), Aleph::Gen_Binary_Lifting_LCA< GT, SA >::lift(), Aleph::Source_Manager::line_end_offset(), load_distance_option(), load_octal_number(), Aleph::CA::Hashlife_Engine::load_rle(), load_string(), longest_common_subsequence(), Aleph::Suffix_Automaton::longest_common_substring(), lower_bound(), lower_bound(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::lower_bound_index(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::lower_bound_index(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_expr(), Aleph::Compiler_HIR_Lowering::lower_function(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_function_body(), Aleph::Compiler_SSA_Lowering::lower_function_internal(), Aleph::Compiler_CFG_Lowering::lower_statement_sequence(), Aleph::Compiler_IR_Lowering::Module_Builder::lower_stmt(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::lowest(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::lset_get_best_blossom_edge(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::lset_merge_blossoms(), Aleph::CA::ca_gif_detail::lzw_bytes(), main(), main(), main(), main(), Aleph::Compiler_Bytecode_VM::make_error(), Aleph::Random_Digraph< GT, Init_Node, Init_Arc >::make_eulerian(), Aleph::CA::make_path_graph_adjacency(), manacher(), map_arcs(), Aleph::ConstrainedDelaunayTriangulation::map_constraints(), map_cut_graph(), Aleph::Compute_Cut_Nodes< GT, SA >::map_cut_graph(), map_nodes(), Aleph::Compiler_Dataflow_Detail::mark_value_used(), Aleph::FlatMap< Key, T, Compare >::match_at(), Aleph::FlatSet< Key, Compare >::match_at(), graph_oracles::max_flow(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_in(), graph_oracles::max_matching(), Aleph::min_mean_cycle_detail::mean_order(), merge(), merge(), merge(), Aleph::timsort_detail::merge_collapse(), Aleph::timsort_detail::merge_force_collapse(), Aleph::timsort_detail::merge_hi(), merge_lists(), Aleph::timsort_detail::merge_lo(), Aleph::Compiler_Driver::merge_modules_from_order(), Aleph::Compiler_MVP_Frontend::merge_modules_from_order(), Aleph::parallel_detail::merge_sequential(), min_cut(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_in(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree(), min_weighted_squared_distance_1d(), Aleph::FFT< Real >::minimum_cancellation_distance_impl(), Aleph::howard_detail::minimum_mean_cycle(), Aleph::RotatingCalipersConvexPolygon::minimum_width(), mismatch(), monotone_queue_min_dp(), most_negative_cycle_bounded(), most_negative_cycle_up_to_3(), Aleph::FFT< Real >::multiply_complex_impl(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::multiply_overflows(), Aleph::FFT< Real >::multiply_real_optimized(), Aleph::Compiler_Type_Context::mutable_type(), Aleph::CA::Kernel2D< T, Rows, Cols >::neighbour_weight(), network_to_dot_string(), Aleph::Find_Depth_First_Spanning_Tree< GT, SA >::Frame::next_target(), Aleph::Build_Subgraph< GT, SA >::Arc_Frame::next_target(), nibble_to_char(), nonplanar_certificate_to_dot(), nonplanar_certificate_to_gexf(), nonplanar_certificate_to_graphml(), Aleph::MinkowskiSumConvex::normalize(), Aleph::Compiler_SSA_Detail::normalize_ir_function(), Aleph::ConvexPolygonIntersectionBasic::normalize_vertices(), Aleph::HalfPlaneIntersection::normalize_vertices(), Aleph::cancellation_detail::Exact_State::notify_locked_observers(), Aleph::Gen_Polynomial< Coefficient >::nth_derivative(), Aleph::df_tree_detail::number_tree(), Aleph::negative_cycles_detail::odd_significand(), Aleph::negative_cycles_detail::Best_Cycle< Cost_Type >::offer(), Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::offer(), Aleph::Compiler_Driver::ok(), Aleph::Compiler_Generic_Driver::ok(), graph_oracles::on_cycle(), Aleph::CA::Density_Observer< State >::on_step_begin(), Aleph::CA::Entropy_Observer< MaxState >::on_step_begin(), Aleph::CA::Stationary_Detector::on_step_begin(), Aleph::CA::Sampling_Observer< Lattice >::on_step_begin(), Aleph::CA::Stationary_Detector::on_step_end(), only_alpha(), Aleph::Initialize_Dist< AM, Compare >::operator()(), Aleph::k_shortest_paths_detail::Filtered_Show_Arc< GT, SA >::operator()(), Aleph::logical_and< _Tp >::operator()(), Aleph::HalfPlaneIntersection::operator()(), Aleph::SweepLineSegmentIntersection::operator()(), Aleph::CA::BBM_Rule::operator()(), Aleph::CA::TM_Gas_Rule::operator()(), Aleph::DelaunayTriangulationRandomizedIncremental::operator()(), Aleph::GiftWrappingConvexHull::operator()(), Aleph::ConstrainedDelaunayTriangulation::operator()(), Aleph::AlphaShape::operator()(), Aleph::Invert_Digraph< GT, SA >::operator()(), Aleph::MinkowskiSumConvex::operator()(), Aleph::ConvexPolygonDecomposition::operator()(), Aleph::VisibilityPolygon::operator()(), Aleph::ShortestPathInPolygon::operator()(), Aleph::BruteForceConvexHull::CmpSegment::operator()(), Aleph::CA::Game_Of_Life_Functor::operator()(), InitArc::operator()(), Aleph::Build_Grid< GT, Operation_On_Node, Operation_On_Arc >::operator()(), Aleph::Compare_Tnode< Tlink, Tnode, T, Compare >::operator()(), Aleph::Dft_Arc_Cmp< GT >::operator()(), Graph_Traverse< GT, Itor, Q, Show_Arc >::operator()(), Graph_Traverse< GT, Itor, Q, Show_Arc >::operator()(), Polinomio::operator+=(), Aleph::Point::operator<(), Aleph::RingBuffer< T >::basic_iterator< IsConst >::operator==(), Aleph::BinTreeXt_Iterator< TreeType, Node, Key, Compare >::operator==(), Coord::operator==(), Aleph::Ellipse::operator==(), Aleph::FlatMap< Key, T, Compare >::operator==(), Aleph::FlatSet< Key, Compare >::operator==(), Foo::operator==(), Aleph::Gen_Polynomial< Coefficient >::operator==(), Aleph::CA::History_Cell< State, Depth >::operator==(), Aleph::Interval< T >::operator==(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::operator==(), Aleph::LineEq::operator==(), Aleph::Aho_Corasick::Match::operator==(), Aleph::CA::ca_hashlife_detail::Node_Key::operator==(), Aleph::Point::operator==(), Aleph::Point3D::operator==(), Aleph::CA::Reaction_Diffusion_Cell< Real >::operator==(), Aleph::Rectangle::operator==(), Aleph::Rope< Char, LeafSize >::operator==(), Aleph::RotatedEllipse::operator==(), Aleph::Segment::operator==(), Aleph::Segment3D::operator==(), Aleph::StlEnumerateIterator< Container >::operator==(), Aleph::StlZipIterator< Containers >::operator==(), Aleph::AssignLazyTag< T >::tag_type::operator==(), Aleph::Triangle::operator==(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::overlap_search(), Aleph::Interval< T >::overlaps(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::page(), Aleph::Johnson< GT, Distance, Ait, NAit, SA >::paint(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::paint_min_paths_tree(), Aleph::Dijkstra_Min_Paths< GT, Distance, Itor, SA, HeapT >::paint_min_paths_tree(), Aleph::Kruskal_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::paint_min_spanning_tree(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::paint_partial_min_paths_tree(), Aleph::Dijkstra_Min_Paths< GT, Distance, Itor, SA, HeapT >::paint_partial_min_paths_tree(), Aleph::AStar_Min_Path< GT, Distance, Heuristic, Itor, SA, HeapT >::paint_partial_path(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::paint_spanning_tree(), Aleph::planarity_detail::pair_empty(), Aleph::Compiler_Typed_Semantic_Analyzer::parameter_type(), parse_connexion(), parse_graph_definition(), Aleph::CA::Hashlife_Engine::parse_header_value(), Aleph::Compiler_Bytecode_Detail::parse_integer(), Aleph::Compiler_Line_Frontend::parse_integer(), Aleph::Compiler_Backend_C_Detail::parse_integer_literal(), Aleph::CA::ca_io_detail::parse_json_number(), Aleph::CA::ca_io_detail::parse_json_size_field(), Aleph::Compiler_Parser::parse_parenthesized_type(), Aleph::Compiler_Parser::parse_return_statement(), Aleph::CA::parse_rule(), Aleph::CA::Hashlife_Engine::parse_rule_field(), Aleph::Compiler_Parser_Stream::parse_separated_list(), Aleph::Compiler_Line_Frontend::parse_source_file(), Aleph::pdq_detail::partition_by_blocks(), Aleph::pdq_detail::partition_by_branches(), Aleph::pdq_detail::partition_left(), Aleph::FFT< Real >::pbatched_stft(), Aleph::NTT< MOD, ROOT >::pbigint_multiply(), Aleph::Topological_Sort< GT, Itor, SA >::perform(), Aleph::FFT< Real >::OverlapAddBank::pflush(), Aleph::FFT< Real >::phase_margin_impl(), Aleph::FFT< Real >::phase_margin_refined_impl(), Aleph::Network_Simplex< Net >::pivot_tree(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::place(), Aleph::negative_cycles_detail::Short_Cycle_Best< Cost_Type >::plain_sum(), planar_dual_metadata(), planar_geometric_drawing(), Aleph::DelaunayTriangulationRandomizedIncremental::point_in_tri(), Aleph::ShortestPathInPolygon::point_in_triangle(), Aleph::FFT< Real >::OverlapAdd::pointwise_multiply(), Aleph::FFT< Real >::OverlapAddBank::pointwise_multiply_batch(), Aleph::detail::pollard_rho_step(), Aleph::NTT< MOD, ROOT >::poly_power(), Aleph::NTT< MOD, ROOT >::poly_scalar_mul_series(), Aleph::NTT< MOD, ROOT >::poly_sqrt(), polygon_from_vertex_indices(), polygon_from_vertices(), Aleph::PersistentVector< T >::pop_back(), positions_of(), precompute_x_for_node(), preorder_to_bst(), preOrderThreaded(), Aleph::NTTExact::prime_supports_product_size(), Aleph::Network_Simplex< Net >::print_diagnostics(), Aleph::Negamax< Domain >::probe_transposition(), process_node(), Aleph::CA::Dense_Cell_Storage< T, N >::product(), proper_intersection(), Aleph::FFT< Real >::Plan::ptransform_batch(), put_portals(), put_segment_arrangement_result(), Aleph::Li_Chao_Tree< T >::query_impl(), Aleph::Gen_Segment_Tree< T, Op >::query_impl(), Aleph::Gen_Lazy_Segment_Tree< Policy >::query_impl(), Aleph::Segment_Tree_Beats< T >::query_max_impl(), Aleph::Segment_Tree_Beats< T >::query_min_impl(), Aleph::Convex_Hull_Trick< T >::query_monotone(), Aleph::RangeTree2D::query_range(), Aleph::Segment_Tree_Beats< T >::query_sum_impl(), quicksort_insertion(), Aleph::CA::ca_dot_detail::quote_id_if_needed(), rabin_karp_search(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::radical_member(), radix_sort(), random_select(), graph_harness::random_spec(), RingFileCache< T >::read_from(), RingFileCache< T >::read_from(), Aleph::CA::read_json_snapshot(), Aleph::CA::read_life_105(), Aleph::CA::read_life_106(), Aleph::CA::read_rle(), Aleph::FFT< Real >::recommended_cache_tile_size(), Aleph::NTTExact::reconstruct_product(), Aleph::Killer_Move_Table< Move, true >::record(), Aleph::Compiler_Typed_Semantic_Analyzer::record_param_type(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_from_wal(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::recover_from_wal(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::recover_if_needed(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::recover_if_needed(), red_black_height_rk(), Aleph::Gen_MultiPolynomial< Coefficient, MonomOrder >::redundant_pair_by_chain_criterion(), Aleph::FFT< Real >::refine_scalar_crossing(), Aleph::Net_Graph< NodeT, ArcT >::register_ends_of_leaving(), Aleph::Bellman_Ford< GT, Distance, Ait, NAit, SA >::relaxes(), Aleph::detail::Pid_File_Lock::release(), Aleph::MemArray< T >::relocate_and_insert(), Aleph::FFT< Real >::remez_impl(), Aleph::GenLhashTable< Key, BucketType, Cmp >::remove(), Aleph::Range_Mode_Policy< T >::remove(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::remove(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::remove(), Aleph::Gen_Treap< NodeType, Key, Compare >::remove(), Aleph::SkipList< Key, Type >::remove(), QuadTree::remove(), Aleph::Compact_Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::remove(), Aleph::Cuckoo_Filter< T, FingerprintBits, EntriesPerBucket >::remove(), Aleph::Compact_Quotient_Filter< T >::remove(), Aleph::Quotient_Filter< T >::remove(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::remove_from(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from(), Aleph::GenBinHeap< NodeType, Key, Compare >::remove_last(), Aleph::Index_Graph< GT, Compare, Tree >::remove_node(), Pointer_Table::remove_pointer(), Aleph::Compiler_Driver_Detail::render_messages(), Aleph::Compiler_Bytecode_Context::reset(), Aleph::Compiler_Ast_Context::reset(), Aleph::Compiler_CFG_Context::reset(), Aleph::Compiler_HIR_Context::reset(), Aleph::Compiler_IR_Context::reset(), Aleph::Compiler_SSA_Context::reset(), Aleph::Slink_Nc::Iterator::reset_first(), Aleph::Dlink::Iterator::reset_first(), Aleph::Dlink::Iterator::reset_last(), Aleph::GenLhashTable< Key, BucketType, Cmp >::resize(), Aleph::Compiler_Driver::resolve_import_order(), Aleph::Compiler_Line_Frontend::resolve_import_order(), Aleph::Compiler_MVP_Frontend::resolve_import_order(), Aleph::Compiler_Module_Resolver_Detail::resolve_visit(), Aleph::GenTdRbTree< NodeType, Key, Compare >::restoreRedCondition(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition(), Aleph::net_detail::return_dust(), reverse(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::rightmost_leaf(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::rightmost_leaf_page(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::rstar_choose_overlap(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::rstar_split(), Aleph::Network_Simplex< Net >::run(), Aleph::Zero_One_BFS< GT, Distance, Itor, SA >::run_bfs(), Aleph::Dial_Min_Paths< GT, Distance, Itor, SA >::run_dial(), QueueTheadsPool< T >::run_event(), safe_atof(), safe_atol(), Aleph::Compiler_Bytecode_Detail::same_constant(), Aleph::HalfPlaneIntersection::same_direction(), Aleph::Compiler_Backend_C_Detail::sanitize_identifier(), graph_oracles::saturated_add(), save_level_pos_2(), graph_oracles::scc_partition(), Aleph::Aho_Corasick::search(), search(), Aleph::Tarjan_Connected_Components< GT, Itor, SA >::search(), Aleph::Find_Aumenting_Path< Net, Q >::search(), Aleph::Gen_Avl_Tree< NodeType, Key, Compare >::search_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_and_stack_rb(), Aleph::Gen_Rb_Tree< NodeType, Key, Compare >::search_and_stack_rb(), search_arc(), Aleph::Branch_And_Bound< Domain, ObjectivePolicy >::search_best_first(), search_directed_arc(), Aleph::Gen_Avl_Tree< NodeType, Key, Compare >::search_dup_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_avl(), search_n(), Aleph::GenLhashTable< Key, BucketType, Cmp >::search_or_insert(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::search_or_insert(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::search_or_insert(), Aleph::Gen_Rb_Tree< NodeType, Key, Compare >::search_or_insert(), Aleph::GenTdRbTree< NodeType, Key, Compare >::search_or_insert(), search_spanning_tree_arc(), Aleph::GenTdRbTree< NodeType, Key, Compare >::searchFlipColorsAndInsert(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), Aleph::GenTdRbTree< NodeType, Key, Compare >::searchFlipColorsAndInsertDup(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup(), searchInBinTree(), segment_intersection_point(), Aleph::planarity_detail::segments_properly_intersect(), select(), Aleph::RevisedSimplex< T >::select_leaving_variable(), select_ne(), Aleph::Dlink::Iterator::set(), Aleph::Slink_Nc::Iterator::set(), Aleph::CA::Hashlife_Engine::set_alive(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::set_auto_sync(), Aleph::Matrix< Trow, Tcol, NumType >::set_entry(), Aleph::ThreadPool::set_queue_limits(), Aleph::Net_Sup_Dem_Graph< NodeT, ArcT >::set_supply_flow(), TimeoutQueue::Event::set_trigger_time(), shellsort(), Aleph::Compact_Quotient_Filter< T >::shift_elements_left(), Aleph::Quotient_Filter< T >::shift_elements_left(), graph_oracles::shortest_distances(), Aleph::k_shortest_paths_detail::shortest_path_filtered(), Aleph::detail::shortest_path_portals(), Aleph::FFT< Real >::should_parallelize_batch_work(), Aleph::NTT< MOD, ROOT >::Plan::should_use_avx2(), Aleph::FFT< Real >::Plan::should_use_avx2(), Aleph::NTT< MOD, ROOT >::Plan::should_use_neon(), Aleph::FFT< Real >::Plan::should_use_neon(), OhashCommon< HashTbl, Key >::shrink_after_removal(), Aleph::arrayheap_detail::sift_down(), Aleph::arrayheap_detail::sift_up(), Aleph::GenBinHeap< NodeType, Key, Compare >::sift_up(), Aleph::Gen_Polynomial< Coefficient >::sign_variations(), Aleph::FFT< Real >::simd_preference(), Aleph::NTT< MOD, ROOT >::simd_preference(), Aleph::VisvalingamWhyattSimplification::simplify_open_array(), Aleph::VisvalingamWhyattSimplification::simplify_polygon(), Aleph::Compiler_Dataflow_Detail::simulate_block(), Aleph::CsvReader::skip(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::Iterator::skip_past_end(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::Iterator::skip_past_end(), Aleph::Compiler_Lexer::skip_whitespace(), Aleph::Rope< Char, LeafSize >::slice(), Aleph::SweepLineSegmentIntersection::slope_less(), adaptive_huffman_demo::snapshot(), Aleph::blossom_detail::Edmonds_Blossom_Matcher< GT, SA >::solve(), Aleph::Hungarian_Assignment< Cost_Type >::solve(), solve_circulation(), Aleph::pdq_detail::sort_loop(), sort_ranked_moves(), Aleph::planarity_detail::LR_Planarity_Checker< GT, SA >::sort_size_t_array(), Aleph::Source_Manager::span(), split_key(), Aleph::HTList::split_list(), Aleph::Dlink::split_list_ne(), Aleph::TrapezoidalMapPointLocation::split_multiple_trapezoids(), split_n(), Aleph::TrapezoidalMapPointLocation::split_single_trapezoid(), Aleph::random_detail::splitmix64_gives_the_numbers_of_its_reference(), Aleph::detail::spp_build_tris(), Aleph::detail::spp_find_sleeve(), Aleph::detail::spp_point_in_triangle(), ssp_init_potentials(), ssp_shortest_path(), Aleph::CA::Ffmpeg_Frame_Sink< Mapper >::start(), Aleph::CA::state_histogram(), std_zip(), stl_compare(), stl_drop_while(), stl_equal(), stl_range(), stl_zip_compare(), stl_zip_drop(), stl_zip_drop_while(), stl_zip_take(), stl_zip_to_pairs(), Aleph::search_engine_detail::stop_after_solution(), Aleph::CancellationToken::stop_requested(), Aleph::Gen_Polynomial< Coefficient >::sturm_sign_changes(), Aleph::Tikz_Plane::style_requires_patterns(), subset_sum(), subset_sum_count(), subset_sum_exists(), subset_sum_mitm(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingContext< WeightType >::substage_calc_dual_delta(), Aleph::howard_detail::Arithmetic< Cost_Type, true >::subtract_overflows(), Aleph::patricia_trie_detail::Bitwise_Trie_Utils< UInt >::subtree_matches(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::subtree_min(), successive_shortest_paths(), Aleph::FFT< Real >::Plan::supports_power_of_two_real_optimization(), Aleph::NTT< MOD, ROOT >::supports_power_of_two_size(), Aleph::NTTExact::supports_product_size(), Aleph::NTT< MOD, ROOT >::supports_root_order(), Aleph::NTT< MOD, ROOT >::supports_size(), Aleph::Dlink::swap(), Aleph::Gen_HLD< GT, T, Op, SA >::swap(), Aleph::Gen_HLD_Path_Query< GT, T, Op, SA >::swap(), Aleph::SmallVector< T, N >::swap(), hash_dry_detail::swap_compare(), swap_node_with_predecessor(), swap_node_with_successor(), Aleph::GenBinHeap< NodeType, Key, Compare >::swap_root_with_last(), Aleph::Compiler_Symbol_Bindings::symbol(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::sync(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::sync(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), Aleph::Compiler_Dataflow_Bit_Set::test(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), test_black_condition_rk(), test_DynSet(), test_DynSetLinHash(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), testResize(), Aleph::min_cost_matching_detail::to_ll_checked(), Aleph::Simplex< T >::to_pivot(), Aleph::NTT< MOD, ROOT >::tonelli_shanks(), Aleph::FFT< Real >::transform_axis_impl(), Aleph::FFT< Real >::Plan::transform_batch(), Aleph::FFT< Real >::transform_impl(), Aleph::FFT< Real >::transform_real_optimized(), Aleph::Graph_Traverse_Generator< GT, Itor, Q, Show_Arc >::traverse(), Aleph::in_arcs_detail::traverse_digraph_arcs_into(), Aleph::MonotonePolygonTriangulation::triangulate_monotone(), TimeoutQueue::triggerEvent(), Aleph::CA::ca_io_detail::trim_copy(), Aleph::Compiler_Line_Frontend::trim_copy(), Aleph::FFT< Real >::trim_leading_zeros_copy(), Aleph::Compiler_Line_Frontend::trim_quotes_copy(), Aleph::NTT< MOD, ROOT >::trim_trailing_zeros(), Aleph::NTT< MOD, ROOT >::truncate_poly(), Aleph::Array_Graph< __Graph_Node, __Graph_Arc >::try_insert_arc(), Aleph::Compiler_Type_Context::type(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST(), TYPED_TEST_P(), tzip(), tzip_longest(), tzipEq(), uni_compare(), uni_drop_while(), uni_equal(), uni_take(), Aleph::Gen_Interval_Tree< NodeType, T, Compare >::unlink(), Aleph::CancellationToken::ConditionVariableRegistration::unregister(), Aleph::detail::Pid_File_Lock::unregister_path(), Aleph::adaptive_huffman_detail::Model::update(), Aleph::Gen_Lazy_Segment_Tree< Policy >::update_impl(), Aleph::negative_cycles_detail::Exact_Sum< T >::upper(), upper_bound(), upper_bound(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::upper_bound_index(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::upper_bound_index(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::upper_bound_index(), Aleph::HalfPlaneIntersection::upper_half(), Moved_From_Case< Aho_Corasick >::use(), Aleph::parallel_detail::use_sequential_parallel_path(), Aleph::parallel_detail::use_sequential_path(), Aleph::Packed_Row< Cols >::valid(), valid_day(), valid_month(), validate_bytecode_function(), validate_cfg_function(), validate_dataflow_analysis(), validate_dead_code_elimination(), validate_ir_function(), Aleph::graph_coloring_detail::validate_no_self_loops(), validate_nonplanar_certificate(), Aleph::FFT< Real >::validate_overlap_constraints(), validate_ssa_function(), Aleph::Compiler_Line_Frontend::validate_top_level_calls(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::verify(), Aleph::Gen_Avl_Tree< NodeType, Key, Compare >::verify(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::verify(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::verify(), Aleph::PersistentHashMap< Key, T, Cmp >::verify(), Aleph::PersistentTreapSet< Key, Compare >::verify(), Aleph::PersistentTreapMap< Key, T, Compare >::verify(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::verify(), Aleph::RadixTree< T, Char >::verify(), Aleph::Gen_Rand_Tree< NodeType, Key, Compare >::verify(), Aleph::Gen_Rb_Tree_Rk< NodeType, Key, Compare >::verify(), GenTdSplayTreeRk< NodeType, Key, Compare >::verify(), Aleph::GenTdRbTree< NodeType, Key, Compare >::verify(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::verify(), Aleph::Gen_Treap< NodeType, Key, Compare >::verify(), Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::verify(), Aleph::PersistentVector< T >::verify(), verify_assignment(), Aleph::howard_detail::verify_exactly(), Aleph::GenBinHeap< NodeType, Key, Compare >::verify_heap(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_leaf_chain(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::verify_leaf_chain(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node(), Aleph::Gen_BPlus_Tree< Key, Compare, MinDegree >::verify_node(), Aleph::Gen_File_BPlus_Tree< Key, Compare, MinDegree, Codec >::verify_node(), Aleph::Gen_File_B_Tree< Key, Compare, MinDegree, Codec >::verify_node(), Aleph::RTree< Payload, MaxEntries, MinEntries, Variant >::verify_rec(), Aleph::Rope< Char, LeafSize >::verify_rec(), Aleph::RadixTree< T, Char >::verify_rec(), Aleph::detail::PersistentTreapNodeOps< Node, Key, Compare >::verify_rec(), Aleph::PersistentHashMap< Key, T, Cmp >::verify_rec(), Aleph::blossom_weighted_detail::mwmatching::impl::MatchingVerifier< WeightType >::verify_vertex_duals(), vertex_connectivity(), Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA >::visit_backward(), visualize_convex_hull(), Aleph::CA::ca_neighborhood_detail::von_neumann_count(), Aleph::CA::ca_vtk_detail::vtk_scalar_type(), Aleph::ThreadPool::wait_all_for(), Aleph::ThreadPool::wait_all_until(), warshall_compute_transitive_clausure(), Aleph::ThreadPool::worker_loop(), write_leaves(), Aleph::CA::ca_vtk_detail::write_scalar(), Aleph::CA::ca_io_detail::write_text_scalar(), Aleph::CA::ca_io_detail::write_wrapped_rle_body(), Aleph::planarity_detail::xml_escape_string(), yen_k_shortest_paths(), z_algorithm(), zip(), zip_drop(), zip_drop_while(), zip_longest(), zip_longest_opt(), zip_take(), and zipEq().

◆ are_stream_insertable_v

template<typename... Args>
constexpr bool Aleph::are_stream_insertable_v
inlineconstexpr
Initial value:
=
detail::are_stream_insertable_v<Args...>

Definition at line 85 of file ah-msg.H.

◆ Buffer_Size

constexpr size_t Aleph::Buffer_Size = 512
inlineconstexpr

Default buffer size for token parsing.

Maximum size for individual tokens (strings, numbers). Tokens exceeding this size will cause an error.

Definition at line 134 of file parse_utils.H.

Referenced by get_token(), load_binary_number(), load_deway_number(), load_double(), load_escaped_string(), load_hex_number(), load_identifier(), load_number(), load_octal_number(), load_string(), parse_deway_number(), and TEST().

◆ Cross_Arc

constexpr long Aleph::Cross_Arc = -1
constexpr

Special marker for arcs connecting a cut node to a non-cut block.

Used by paint_subgraphs()/map_cut_graph().

Definition at line 1818 of file tpl_graph_utils.H.

Referenced by __paint_from_cut_node(), is_a_cross_arc(), and Aleph::Compute_Cut_Nodes< GT, SA >::paint_from_cut_node().

◆ current_col_number

int Aleph::current_col_number = 1
inline

Current column number in the input stream.

Updated automatically by read_char_from_stream(). Column numbering starts at 1, resets to 0 on newline.

Definition at line 150 of file parse_utils.H.

Referenced by Aleph::SourceLocation::current(), init_token_scanning(), load_binary_number(), load_double(), load_hex_number(), load_identifier(), load_octal_number(), mark_position(), read_char_from_stream(), reset_parse_state(), restore_position(), skip_block_comment(), skip_line_comment(), skip_whitespace_and_comments(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ current_line_number

int Aleph::current_line_number = 1
inline

Current line number in the input stream.

Updated automatically by read_char_from_stream(). Line numbering starts at 1.

Definition at line 142 of file parse_utils.H.

Referenced by Aleph::SourceLocation::current(), init_token_scanning(), mark_position(), read_char_from_stream(), reset_parse_state(), restore_position(), skip_block_comment(), skip_line_comment(), TEST(), TEST(), TEST(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ daemonized

bool Aleph::daemonized = false

Flag indicating if the process is running as a daemon.

Definition at line 40 of file ahDefs.C.

Referenced by daemonize().

◆ Default_Hash_Seed

const unsigned Aleph::Default_Hash_Seed = 52679987

Definition at line 46 of file hash-fct.C.

Referenced by init_jsw(), jsw_hash(), jsw_hash(), TEST(), and TEST_F().

◆ dynamic_extent

constexpr size_t Aleph::dynamic_extent = static_cast<size_t>(-1)
inlineconstexpr

Sentinel marking an axis whose extent is only known at run time.

Definition at line 277 of file ah-mdspan.H.

Referenced by Aleph::extents< IndexType, Exts >::extents(), Aleph::extents< IndexType, Exts >::extents(), and Aleph::extents< IndexType, Exts >::extents().

◆ filter_iterator_keeps_copy

template<class Container >
constexpr bool Aleph::filter_iterator_keeps_copy
inlineconstexpr
Initial value:
=
std::is_pointer_v<Container> or
requires { requires Container::filter_iterator_keeps_a_copy; }

Whether a Filter_Iterator keeps a copy of its container, and not its address.

A container that is a pointer (the node over whose arcs a Node_Arc_Iterator goes) or a small view of another container is usually a parameter or a temporary, whose address dies before the iterator: the iterator keeps its value instead. A view says so with a member filter_iterator_keeps_a_copy and a constructor of an empty view, usable by Filter_Iterator.

Definition at line 69 of file filter_iterator.H.

◆ hash_default_lower_alpha

◆ hash_default_upper_alpha

◆ init

std::atomic<bool> Aleph::init {false}
static

Definition at line 54 of file hash-fct.C.

Referenced by Aleph::Arcs_Index< GT, Compare, Tree, SA >::Arcs_Index(), Aleph::Arcs_Index< GT, Compare, Tree, SA >::Arcs_Index(), Aleph::Gen_Cartesian_Tree< T, Comp >::Gen_Cartesian_Tree(), Aleph::Gen_Reroot_DP< GT, T, SA >::Gen_Reroot_DP(), Aleph::Gen_Tree_DP< GT, T, SA >::Gen_Tree_DP(), Aleph::Gsl_Compatible_Rng::Gsl_Compatible_Rng(), Aleph::Gsl_Compatible_Rng::Gsl_Compatible_Rng(), Aleph::Slinknc::Iterator::Iterator(), Aleph::CA::Multi_Field_Lattice< Layout, Boundary, Rank, Fields >::Multi_Field_Lattice(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::Nodes_Index(), Aleph::Nodes_Index< GT, Compare, Tree, SN >::Nodes_Index(), Aleph::Path< GT >::Path(), Aleph::Path< GT >::append(), Aleph::Path< GT >::append_directed(), RingFileCache< T >::create(), Aleph::Interpreter_Runtime::evaluate_stmt(), Aleph::CA::Multi_Field_Lattice< Layout, Boundary, Rank, Fields >::fill(), Aleph::CA::Multi_Field_Lattice< Layout, Boundary, Rank, Fields >::fill_impl(), Aleph::Dial_Min_Paths< GT, Distance, Itor, SA >::find_min_path(), Aleph::Zero_One_BFS< GT, Distance, Itor, SA >::find_min_path(), Aleph::Bidirectional_BFS< GT, Fwd_Itor, Bck_Itor, SA >::find_path(), Aleph::FunctionalMixin< Derived, Type >::fold(), Aleph::FunctionalMixin< Derived, Type >::fold(), Aleph::FunctionalMixin< Derived, Type >::fold_left(), fold_perm(), fold_perm(), Aleph::FunctionalMixin< Derived, Type >::foldl(), foldl(), Aleph::Const_Graph_View< GT >::foldl_arcs(), foldl_arcs(), foldl_arcs(), foldl_in_arcs(), foldl_in_arcs(), Aleph::Const_Graph_View< GT >::foldl_nodes(), foldl_nodes(), foldl_out_arcs(), foldr(), init_jsw(), Aleph::Path< GT >::insert(), Aleph::Path< GT >::insert_directed(), is_jsw_initialized(), jsw_fill_table(), jsw_hash(), jsw_hash(), Aleph::CA::Multi_Field_Lattice< Layout, Boundary, Rank, Fields >::make_soa_init(), Aleph::Prim_Min_Spanning_Tree< GT, Distance, SA >::min_spanning_tree(), Aleph::Dial_Min_Paths< GT, Distance, Itor, SA >::paint_min_paths_tree(), Aleph::Zero_One_BFS< GT, Distance, Itor, SA >::paint_min_paths_tree(), Aleph::Compiler_Parser::parse_let_statement(), Aleph::detail::ranges_fold_left(), Aleph::Slinknc::Iterator::reset_first(), RingFileCache< T >::resize(), scanl(), scanl_sum(), Aleph::Gsl_Compatible_Rng::seed(), Aleph::Path< GT >::set_graph(), stl_foldl(), stl_foldr(), stl_reduce(), stl_scan_left(), stl_scan_right(), stl_zip_foldl(), stl_zip_reduce(), stl_zip_scan_left(), uni_foldl(), uni_reduce(), uni_scan_left(), uni_zip_foldl(), uni_zip_reduce(), uni_zip_scan_left(), zip_foldl(), and zip_foldl_eq().

◆ Insertion_Threshold

size_t Aleph::Insertion_Threshold = 40
extern

Threshold for switching to insertion sort in hybrid algorithms.

When a partition becomes smaller than this threshold, hybrid sorting algorithms (like quicksort) switch to insertion sort, which is faster for small arrays due to lower overhead.

Default value: typically 10-20 elements.

Definition at line 36 of file tpl_sort_utils.C.

Referenced by quicksort_insertion().

◆ is_known_non_idempotent_op

template<typename F , typename T >
constexpr bool Aleph::is_known_non_idempotent_op
inlineconstexpr
Initial value:
=
sparse_table_detail::is_arithmetic_functor<std::remove_cvref_t<F>> and
std::is_arithmetic_v<std::remove_cv_t<T>> and
not std::is_same_v<std::remove_cv_t<T>, bool>
and
Check uniqueness with explicit hash + equality functors.

True if F is known not to be idempotent over T.

Idempotency (f(a, a) == a) cannot be checked in general, so this is a list of known offenders, not a proof: the standard and Aleph arithmetic functors (plus, minus, multiplies, divides, modulus, std::bit_xor) over a numeric T other than bool. Class types are left out because their operators may mean something else (e.g. + as set union, which is idempotent), and so is bool, where plus and multiplies behave as OR and AND.

Template Parameters
Ffunctor type.
Tvalue type.
Note
Customization point: specialize it to true for your own non-idempotent functors so that Gen_Sparse_Table rejects them.

Definition at line 137 of file tpl_sparse_table.H.

◆ jsw_init_flag

std::once_flag Aleph::jsw_init_flag
static

Definition at line 53 of file hash-fct.C.

Referenced by init_jsw(), jsw_hash(), and jsw_hash().

◆ jsw_mtx

std::shared_mutex Aleph::jsw_mtx
static

Definition at line 58 of file hash-fct.C.

Referenced by init_jsw(), init_jsw(), jsw_hash(), and jsw_hash().

◆ LINE_EPSILON

const Geom_Number Aleph::LINE_EPSILON(0) ( 0  )
inline

Default epsilon for geometric comparisons.

Zero for exact rational arithmetic. Can be overridden in method calls for approximate comparisons.

◆ Max_Priority

const long Aleph::Max_Priority = ULONG_MAX

Maximum priority value (used for sentinel/leaves)

Definition at line 75 of file treapNode.H.

◆ max_time

double Aleph::max_time = 300

Maximum allowed execution time (in seconds).

Definition at line 46 of file ahDefs.C.

◆ Max_Tree_Node_Depth

constexpr size_t Aleph::Max_Tree_Node_Depth = 1024
constexpr

The depth of the trees that generate_tree() wrote before 7.3.2; it writes trees of any depth now.

Definition at line 158 of file generate_tree.H.

Referenced by TEST(), and TEST().

◆ MIN_NODE_FIELDS

constexpr size_t Aleph::MIN_NODE_FIELDS = 7
constexpr

Minimum expected columns for a node record.

Definition at line 177 of file load_digraph.H.

Referenced by load_digraph(), and TEST().

◆ Min_Priority

◆ No_Visited

const long Aleph::No_Visited = 0
static

Definition at line 56 of file aleph-graph.H.

◆ Not_Found

const int Aleph::Not_Found = -1
extern

Return value for search functions when element is not found.

Typically -1. Used by sequential_search(), random_search(), etc.

Definition at line 40 of file tpl_sort_utils.C.

Referenced by random_search(), random_search(), sequential_search(), and sequential_search().

◆ Null_IPv4_Address

const IPv4_Address Aleph::Null_IPv4_Address = 0

Null/invalid IPv4 address constant.

Definition at line 42 of file ahDefs.C.

◆ PI

constexpr double Aleph::PI = 3.1415926535897932384626433832795028841971693993751
constexpr

◆ PI_2

constexpr double Aleph::PI_2 = PI / 2.0
constexpr

Definition at line 130 of file point.H.

Referenced by process_tag_node(), TEST_F(), and TEST_F().

◆ PI_4

constexpr double Aleph::PI_4 = PI / 4.0
constexpr

Definition at line 131 of file point.H.

Referenced by process_tag_node().

◆ previous_col_number

int Aleph::previous_col_number = 1
inline

Column number at the start of the current token.

Set by init_token_scanning() before reading a token. Used for error reporting to show where the token began.

Definition at line 166 of file parse_utils.H.

Referenced by init_token_scanning(), Aleph::SourceLocation::previous(), print_parse_error_and_exit(), print_parse_warning(), reset_parse_state(), TEST(), TEST(), and TEST_F().

◆ previous_line_number

int Aleph::previous_line_number = 1
inline

Line number at the start of the current token.

Set by init_token_scanning() before reading a token. Used for error reporting to show where the token began.

Definition at line 158 of file parse_utils.H.

Referenced by init_token_scanning(), Aleph::SourceLocation::previous(), print_parse_error_and_exit(), print_parse_warning(), reset_parse_state(), TEST(), TEST(), and TEST_F().

◆ Quicksort_Threshold

size_t Aleph::Quicksort_Threshold = 40
extern

Threshold for using quicksort vs simpler algorithms.

Arrays smaller than this threshold may use simpler O(n²) algorithms.

Definition at line 38 of file tpl_sort_utils.C.

Referenced by introsort(), introsort_loop(), introsort_loop(), and quicksort().

◆ rand_gen

Gsl_Compatible_Rng * Aleph::rand_gen = nullptr

Internal RNG handle used by the helper functors in this header.

It is set by gen_random_euclidian_graph(), to a Gsl_Compatible_Rng, which gives the numbers of the gsl_rng_mt19937 of GSL, and cleared before it returns or throws. This is not thread-safe.

Note
This variable is defined in euclidian-graph-common.C.

Definition at line 38 of file euclidian-graph-common.C.

Referenced by gen_random_euclidian_graph(), Aleph::Init_P< GT >::operator()(), Aleph::Init_Arc< GT >::operator()(), and TEST().

◆ Search_Unlimited

constexpr size_t Aleph::Search_Unlimited = std::numeric_limits<size_t>::max()
inlineconstexpr

◆ tab

long Aleph::tab[256]
static

Definition at line 48 of file hash-fct.C.

Referenced by jsw_fill_table(), jsw_hash(), and jsw_hash().

◆ token_instance

std::string Aleph::token_instance
inline

The most recently scanned token.

Set by close_token_scanning() after completing a token. Useful for error messages to show what was being parsed.

Definition at line 174 of file parse_utils.H.

Referenced by close_token_scanning(), expect(), file_to_dynarrays(), load_char_literal(), print_parse_error_and_exit(), print_parse_warning(), reset_parse_state(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

◆ unexpect

constexpr unexpect_t Aleph::unexpect {}
inlineconstexpr

Tag value of type unexpect_t.

Use this constant to construct an expected in the error state:

Minimal std::expected-style result type for C++20.
constexpr unexpect_t unexpect
Tag value of type unexpect_t.

Definition at line 160 of file ah-cpp-compat.H.

◆ UnknownLine

const int Aleph::UnknownLine = -1

Constant indicating unknown line number.

Definition at line 165 of file ahDefs.H.

◆ UnknownLoad

const int Aleph::UnknownLoad = -1

Constant indicating unknown load factor.

Definition at line 168 of file ahDefs.H.

◆ UnknownSize

const int Aleph::UnknownSize = -1

Constant indicating unknown size.

Definition at line 162 of file ahDefs.H.

◆ verbose

bool Aleph::verbose = false