pub struct QuantumMemoryConfig {
pub memory_size: usize,
pub associative_memory: bool,
pub episodic_memory: bool,
pub retrieval_mechanism: MemoryRetrievalType,
pub quantum_compression: bool,
pub coherence_time: f64,
}Expand description
Quantum memory configuration
Fields§
§memory_size: usizeMemory bank size
associative_memory: boolQuantum associative memory
episodic_memory: boolEpisodic memory with quantum states
retrieval_mechanism: MemoryRetrievalTypeMemory retrieval mechanism
quantum_compression: boolMemory compression using quantum algorithms
coherence_time: f64Memory coherence time
Implementations§
Source§impl QuantumMemoryConfig
impl QuantumMemoryConfig
Sourcepub fn default() -> Self
pub fn default() -> Self
Default memory configuration
Examples found in repository?
examples/quantum_llm.rs (line 159)
154fn quantum_memory_demo() -> Result<()> {
155 println!(" Testing quantum memory systems...");
156
157 // Test different memory configurations
158 let memory_configs = vec![
159 ("Basic Associative", QuantumMemoryConfig::default()),
160 ("Enhanced Memory", QuantumMemoryConfig::enhanced()),
161 ("Advanced Holographic", QuantumMemoryConfig::advanced()),
162 ];
163
164 for (name, config) in memory_configs {
165 println!("\n --- {} Memory ---", name);
166
167 let mut memory_system = QuantumMemorySystem::new(config.clone())?;
168 println!(" Memory configuration:");
169 println!(" - Memory size: {}", config.memory_size);
170 println!(" - Associative memory: {}", config.associative_memory);
171 println!(" - Episodic memory: {}", config.episodic_memory);
172 println!(" - Retrieval mechanism: {:?}", config.retrieval_mechanism);
173 println!(" - Quantum compression: {}", config.quantum_compression);
174
175 // Test memory storage and retrieval
176 let test_embeddings = Array3::from_shape_fn((2, 10, 128), |(b, s, d)| {
177 0.1 * (b as f64 + s as f64 * 0.1 + d as f64 * 0.01)
178 });
179
180 // Enhance embeddings with memory
181 let enhanced = memory_system.enhance_embeddings(&test_embeddings)?;
182 println!(" Enhanced embeddings shape: {:?}", enhanced.dim());
183
184 // Measure memory enhancement effect
185 let original_variance = test_embeddings.var(0.0);
186 let enhanced_variance = enhanced.var(0.0);
187 let enhancement_factor = enhanced_variance / original_variance;
188
189 println!(" Memory enhancement factor: {:.3}", enhancement_factor);
190
191 // Test memory update
192 let input_ids = Array2::from_shape_fn((2, 10), |(b, s)| (b * 10 + s) % 1000);
193 memory_system.update_memory(&enhanced, &input_ids)?;
194
195 println!(" Memory updated with new experiences");
196
197 // Test memory retrieval patterns
198 test_memory_patterns(&memory_system, &config)?;
199 }
200
201 Ok(())
202}Sourcepub fn enhanced() -> Self
pub fn enhanced() -> Self
Enhanced memory configuration
Examples found in repository?
examples/quantum_llm.rs (line 160)
154fn quantum_memory_demo() -> Result<()> {
155 println!(" Testing quantum memory systems...");
156
157 // Test different memory configurations
158 let memory_configs = vec![
159 ("Basic Associative", QuantumMemoryConfig::default()),
160 ("Enhanced Memory", QuantumMemoryConfig::enhanced()),
161 ("Advanced Holographic", QuantumMemoryConfig::advanced()),
162 ];
163
164 for (name, config) in memory_configs {
165 println!("\n --- {} Memory ---", name);
166
167 let mut memory_system = QuantumMemorySystem::new(config.clone())?;
168 println!(" Memory configuration:");
169 println!(" - Memory size: {}", config.memory_size);
170 println!(" - Associative memory: {}", config.associative_memory);
171 println!(" - Episodic memory: {}", config.episodic_memory);
172 println!(" - Retrieval mechanism: {:?}", config.retrieval_mechanism);
173 println!(" - Quantum compression: {}", config.quantum_compression);
174
175 // Test memory storage and retrieval
176 let test_embeddings = Array3::from_shape_fn((2, 10, 128), |(b, s, d)| {
177 0.1 * (b as f64 + s as f64 * 0.1 + d as f64 * 0.01)
178 });
179
180 // Enhance embeddings with memory
181 let enhanced = memory_system.enhance_embeddings(&test_embeddings)?;
182 println!(" Enhanced embeddings shape: {:?}", enhanced.dim());
183
184 // Measure memory enhancement effect
185 let original_variance = test_embeddings.var(0.0);
186 let enhanced_variance = enhanced.var(0.0);
187 let enhancement_factor = enhanced_variance / original_variance;
188
189 println!(" Memory enhancement factor: {:.3}", enhancement_factor);
190
191 // Test memory update
192 let input_ids = Array2::from_shape_fn((2, 10), |(b, s)| (b * 10 + s) % 1000);
193 memory_system.update_memory(&enhanced, &input_ids)?;
194
195 println!(" Memory updated with new experiences");
196
197 // Test memory retrieval patterns
198 test_memory_patterns(&memory_system, &config)?;
199 }
200
201 Ok(())
202}Sourcepub fn advanced() -> Self
pub fn advanced() -> Self
Advanced memory configuration
Examples found in repository?
examples/quantum_llm.rs (line 161)
154fn quantum_memory_demo() -> Result<()> {
155 println!(" Testing quantum memory systems...");
156
157 // Test different memory configurations
158 let memory_configs = vec![
159 ("Basic Associative", QuantumMemoryConfig::default()),
160 ("Enhanced Memory", QuantumMemoryConfig::enhanced()),
161 ("Advanced Holographic", QuantumMemoryConfig::advanced()),
162 ];
163
164 for (name, config) in memory_configs {
165 println!("\n --- {} Memory ---", name);
166
167 let mut memory_system = QuantumMemorySystem::new(config.clone())?;
168 println!(" Memory configuration:");
169 println!(" - Memory size: {}", config.memory_size);
170 println!(" - Associative memory: {}", config.associative_memory);
171 println!(" - Episodic memory: {}", config.episodic_memory);
172 println!(" - Retrieval mechanism: {:?}", config.retrieval_mechanism);
173 println!(" - Quantum compression: {}", config.quantum_compression);
174
175 // Test memory storage and retrieval
176 let test_embeddings = Array3::from_shape_fn((2, 10, 128), |(b, s, d)| {
177 0.1 * (b as f64 + s as f64 * 0.1 + d as f64 * 0.01)
178 });
179
180 // Enhance embeddings with memory
181 let enhanced = memory_system.enhance_embeddings(&test_embeddings)?;
182 println!(" Enhanced embeddings shape: {:?}", enhanced.dim());
183
184 // Measure memory enhancement effect
185 let original_variance = test_embeddings.var(0.0);
186 let enhanced_variance = enhanced.var(0.0);
187 let enhancement_factor = enhanced_variance / original_variance;
188
189 println!(" Memory enhancement factor: {:.3}", enhancement_factor);
190
191 // Test memory update
192 let input_ids = Array2::from_shape_fn((2, 10), |(b, s)| (b * 10 + s) % 1000);
193 memory_system.update_memory(&enhanced, &input_ids)?;
194
195 println!(" Memory updated with new experiences");
196
197 // Test memory retrieval patterns
198 test_memory_patterns(&memory_system, &config)?;
199 }
200
201 Ok(())
202}Trait Implementations§
Source§impl Clone for QuantumMemoryConfig
impl Clone for QuantumMemoryConfig
Source§fn clone(&self) -> QuantumMemoryConfig
fn clone(&self) -> QuantumMemoryConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for QuantumMemoryConfig
impl RefUnwindSafe for QuantumMemoryConfig
impl Send for QuantumMemoryConfig
impl Sync for QuantumMemoryConfig
impl Unpin for QuantumMemoryConfig
impl UnwindSafe for QuantumMemoryConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.