Skip to content

Commit 40bd9f0

Browse files
mivertowskiclaude
andcommitted
Add GPU-accelerated accounting network generation kernel
Implement journal entry to directed graph transformation based on the "Hardware Accelerated Method for Accounting Network Generation" paper. This enables analysis of money flows between accounts. Key features: - FixedPoint128 arithmetic for exact decimal calculations - Five solving methods with confidence levels: - Method A (1.0): Trivial 1-to-1 for 2-line entries - Method B (0.95): n-to-n bijective matching - Method C (0.85): n-to-m partition matching (subset-sum) - Method D (0.70): Aggregation by account - Method E (0.50): Decomposition by entity - Batch and Ring kernel modes - Temporal windowing for time-range queries - Suspense account routing for unsolvable entries - Audit trail linking flows to source journal lines New types: AccountingFlow, AccountingNetwork, NetworkGenerationStats New kernels: NetworkGeneration, NetworkGenerationRing Tests: 17 new tests covering all solving methods Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e9c4eed commit 40bd9f0

3 files changed

Lines changed: 2021 additions & 6 deletions

File tree

crates/rustkernel-accounting/src/lib.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@
88
//! - `GLReconciliation` - Account matching
99
//! - `NetworkAnalysis` - Intercompany analysis
1010
//! - `TemporalCorrelation` - Account correlations
11+
//! - `NetworkGeneration` - Journal entry to accounting network transformation
12+
//! - `NetworkGenerationRing` - Streaming network generation
1113
1214
#![warn(missing_docs)]
1315

1416
pub mod coa_mapping;
1517
pub mod journal;
1618
pub mod network;
19+
pub mod network_generation;
1720
pub mod reconciliation;
1821
pub mod temporal;
1922
pub mod types;
2023

2124
pub use coa_mapping::ChartOfAccountsMapping;
2225
pub use journal::JournalTransformation;
2326
pub use network::NetworkAnalysis;
27+
pub use network_generation::{
28+
AccountingFlow, AccountingNetwork, FixedPoint128, NetworkGeneration, NetworkGenerationConfig,
29+
NetworkGenerationRing, NetworkGenerationStats, SolvingMethod,
30+
};
2431
pub use reconciliation::GLReconciliation;
2532
pub use temporal::TemporalCorrelation;
2633

@@ -45,13 +52,27 @@ pub fn register_all(
4552
// Reconciliation kernel (1)
4653
registry.register_metadata(reconciliation::GLReconciliation::new().metadata().clone())?;
4754

48-
// Network kernel (1)
55+
// Network analysis kernel (1)
4956
registry.register_metadata(network::NetworkAnalysis::new().metadata().clone())?;
5057

5158
// Temporal kernel (1)
5259
registry.register_metadata(temporal::TemporalCorrelation::new().metadata().clone())?;
5360

54-
tracing::info!("Registered 5 accounting kernels");
61+
// Network generation batch kernel (1)
62+
registry.register_metadata(
63+
network_generation::NetworkGeneration::new()
64+
.metadata()
65+
.clone(),
66+
)?;
67+
68+
// Network generation ring kernel (1)
69+
registry.register_metadata(
70+
network_generation::NetworkGenerationRing::new()
71+
.metadata()
72+
.clone(),
73+
)?;
74+
75+
tracing::info!("Registered 7 accounting kernels");
5576
Ok(())
5677
}
5778

@@ -64,6 +85,6 @@ mod tests {
6485
fn test_register_all() {
6586
let registry = KernelRegistry::new();
6687
register_all(&registry).expect("Failed to register accounting kernels");
67-
assert_eq!(registry.total_count(), 5);
88+
assert_eq!(registry.total_count(), 7);
6889
}
6990
}

0 commit comments

Comments
 (0)