1- //! 8192 -bit Container — the atomic unit of LadybugDB.
1+ //! 16,384 -bit Container (CogRecord) — the atomic unit of LadybugDB.
22//!
3- //! A Container is a 1 KB bit-vector: 128 × u64 = 8,192 bits.
3+ //! A Container is a 2 KB bit-vector: 256 × u64 = 16,384 bits.
44//! All cognitive operations (XOR bind, Hamming distance, majority-vote bundle)
5- //! operate at this granularity.
5+ //! operate at this granularity. Each CogRecord IS one container.
66
77/// Total bits in a single container.
8- pub const CONTAINER_BITS : usize = 8_192 ;
8+ pub const CONTAINER_BITS : usize = 16_384 ;
99/// Number of u64 words in a container.
10- pub const CONTAINER_WORDS : usize = CONTAINER_BITS / 64 ; // 128
10+ pub const CONTAINER_WORDS : usize = CONTAINER_BITS / 64 ; // 256
1111/// Number of bytes in a container.
12- pub const CONTAINER_BYTES : usize = CONTAINER_WORDS * 8 ; // 1024
12+ pub const CONTAINER_BYTES : usize = CONTAINER_WORDS * 8 ; // 2048
1313/// AVX-512 iteration count (8 words per 512-bit register).
14- pub const CONTAINER_AVX512_ITERS : usize = CONTAINER_WORDS / 8 ; // 16
14+ pub const CONTAINER_AVX512_ITERS : usize = CONTAINER_WORDS / 8 ; // 32
1515/// Maximum content containers in a CogRecord.
1616pub const MAX_CONTAINERS : usize = 255 ;
1717/// Expected Hamming distance for two random containers.
18- pub const EXPECTED_DISTANCE : u32 = ( CONTAINER_BITS / 2 ) as u32 ; // 4096
18+ pub const EXPECTED_DISTANCE : u32 = ( CONTAINER_BITS / 2 ) as u32 ; // 8192
1919/// Standard deviation of Hamming distance for random containers.
20- pub const SIGMA : f64 = 45.254833995939045 ;
20+ /// sqrt(16384 / 4) = sqrt(4096) = 64.0
21+ pub const SIGMA : f64 = 64.0 ;
2122/// Integer approximation of sigma.
22- pub const SIGMA_APPROX : u32 = 45 ;
23+ pub const SIGMA_APPROX : u32 = 64 ;
2324
24- /// 8,192 -bit binary container for HDC/VSA operations.
25+ /// 16,384 -bit binary container for HDC/VSA operations.
2526///
2627/// Cache-line aligned for SIMD; `#[repr(C)]` for binary stability.
2728#[ derive( Clone , PartialEq , Eq ) ]
@@ -216,7 +217,7 @@ impl Container {
216217 /// Zero-copy byte view (little-endian).
217218 #[ inline]
218219 pub fn as_bytes ( & self ) -> & [ u8 ; CONTAINER_BYTES ] {
219- // SAFETY: Container is repr(C), [u64; 128 ] has same layout as [u8; 1024 ]
220+ // SAFETY: Container is repr(C), [u64; 256 ] has same layout as [u8; 2048 ]
220221 unsafe { & * ( self . words . as_ptr ( ) as * const [ u8 ; CONTAINER_BYTES ] ) }
221222 }
222223
@@ -229,7 +230,7 @@ impl Container {
229230 Self { words }
230231 }
231232
232- /// Zero-cost borrow a `[u64; 128 ]` as `&Container`.
233+ /// Zero-cost borrow a `[u64; 256 ]` as `&Container`.
233234 ///
234235 /// # Safety
235236 /// Caller must guarantee 64-byte alignment.
@@ -282,7 +283,7 @@ mod tests {
282283 let a = Container :: random ( 42 ) ;
283284 let b = Container :: random ( 99 ) ;
284285 let d = a. hamming ( & b) ;
285- assert ! ( d > 3500 && d < 4700 , "hamming={d}, expected ~4096 " ) ;
286+ assert ! ( d > 7000 && d < 9500 , "hamming={d}, expected ~8192 " ) ;
286287 }
287288
288289 #[ test]
0 commit comments