scirs2_core/lib.rs
1#![recursion_limit = "512"]
2// TODO: Address deprecated code usage and remove this allow
3#![allow(deprecated)]
4// TODO: Remove dead code or justify why it's kept
5#![allow(dead_code)]
6
7//! # SciRS2 Core - Foundation for Scientific Computing in Rust
8//!
9//! **scirs2-core** is the foundational crate for the SciRS2 scientific computing ecosystem,
10//! providing essential utilities, abstractions, and optimizations used by all SciRS2 modules.
11//!
12//! ## 🎯 Design Philosophy
13//!
14//! - **Zero-Cost Abstractions**: Performance without compromising safety
15//! - **Layered Architecture**: Clear separation between interface and implementation
16//! - **Policy Compliance**: Enforce [SciRS2 POLICY](https://github.com/cool-japan/scirs/blob/master/SCIRS2_POLICY.md) - only scirs2-core uses external dependencies directly
17//! - **Production Ready**: Enterprise-grade error handling, diagnostics, and stability guarantees
18//!
19//! ## 🚀 Key Features
20//!
21//! ### Performance Acceleration
22//!
23//! - **SIMD Operations**: CPU vector instructions (SSE, AVX, NEON) for array operations
24//! - **Parallel Processing**: Multi-threaded execution with intelligent load balancing
25//! - **GPU Acceleration**: Unified interface for CUDA, Metal, OpenCL, and WebGPU
26//! - **Memory Efficiency**: Zero-copy views, memory-mapped arrays, adaptive chunking
27//!
28//! ### Core Utilities
29//!
30//! - **Error Handling**: ML-inspired diagnostics with recovery strategies
31//! - **Validation**: Input checking with informative error messages
32//! - **Caching**: Memoization and result caching for expensive computations
33//! - **Profiling**: Performance monitoring and bottleneck detection
34//!
35//! ### Scientific Infrastructure
36//!
37//! - **Constants**: Physical and mathematical constants (via [`constants`] module)
38//! - **Random Number Generation**: Consistent RNG interface across the ecosystem
39//! - **Complex Numbers**: Type-safe complex arithmetic
40//! - **Array Protocol**: Unified array interface for interoperability
41//!
42//! ## 📦 Module Overview
43//!
44//! ### Performance & Optimization
45//!
46//! | Module | Description |
47//! |--------|-------------|
48//! | [`simd_ops`] | SIMD-accelerated operations with platform detection |
49//! | [`parallel_ops`] | Parallel processing primitives |
50//! | [`gpu`] | GPU acceleration abstractions |
51//! | [`memory`] | Memory management (buffer pools, zero-copy views) |
52//! | [`memory_efficient`] | Memory-mapped arrays and lazy evaluation |
53//!
54//! ### Error Handling & Diagnostics
55//!
56//! | Module | Description |
57//! |--------|-------------|
58//! | [`error`] | Error types and traits |
59//! | [`validation`] | Input validation utilities |
60//! | [`logging`] | Structured logging for diagnostics |
61//! | [`profiling`] | Performance profiling tools |
62//!
63//! ### Scientific Computing Basics
64//!
65//! | Module | Description |
66//! |--------|-------------|
67//! | [`ndarray`] | Unified ndarray interface (re-exports with SciRS2 extensions) |
68//! | [`numeric`] | Generic numerical operations |
69//! | [`random`] | Random number generation |
70//! | [`constants`] | Mathematical and physical constants |
71//!
72//! ### Infrastructure
73//!
74//! | Module | Description |
75//! |--------|-------------|
76//! | [`config`] | Configuration management |
77//! | [`cache`] | Result caching and memoization |
78//! | [`io`] | I/O utilities |
79//! | [`cloud`] | Cloud storage integration (S3, GCS, Azure) |
80//!
81//! ## 🚀 Quick Start
82//!
83//! ### Installation
84//!
85//! ```toml
86//! [dependencies]
87//! scirs2-core = { version = "0.1.0-beta.4", features = ["simd", "parallel"] }
88//! ```
89//!
90//! ### SIMD Operations
91//!
92//! ```rust
93//! use scirs2_core::simd_ops::SimdUnifiedOps;
94//! use ndarray::array;
95//!
96//! // Automatic SIMD acceleration based on CPU capabilities
97//! let a = array![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];
98//! let b = array![8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0];
99//!
100//! // SIMD-accelerated element-wise addition
101//! let result = f64::simd_add(&a.view(), &b.view());
102//! ```
103//!
104//! ### Parallel Processing
105//!
106//! ```rust
107//! # #[cfg(feature = "parallel")]
108//! # {
109//! use scirs2_core::parallel_ops::*;
110//!
111//! // Parallel iteration over chunks
112//! let data = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
113//! par_chunks(&data, 3).for_each(|chunk| {
114//! // Process each chunk in parallel
115//! let sum: i32 = chunk.iter().sum();
116//! println!("Chunk sum: {}", sum);
117//! });
118//! # }
119//! ```
120//!
121//! ### Input Validation
122//!
123//! ```rust
124//! use scirs2_core::validation::*;
125//! use scirs2_core::error::CoreResult;
126//! use ndarray::Array2;
127//!
128//! fn process_matrix(data: &Array2<f64>, k: usize) -> CoreResult<()> {
129//! // Validate inputs
130//! check_positive(k, "k")?;
131//! checkarray_finite(data, "data")?;
132//! checkshape(data, &[2, 3], "data")?;
133//!
134//! // Process data...
135//! Ok(())
136//! }
137//! # let data = Array2::<f64>::zeros((2, 3));
138//! # let _ = process_matrix(&data, 5);
139//! ```
140//!
141//! ### Constants
142//!
143//! ```rust
144//! use scirs2_core::constants::{math, physical};
145//!
146//! // Mathematical constants
147//! let pi = math::PI;
148//! let e = math::E;
149//!
150//! // Physical constants
151//! let c = physical::SPEED_OF_LIGHT;
152//! let h = physical::PLANCK;
153//! ```
154//!
155//! ### Random Number Generation
156//!
157//! ```rust
158//! # #[cfg(feature = "random")]
159//! # {
160//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
161//! use scirs2_core::random::*;
162//! use rand::Rng;
163//!
164//! // Standard distributions
165//! let mut rng = rand::rng();
166//! let normal = Normal::new(0.0, 1.0)?;
167//! let samples: Vec<f64> = (0..1000).map(|_| normal.sample(&mut rng)).collect();
168//!
169//! let uniform = Uniform::new(0.0, 1.0)?;
170//! let samples: Vec<f64> = (0..1000).map(|_| uniform.sample(&mut rng)).collect();
171//! # Ok(())
172//! # }
173//! # }
174//! ```
175//!
176//! ### Memory-Efficient Operations
177//!
178//! ```rust,no_run
179//! # #[cfg(feature = "memory_efficient")]
180//! # {
181//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
182//! use scirs2_core::memory_efficient::*;
183//! use std::path::Path;
184//! use ndarray::Array2;
185//!
186//! // Memory-mapped array for large datasets
187//! let data = Array2::<f64>::zeros((1000, 1000));
188//! let path = Path::new("/path/to/large_file.dat");
189//! let mmap = create_mmap(&data, path, AccessMode::ReadWrite, 0)?;
190//!
191//! // Chunked operations for out-of-core processing
192//! let result = chunk_wise_op(&data, |chunk| {
193//! chunk.mapv(|x| x * 2.0)
194//! }, ChunkingStrategy::Fixed(10000))?;
195//! # Ok(())
196//! # }
197//! # }
198//! ```
199//!
200//! ## 🏗️ Architecture
201//!
202//! ```text
203//! ┌─────────────────────────────────────────┐
204//! │ SciRS2 Ecosystem Modules │
205//! │ (linalg, stats, neural, vision, etc.) │
206//! └─────────────────────────────────────────┘
207//! ▼
208//! ┌─────────────────────────────────────────┐
209//! │ scirs2-core (This Crate) │
210//! │ ┌────────────────────────────────────┐ │
211//! │ │ High-Level Abstractions │ │
212//! │ │ - SIMD Operations │ │
213//! │ │ - Parallel Processing │ │
214//! │ │ - GPU Acceleration │ │
215//! │ │ - Error Handling │ │
216//! │ └────────────────────────────────────┘ │
217//! │ ┌────────────────────────────────────┐ │
218//! │ │ Core Utilities │ │
219//! │ │ - Array Protocol │ │
220//! │ │ - Validation │ │
221//! │ │ - Memory Management │ │
222//! │ │ - Configuration │ │
223//! │ └────────────────────────────────────┘ │
224//! └─────────────────────────────────────────┘
225//! ▼
226//! ┌─────────────────────────────────────────┐
227//! │ External Dependencies │
228//! │ (ndarray, rayon, BLAS, etc.) │
229//! │ ⚠️ Only scirs2-core depends directly │
230//! └─────────────────────────────────────────┘
231//! ```
232//!
233//! ## 🎨 Feature Flags
234//!
235//! ### Performance Features
236//!
237//! - `simd` - SIMD acceleration (SSE, AVX, NEON)
238//! - `parallel` - Multi-threaded execution via Rayon
239//! - `gpu` - GPU acceleration (CUDA, Metal, OpenCL)
240//!
241//! ### Memory Management
242//!
243//! - `memory_management` - Advanced memory management (buffer pools, tracking)
244//! - `memory_efficient` - Memory-mapped arrays and lazy evaluation
245//! - `memory_metrics` - Memory usage tracking and profiling
246//!
247//! ### Scientific Computing
248//!
249//! - `array` - Scientific array types (MaskedArray, RecordArray)
250//! - `random` - Random number generation
251//! - `linalg` - Linear algebra with BLAS/LAPACK
252//!
253//! ### Development & Debugging
254//!
255//! - `validation` - Input validation (recommended for development)
256//! - `logging` - Structured logging
257//! - `profiling` - Performance profiling
258//! - `testing` - Testing utilities
259//!
260//! ### Advanced Features
261//!
262//! - `cloud` - Cloud storage (S3, GCS, Azure)
263//! - `jit` - Just-in-time compilation with LLVM
264//! - `ml_pipeline` - ML pipeline integration
265//!
266//! ### Convenience
267//!
268//! - `default` - Commonly used features (parallel, validation)
269//! - `all` - All features except backend-specific ones
270//!
271//! ## 🔒 SciRS2 Policy Compliance
272//!
273//! **Important**: scirs2-core is the **only** crate in the SciRS2 ecosystem that directly
274//! depends on external crates like `ndarray`, `rand`, `rayon`, etc.
275//!
276//! All other SciRS2 crates **must** use abstractions provided by scirs2-core:
277//!
278//! ```rust,ignore
279//! // ✅ CORRECT: Use scirs2-core abstractions
280//! use scirs2_core::ndarray::Array2;
281//! use scirs2_core::random::Normal;
282//! use scirs2_core::parallel_ops::*;
283//!
284//! // ❌ WRONG: Don't import external deps directly in other crates
285//! // use ndarray::Array2; // NO!
286//! // use rand_distr::Normal; // NO!
287//! // use rayon::prelude::*; // NO!
288//! ```
289//!
290//! This policy ensures:
291//! - Consistent APIs across the ecosystem
292//! - Centralized version management
293//! - Easy addition of SciRS2-specific extensions
294//! - Better compile times through reduced duplication
295//!
296//! ## 📊 Performance
297//!
298//! scirs2-core provides multiple optimization levels:
299//!
300//! | Feature | Speedup | Use Case |
301//! |---------|---------|----------|
302//! | SIMD | 2-8x | Array operations, numerical computations |
303//! | Parallel | 2-16x | Large datasets, independent operations |
304//! | GPU | 10-100x | Massive parallelism, deep learning |
305//! | Memory-mapped | ∞ | Out-of-core processing, datasets larger than RAM |
306//!
307//! ### Platform Detection
308//!
309//! Automatic CPU feature detection for optimal SIMD usage:
310//!
311//! ```rust
312//! use scirs2_core::simd_ops::PlatformCapabilities;
313//!
314//! let caps = PlatformCapabilities::detect();
315//! println!("SIMD available: {}", caps.simd_available);
316//! println!("AVX2 available: {}", caps.avx2_available);
317//! println!("GPU available: {}", caps.gpu_available);
318//! ```
319//!
320//! ## 🔗 Integration
321//!
322//! scirs2-core integrates seamlessly with the Rust ecosystem:
323//!
324//! - **ndarray**: Core array operations
325//! - **num-traits**: Generic numeric operations
326//! - **rayon**: Parallel processing
327//! - **BLAS/LAPACK**: Optimized linear algebra
328//!
329//! ## 🔒 Version
330//!
331//! Current version: **0.1.0-beta.4** (Released October 01, 2025)
332//!
333//! ## 📚 Examples
334//!
335//! See the [examples directory](https://github.com/cool-japan/scirs/tree/master/scirs2-core/examples)
336//! for more detailed usage examples.
337
338// Re-export modules
339pub mod api_freeze;
340pub mod apiversioning;
341#[cfg(feature = "array")]
342pub mod array;
343pub mod array_protocol;
344#[cfg(feature = "types")]
345pub mod batch_conversions;
346#[cfg(feature = "cache")]
347pub mod cache;
348pub mod chunking;
349#[cfg(feature = "cloud")]
350pub mod cloud;
351pub mod config;
352pub mod constants;
353pub mod distributed;
354pub mod ecosystem;
355pub mod error;
356#[cfg(feature = "gpu")]
357pub mod gpu;
358#[cfg(feature = "gpu")]
359pub mod gpu_registry;
360pub mod io;
361#[cfg(feature = "jit")]
362pub mod jit;
363#[cfg(feature = "logging")]
364pub mod logging;
365#[cfg(feature = "memory_management")]
366pub mod memory;
367#[cfg(feature = "memory_efficient")]
368pub mod memory_efficient;
369pub mod metrics;
370#[cfg(feature = "ml_pipeline")]
371pub mod ml_pipeline;
372pub mod ndarray;
373pub mod ndarray_ext;
374pub mod numeric;
375#[cfg(feature = "parallel")]
376pub mod parallel;
377#[cfg(feature = "parallel")]
378pub mod parallel_ops;
379pub mod performance;
380pub mod performance_optimization;
381#[cfg(feature = "profiling")]
382pub mod profiling;
383#[cfg(feature = "random")]
384pub mod random;
385pub mod resource;
386#[cfg(feature = "simd")]
387pub mod simd;
388pub mod simd_aligned;
389pub mod simd_ops;
390#[cfg(feature = "testing")]
391pub mod testing;
392// Universal Functions (ufuncs) module
393pub mod error_templates;
394pub mod safe_ops;
395#[cfg(feature = "types")]
396pub mod types;
397#[cfg(feature = "ufuncs")]
398pub mod ufuncs;
399pub mod units;
400pub mod utils;
401pub mod validation;
402
403// Production-level features for enterprise deployments
404pub mod observability;
405pub mod stability;
406pub mod versioning;
407
408// Advanced optimization and AI features
409pub mod neural_architecture_search;
410pub mod quantum_optimization;
411
412// Advanced Mode Ecosystem Integration
413pub mod advanced_ecosystem_integration;
414
415// Advanced JIT Compilation Framework
416pub mod advanced_jit_compilation;
417
418// Advanced Distributed Computing Framework
419pub mod advanced_distributed_computing;
420
421// Advanced Cloud Storage Framework
422// pub mod distributed_storage; // Module not implemented yet
423
424// Advanced Tensor Cores and Automatic Kernel Tuning Framework
425pub mod advanced_tensor_cores;
426
427// Tensor cores optimization modules
428#[cfg(feature = "gpu")]
429pub mod tensor_cores;
430
431// Benchmarking module
432#[cfg(feature = "benchmarking")]
433pub mod benchmarking;
434
435// Re-exports
436#[cfg(feature = "cache")]
437pub use crate::cache::*;
438#[cfg(feature = "cloud")]
439pub use crate::cloud::{
440 CloudConfig, CloudCredentials, CloudError, CloudObjectMetadata, CloudProvider,
441 CloudStorageClient, EncryptionConfig, EncryptionMethod, HttpMethod, ListResult,
442 TransferOptions,
443};
444pub use crate::config::production as config_production;
445pub use crate::config::{
446 get_config, get_config_value, set_config_value, set_global_config, Config, ConfigValue,
447};
448pub use crate::constants::{math, physical, prefixes};
449#[allow(ambiguous_glob_reexports)]
450pub use crate::error::*;
451
452// Re-export the array! macro for convenient array creation
453// This addresses the common pain point where users expect array! to be available
454// directly from scirs2_core instead of requiring import from scirs2_autograd
455//
456// # Example
457//
458// ```rust
459// use scirs2_core::array;
460//
461// let matrix = array![[1, 2, 3], [4, 5, 6]];
462// assert_eq!(matrix.shape(), &[2, 3]);
463// ```
464#[cfg(feature = "gpu")]
465pub use crate::gpu::*;
466pub use crate::io::*;
467#[cfg(feature = "jit")]
468pub use crate::jit::DataType as JitDataType;
469#[cfg(feature = "jit")]
470pub use crate::jit::{
471 CompiledKernel, ExecutionProfile, JitBackend, JitCompiler, JitConfig, JitError, KernelLanguage,
472 KernelSource, OptimizationLevel, TargetArchitecture,
473};
474#[cfg(feature = "logging")]
475pub use crate::logging::*;
476#[cfg(feature = "memory_management")]
477pub use crate::memory::{
478 format_memory_report, generate_memory_report, global_buffer_pool, track_allocation,
479 track_deallocation, track_resize, BufferPool, ChunkProcessor, ChunkProcessor2D,
480 GlobalBufferPool, ZeroCopyView,
481};
482// Legacy re-export from ndarray_ext (kept for backward compatibility)
483pub use crate::ndarray_ext::array as array_legacy;
484
485// Complete ndarray functionality through the unified module
486pub use crate::ndarray::{
487 arr1,
488 arr2,
489 // Essential macros - now available at crate root
490 array,
491 s,
492 // Common types for convenience
493 Array,
494 Array1,
495 Array2,
496 ArrayD,
497 ArrayView,
498 ArrayView1,
499 ArrayView2,
500 ArrayViewMut,
501 Axis,
502 Ix1,
503 Ix2,
504 IxDyn,
505};
506
507#[cfg(feature = "leak_detection")]
508pub use crate::memory::{
509 LeakCheckGuard, LeakDetectionConfig, LeakDetector, LeakReport, LeakType, MemoryCheckpoint,
510 MemoryLeak, ProfilerTool,
511};
512
513#[cfg(feature = "memory_efficient")]
514pub use crate::memory_efficient::{
515 chunk_wise_binary_op, chunk_wise_op, chunk_wise_reduce, create_disk_array, create_mmap,
516 create_temp_mmap, diagonal_view, evaluate, load_chunks, open_mmap, register_fusion,
517 transpose_view, view_as, view_mut_as, AccessMode, AdaptiveChunking, AdaptiveChunkingBuilder,
518 AdaptiveChunkingParams, AdaptiveChunkingResult, ArithmeticOps, BroadcastOps, ChunkIter,
519 ChunkedArray, ChunkingStrategy, DiskBackedArray, FusedOp, LazyArray, LazyOp, LazyOpKind,
520 MemoryMappedArray, MemoryMappedChunkIter, MemoryMappedChunks, MemoryMappedSlice,
521 MemoryMappedSlicing, OpFusion, OutOfCoreArray, ViewMut, ZeroCopyOps,
522};
523
524// Compression-related types are only available with the memory_compression feature
525#[cfg(feature = "memory_compression")]
526pub use crate::memory_efficient::{
527 CompressedMemMapBuilder, CompressedMemMappedArray, CompressionAlgorithm,
528};
529
530// Re-export the parallel memory-mapped array capabilities
531#[cfg(all(feature = "memory_efficient", feature = "parallel"))]
532pub use crate::memory_efficient::MemoryMappedChunksParallel;
533
534#[cfg(feature = "array")]
535pub use crate::array::{
536 is_masked, mask_array, masked_equal, masked_greater, masked_inside, masked_invalid,
537 masked_less, masked_outside, masked_where, record_array_from_typed_arrays,
538 record_array_fromrecords, ArrayError, FieldValue, MaskedArray, Record, RecordArray, NOMASK,
539};
540
541#[cfg(feature = "memory_metrics")]
542pub use crate::memory::metrics::{
543 clear_snapshots,
544 compare_snapshots,
545 // Utility functions
546 format_bytes,
547 format_duration,
548 take_snapshot,
549 MemoryEvent,
550 MemoryEventType,
551 // Core metrics types
552 MemoryMetricsCollector,
553 MemoryMetricsConfig,
554 // Memory snapshots and leak detection
555 MemorySnapshot,
556 SnapshotDiff,
557 // Tracked memory components
558 TrackedBufferPool,
559 TrackedChunkProcessor,
560 TrackedChunkProcessor2D,
561};
562
563#[cfg(feature = "types")]
564pub use crate::batch_conversions::{
565 utils as batch_utils, BatchConversionConfig, BatchConversionResult, BatchConverter,
566 ElementConversionError,
567};
568#[cfg(all(feature = "memory_metrics", feature = "gpu"))]
569pub use crate::memory::metrics::{setup_gpu_memory_tracking, TrackedGpuBuffer, TrackedGpuContext};
570pub use crate::metrics::{
571 global_healthmonitor, global_metrics_registry, Counter, Gauge, HealthCheck, HealthMonitor,
572 HealthStatus, Histogram, MetricPoint, MetricType, MetricValue, Timer,
573};
574#[cfg(feature = "ml_pipeline")]
575pub use crate::ml_pipeline::DataType as MLDataType;
576#[cfg(feature = "ml_pipeline")]
577pub use crate::ml_pipeline::{
578 DataBatch, DataSample, FeatureConstraint, FeatureSchema, FeatureTransformer, FeatureValue,
579 MLPipeline, MLPipelineError, ModelPredictor, ModelType, PipelineConfig, PipelineMetrics,
580 PipelineNode, TransformType,
581};
582pub use crate::numeric::*;
583#[cfg(feature = "parallel")]
584pub use crate::parallel::*;
585#[cfg(feature = "parallel")]
586pub use crate::parallel_ops::{
587 is_parallel_enabled, num_threads, par_chunks, par_chunks_mut, par_join, par_scope,
588};
589// Re-export all parallel traits and types
590#[cfg(feature = "parallel")]
591pub use crate::parallel_ops::*;
592#[cfg(feature = "profiling")]
593pub use crate::profiling::{profiling_memory_tracker, Profiler};
594#[cfg(feature = "random")]
595#[allow(ambiguous_glob_reexports)]
596pub use crate::random::*;
597pub use crate::resource::{
598 get_available_memory, get_performance_tier, get_recommended_chunk_size,
599 get_recommended_thread_count, get_system_resources, get_total_memory, is_gpu_available,
600 is_simd_supported, DiscoveryConfig, PerformanceTier, ResourceDiscovery, SystemResources,
601};
602#[cfg(feature = "simd")]
603pub use crate::simd::*;
604#[cfg(feature = "testing")]
605pub use crate::testing::{TestConfig, TestResult, TestRunner, TestSuite};
606#[cfg(feature = "types")]
607pub use crate::types::{convert, ComplexConversionError, ComplexExt, ComplexOps};
608
609// Re-export complex number types for SCIRS2 POLICY compliance
610pub use num_complex::{Complex, Complex32, Complex64};
611
612// Re-export RNG types for SCIRS2 POLICY compliance
613pub use crate::units::{
614 convert, global_unit_registry, unit_value, Dimension, UnitDefinition, UnitRegistry, UnitSystem,
615 UnitValue,
616};
617pub use crate::utils::*;
618pub use crate::validation::production as validation_production;
619pub use crate::validation::{
620 check_finite, check_in_bounds, check_positive, checkarray_finite, checkshape,
621};
622pub use rand_chacha::{ChaCha12Rng, ChaCha20Rng, ChaCha8Rng};
623
624// ================================
625// Prelude Module
626// ================================
627
628/// Convenient re-exports of commonly used items
629///
630/// Import this module to get quick access to the most frequently used
631/// types, traits, and functions in the SciRS2 ecosystem without needing
632/// to remember specific import paths.
633///
634/// # Example
635///
636/// ```rust
637/// use scirs2_core::prelude::*;
638///
639/// let data = array![[1.0, 2.0], [3.0, 4.0]];
640/// ```
641pub mod prelude;
642
643#[cfg(feature = "data_validation")]
644pub use crate::validation::data::DataType as ValidationDataType;
645#[cfg(feature = "data_validation")]
646pub use crate::validation::data::{
647 Constraint, FieldDefinition, ValidationConfig, ValidationError, ValidationResult,
648 ValidationRule, ValidationSchema, Validator,
649};
650
651// Production-level feature re-exports
652pub use crate::observability::{audit, tracing};
653pub use crate::stability::{
654 global_stability_manager, ApiContract, BreakingChange, BreakingChangeType, ConcurrencyContract,
655 MemoryContract, NumericalContract, PerformanceContract, StabilityGuaranteeManager,
656 StabilityLevel, UsageContext,
657};
658pub use crate::versioning::{
659 compatibility, deprecation, migration, negotiation, semantic, ApiVersion, CompatibilityLevel,
660 SupportStatus, Version, VersionManager,
661};
662
663// Advanced optimization and AI feature re-exports
664pub use crate::neural_architecture_search::{
665 ActivationType, Architecture, ArchitecturePerformance, ConnectionType, HardwareConstraints,
666 LayerType, NASStrategy, NeuralArchitectureSearch, OptimizationObjectives, OptimizerType,
667 SearchResults, SearchSpace,
668};
669pub use crate::quantum_optimization::{
670 OptimizationResult, QuantumOptimizer, QuantumParameters, QuantumState, QuantumStrategy,
671};
672
673// Advanced JIT Compilation re-exports
674// pub use crate::advanced_jit_compilation::{
675// AdaptiveCodeGenerator, CompilationStatistics, JitAnalytics, JitCompilerConfig, JitProfiler,
676// KernelCache, KernelMetadata, KernelPerformance, LlvmCompilationEngine, OptimizationResults,
677// PerformanceImprovement, RuntimeOptimizer, advancedJitCompiler,
678// }; // Missing module
679
680// Advanced Cloud Storage re-exports
681// pub use crate::distributed_storage::{
682// AdaptiveStreamingEngine, CloudPerformanceAnalytics, CloudProviderConfig, CloudProviderId,
683// CloudProviderType, CloudSecurityManager, CloudStorageMonitoring, CloudStorageProvider,
684// DataOptimizationEngine, DownloadRequest, DownloadResponse, IntelligentCacheSystem,
685// ParallelTransferManager, StreamRequest, advancedCloudConfig,
686// advancedCloudStorageCoordinator, UploadRequest, UploadResponse,
687// };
688
689// Benchmarking re-exports
690#[cfg(feature = "benchmarking")]
691pub use crate::benchmarking::{
692 BenchmarkConfig, BenchmarkMeasurement, BenchmarkResult, BenchmarkRunner, BenchmarkStatistics,
693 BenchmarkSuite,
694};
695
696/// ``SciRS2`` core version information
697pub const fn _version() -> &'static str {
698 env!("CARGO_PKG_VERSION")
699}
700
701/// Initialize the library (called automatically)
702#[doc(hidden)]
703#[allow(dead_code)]
704pub fn __init() {
705 use std::sync::Once;
706 static INIT: Once = Once::new();
707
708 INIT.call_once(|| {
709 // Initialize API freeze registry
710 crate::api_freeze::initialize_api_freeze();
711 });
712}
713
714// Ensure initialization happens
715#[doc(hidden)]
716#[used]
717#[cfg_attr(target_os = "linux", link_section = ".init_array")]
718#[cfg_attr(target_os = "macos", link_section = "__DATA,__mod_init_func")]
719#[cfg_attr(target_os = "windows", link_section = ".CRT$XCU")]
720static INIT: extern "C" fn() = {
721 extern "C" fn __init_wrapper() {
722 __init();
723 }
724 __init_wrapper
725};