1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
//! # Tensor Operations and Data Structures
//! テンソル操作とデータ構造
//!
//! This module provides the core tensor functionality for RusTorch, including
//! basic tensor operations, advanced parallel processing, GPU acceleration,
//! and memory optimization features.
//!
//! ## Core Components
//!
//! - `core`: The main tensor data structure with n-dimensional array support
//! - `operations`: Mathematical operations and arithmetic for tensors
//! - `parallel_traits`: Unified parallel tensor operations system
//! - `gpu_parallel`: GPU-accelerated tensor operations with device management
//! - `memory_optimized`: Advanced memory management strategies
//! - `zero_copy`: Zero-copy tensor views and shared ownership
//! - `simd_aligned`: SIMD-aligned tensor operations for vectorization
//!
//! ## Key Features
//!
//! ### High-Performance Computing
//! - **Parallel Processing**: Automatic parallelization for large tensor operations
//! - **SIMD Acceleration**: AVX2/SSE4.1 vectorized operations for f32 tensors
//! - **GPU Integration**: CUDA/Metal/OpenCL support with intelligent fallback
//! - **Memory Optimization**: Pool allocation, zero-copy views, and cache-friendly operations
//!
//! ### Mathematical Operations
//! - **Element-wise Operations**: Addition, multiplication, trigonometric functions
//! - **Linear Algebra**: Matrix multiplication, decompositions, eigenvalues
//! - **Broadcasting**: NumPy-style broadcasting for operations on different shapes
//! - **Reduction Operations**: Sum, mean, variance, and statistical functions
//!
//! ### Memory Management
//! - **Zero-Copy Views**: Efficient tensor slicing without data duplication
//! - **Memory Pooling**: Reduced allocation overhead for frequent operations
//! - **SIMD Alignment**: 32-byte aligned allocation for optimal vectorization
//! - **Shared Ownership**: Thread-safe reference counting for tensor sharing
//!
//! ## Usage Examples
//!
//! ### Basic Tensor Operations
//!
//! ```rust
//! use rustorch::tensor::Tensor;
//!
//! // Create tensors
//! let a = Tensor::<f32>::ones(&[3, 3]);
//! let b = Tensor::<f32>::zeros(&[3, 3]);
//!
//! // Basic arithmetic
//! let c = &a + &b;
//! let d = a.matmul(&b);
//!
//! // Mathematical functions (using ndarray methods)
//! let e = a.data.mapv(|x| x.sin());
//! let f = a.data.mapv(|x| x.exp());
//! ```
//!
//! ### Parallel Operations
//!
//! RusTorch provides efficient parallel tensor operations for high-performance computing.
//!
//! ### GPU Acceleration
//!
//! RusTorch supports GPU acceleration with automatic fallback to CPU when GPU is unavailable.
//!
//! ### Memory Optimization
//!
//! Advanced memory management strategies for optimal performance and memory usage.
use Float;
/// Core tensor data structure
/// コアテンソルデータ構造
/// Device management for tensor operations
/// テンソル操作用デバイス管理
/// Mathematical operations for tensors (legacy - replaced by ops)
/// テンソルの数学演算(レガシー - opsに置換)
// pub mod operations; // Disabled - replaced by ops/ modules
/// Complex number support for tensors
/// テンソルの複素数サポート
/// Modular complex number implementation
/// モジュール化された複素数実装
/// Numeric safety and overflow protection
/// 数値安全性とオーバーフロー保護
/// Organized tensor operations by category (new modular system)
/// カテゴリ別に整理されたテンソル操作(新しいモジュールシステム)
/// Parallel tensor operations module
/// 並列テンソル演算モジュール
/// Type-safe tensor operations with compile-time verification
/// コンパイル時検証付きの型安全テンソル操作
/// Modern memory management system
/// 現代的なメモリ管理システム
/// Organized tensor operations by category (trait-based system)
/// カテゴリ別に整理されたテンソル操作(トレイトベースシステム)
/// Parallel tensor operations for batch processing and SIMD acceleration
/// バッチ処理とSIMD加速のための並列テンソル操作
/// Convenient macros for tensor creation with literal syntax
/// リテラル構文によるテンソル作成のための便利なマクロ
/// Shared operations between regular and WASM tensors
/// 通常テンソルとWASMテンソル間の共通操作
/// Phase 8: Advanced tensor utilities for conditional, indexing, and statistical operations
/// フェーズ8: 条件、インデックス、統計操作のための高度なテンソルユーティリティ
// Enable modules step by step
// mod broadcasting; // Temporarily disabled to avoid conflicts with shape_operations
// Re-export important types and functions
pub use crateRusTorchResult as ParallelResult;
pub use Tensor;
pub use Device;
// Re-export commonly used traits for better ergonomics
pub use ;
pub use ;