### Quick Start: Image Processing Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-ndimage/README.md A basic example demonstrating image creation, Gaussian filtering, and morphological dilation using scirs2-ndimage. ```rust use scirs2_ndimage::{filters, morphology}; use scirs2_core::ndarray::Array2; fn main() -> Result<(), Box> { let image = Array2::::from_shape_fn((100, 100), |(i, j)| { if (i > 30 && i < 70) && (j > 30 && j < 70) { 1.0 } else { 0.0 } }); // Gaussian smoothing let smoothed = filters::gaussian_filter(&image, 2.0, None, None)?; // Morphological dilation let struct_elem = morphology::structuring::generate_disk(3)?; let dilated = morphology::binary_dilation(&image, &struct_elem, None, None)?; println!("Image processed: {:?}", smoothed.shape()); Ok(()) } ``` -------------------------------- ### Run an Example with Cargo Source: https://github.com/cool-japan/scirs/blob/master/scirs2-integrate/examples/README.md Demonstrates the command to execute a specific example using Cargo. Replace `` with the desired example's name. ```bash cargo run --example ``` -------------------------------- ### Run SciRS2 Neural Showcase Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-neural/examples/README.md Execute the 'ultrathink_neural_showcase' example, which demonstrates comprehensive ultrathink functionalities. ```bash cargo run --example ultrathink_neural_showcase ``` -------------------------------- ### Run SciRS2 Neural Practical Training Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-neural/examples/README.md Execute the 'ultrathink_practical_training' example, showcasing a practical training pipeline. ```bash cargo run --example ultrathink_practical_training ``` -------------------------------- ### Run Specific Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-core/examples/README.md Use this command to run a specific example from the scirs2-core library. Replace `` with the name of the example and `` with the necessary features listed in Cargo.toml. ```bash cargo run --example --features ``` -------------------------------- ### Basic Setup for scirs2-autograd Source: https://github.com/cool-japan/scirs/blob/master/scirs2-autograd/docs/QUICK_REFERENCE.md Demonstrates the basic setup for using scirs2-autograd, including necessary imports and the run context. ```rust use scirs2_autograd as ag; use ag::tensor_ops::*; use ag::prelude::*; ag::run(|ctx| { // Your code here }); ``` -------------------------------- ### Run Adaptive Monte Carlo Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-integrate/docs/examples/adaptive_monte_carlo.md Execute the adaptive Monte Carlo integration example using Cargo. This command runs the example which automatically analyzes function properties and selects the optimal integration strategy. ```bash cargo run --example adaptive_monte_carlo ``` -------------------------------- ### Install Python Dependencies for Benchmarking Source: https://github.com/cool-japan/scirs/blob/master/benches/V020_BENCHMARKS.md Installs necessary Python libraries for running comparison benchmarks. ```bash pip install numpy scipy pandas matplotlib ``` -------------------------------- ### Matrix Decomposition Examples Source: https://github.com/cool-japan/scirs/blob/master/scirs2-autograd/docs/QUICK_REFERENCE.md Provides examples for various matrix decomposition techniques including QR, LU, SVD, Cholesky, and Eigendecomposition. ```rust let (q, r) = qr(&a); // QR decomposition ``` ```rust let (l, u, p) = lu(&a); // LU with pivoting ``` ```rust let (u, s, v) = svd(&a); // Singular value decomposition ``` ```rust let chol = cholesky(&pd_matrix); // Cholesky (positive definite) ``` ```rust let (vals, vecs) = eigen(&a); // Eigendecomposition ``` ```rust let vals_only = eigenvalues(&a); // Eigenvalues only ``` -------------------------------- ### Run SciRS2 Neural XOR Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-neural/examples/README.md Execute the 'neural_network_xor' example, demonstrating a simple XOR neural network. ```bash cargo run --example neural_network_xor ``` -------------------------------- ### Serve Example Web App for Interactive Testing Source: https://github.com/cool-japan/scirs/blob/master/scirs2-wasm/WASM_GUIDE.md Set up and run the example web application locally for interactive testing. Navigate to http://localhost:8080 in your browser. ```bash cd www npm install npm start ``` -------------------------------- ### Build and Serve Documentation Locally Source: https://github.com/cool-japan/scirs/blob/master/docs/en/src/contributing/setup.md Install mdbook and then build and serve the documentation locally. This allows for previewing changes to the book. ```bash # Install mdbook cargo install mdbook # Build and serve cd docs/en mdbook serve --open ``` -------------------------------- ### Install SciRS2 Neural Crate with Visualization Support Source: https://github.com/cool-japan/scirs/blob/master/scirs2-neural/examples/README.md Install the scirs2-neural crate with optional visualization features. This enables the use of visualization-specific examples and functionalities. ```bash cargo add scirs2-neural --features="visualization" ``` -------------------------------- ### Install evcxr Jupyter Kernel Source: https://github.com/cool-japan/scirs/blob/master/notebooks/01_getting_started.ipynb Install the evcxr Jupyter kernel to use Rust in Jupyter notebooks. This is a prerequisite for running the following code examples. ```bash cargo install --locked evcxr_jupyter evcxr_jupyter --install ``` -------------------------------- ### Install and Run Tests with cargo-nextest Source: https://github.com/cool-japan/scirs/blob/master/docs/en/src/contributing/setup.md Install cargo-nextest and run all tests in the workspace, excluding specific crates. This command is useful for a comprehensive test run without resource-intensive examples. ```bash # Install nextest cargo install cargo-nextest # Run all tests (excluding Python bindings and heavy dataset examples) cargo nextest run --all-features --workspace \ --exclude scirs2-python \ --exclude scirs2-datasets ``` -------------------------------- ### Run All Tutorials Source: https://github.com/cool-japan/scirs/blob/master/scirs2-optimize/docs/GETTING_STARTED.md A main function to execute all tutorial functions sequentially. Ensures all examples are run and provides a final success message. ```rust fn main() -> Result<(), Box> { tutorial_1()?; tutorial_2()?; tutorial_3()?; tutorial_4()?; tutorial_5()?; println!("🎉 All tutorials completed successfully!"); println!("You're ready to tackle real optimization problems!"); Ok(()) } ``` -------------------------------- ### Verify scirs2-optimize Installation Source: https://github.com/cool-japan/scirs/blob/master/scirs2-optimize/docs/GETTING_STARTED.md A basic Rust program to confirm that scirs2-optimize is installed correctly and can perform a simple minimization. This example minimizes the quadratic function f(x) = x² using the BFGS method. ```rust // src/main.rs use scirs2_optimize::prelude::*; use ndarray::Array1; fn main() -> Result<(), Box> { println!("scirs2-optimize is working!"); // Simple quadratic function: f(x) = x² let func = |x: &ArrayView1| x[0].powi(2); let x0 = Array1::from_vec(vec![2.0]); let result = minimize(func, &x0, Method::BFGS, None)?; println!("Minimum found at: {:.6}", result.x[0]); println!("Function value: {:.6}", result.fun); Ok(()) } ``` -------------------------------- ### Complete Example: Solving Linear System and Gradient Calculation Source: https://github.com/cool-japan/scirs/blob/master/scirs2-autograd/docs/QUICK_REFERENCE.md A comprehensive example showing matrix creation, solving a linear system, QR decomposition, loss function definition, and gradient computation. ```rust use ndarray::array; use scirs2_autograd as ag; use ag::tensor_ops::*; use ag::prelude::*; fn main() { ag::run(|ctx| { // Create matrices let a = variable(array![[3.0, 1.0], [1.0, 2.0]], ctx); let b = convert_to_tensor(array![[5.0], [3.0]], ctx); // Solve linear system let x = solve(&a, &b); // Compute determinant let det = determinant(&a); // QR decomposition let (q, r) = qr(&a); // Create loss function let loss = sum_all(&square(&sub(&matmul(&a, &x), &b))) + square(&det); // Compute gradients let grads = grad(&[&loss], &[&a]); // Evaluate println!("Solution: {:?}", x.eval(ctx).unwrap()); println!("Determinant: {:?}", det.eval(ctx).unwrap()); println!("Gradient: {:?}", grads[0].eval(ctx).unwrap()); }); } ``` -------------------------------- ### Node.js Quick Start Source: https://github.com/cool-japan/scirs/blob/master/scirs2-wasm/README.md This example demonstrates how to use scirs2-wasm in a Node.js environment. It shows how to create a WasmArray and calculate its determinant and trace. ```javascript const scirs2 = require('scirs2-wasm'); async function main() { const matrix = scirs2.WasmArray.from_shape([2, 2], [1, 2, 3, 4]); const det = scirs2.det(matrix); const trace = scirs2.trace(matrix); console.log('Determinant:', det); console.log('Trace:', trace); } main(); ``` -------------------------------- ### Run Feature Detection Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Demonstrates feature detection and descriptor computation. Ensure your input image is placed in the examples/input/ directory. ```bash cargo run --example feature_detection ``` -------------------------------- ### Get Weight and Bias Ranges Source: https://github.com/cool-japan/scirs/blob/master/scirs2-optimize/docs/EXAMPLES.md Calculates the start and end indices for weights and biases for each layer in the neural network. This is useful for parameter management. ```rust fn get_weight_ranges(&self) -> Vec<(usize, usize)> { let mut ranges = Vec::new(); let mut start = 0; for i in 0..self.architecture.len() - 1 { let weight_count = self.architecture[i] * self.architecture[i + 1]; let bias_count = self.architecture[i + 1]; ranges.push((start, start + weight_count)); ranges.push((start + weight_count, start + weight_count + bias_count)); start += weight_count + bias_count; } ranges } ``` -------------------------------- ### ArrayProtocol Usage Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-core/docs/api_reference.md Demonstrates how to use the ArrayProtocol trait with ndarray's Array2 to get shape, dimension, and length information. Requires the ndarray crate. ```rust use scirs2_core::array_protocol::ArrayProtocol; use ndarray::Array2; let matrix = Array2::::zeros((100, 50)); assert_eq!(matrix.shape(), &[100, 50]); assert_eq!(matrix.ndim(), 2); assert_eq!(matrix.len(), 5000); ``` -------------------------------- ### Environment Setup and Version Check Source: https://github.com/cool-japan/scirs/blob/master/scirs2-python/notebooks/performance_comparison.ipynb Imports necessary libraries and prints their versions. This is typically run at the beginning of a notebook to ensure the correct environment is set up. ```python import numpy as np import scipy.linalg import scipy.fft import scipy.interpolate import scirs2 import timeit RNG = np.random.default_rng(42) print(f'NumPy : {np.__version__}') print(f'SciPy : {scipy.__version__}') print(f'scirs2 : {scirs2.__version__}') ``` -------------------------------- ### Protein Folding Energy Minimization Source: https://github.com/cool-japan/scirs/blob/master/scirs2-optimize/docs/EXAMPLES.md Example demonstrating protein folding energy minimization using scirs2-optimize. Includes problem setup, optimization approach, and result analysis. ```python from scirs2_optimize.optimize import Optimizer from scirs2_optimize.problems.protein import ProteinFolding # Define the protein folding problem problem = ProteinFolding(sequence="AG") # Initialize the optimizer optimizer = Optimizer(problem) # Run the optimization result = optimizer.optimize() # Print the result print(result) ``` -------------------------------- ### TypeScript Quick Start Source: https://github.com/cool-japan/scirs/blob/master/scirs2-wasm/README.md This example shows how to use scirs2-wasm with TypeScript. It includes initializing the WASM module, creating a WasmMatrix, performing SVD, and checking for SIMD support. ```typescript import init, * as scirs2 from 'scirs2-wasm'; async function main(): Promise { await init(); // WasmMatrix for 2D linear algebra const mat: scirs2.WasmMatrix = scirs2.WasmMatrix.from_rows([ [1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0], ]); const svd = scirs2.svd(mat); console.log('Singular values:', svd.s.to_array()); // Check SIMD availability console.log('SIMD support:', scirs2.has_simd_support()); } main(); ``` -------------------------------- ### Run Edge Detection Comparison Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Compares different edge detection algorithms including Sobel, Canny, Prewitt, Laplacian, and Laplacian of Gaussian. Input images should be in examples/input/. ```bash cargo run --example edge_detection_comparison ``` -------------------------------- ### Distributed Tracing Setup with Jaeger in Rust Source: https://github.com/cool-japan/scirs/blob/master/scirs2-core/docs/PRODUCTION_OPERATIONS.md Configures distributed tracing for the SciRS2 Core application, setting service name, version, environment, and sampling rate. It then installs a Jaeger exporter. ```rust use scirs2_core::observability::tracing::{TracingConfig, JaegerExporter}; // Configure distributed tracing let tracing_config = TracingConfig::new() .with_service_name("scirs2-core") .with_service_version("1.0.0") .with_environment("production") .with_sampling_rate(0.1); // 10% sampling in production // Export to Jaeger let jaeger_exporter = JaegerExporter::new("http://jaeger:14268/api/traces")?; jaeger_exporter.install_global(tracing_config)?; // Trace operations use scirs2_core::observability::tracing::{trace_span, Span}; fn compute_matrix_multiplication(a: &Array2, b: &Array2) -> CoreResult> { let _span = trace_span!("matrix_multiplication") .with_attribute("matrix_a_shape", format!("{:?}", a.shape())) .with_attribute("matrix_b_shape", format!("{:?}", b.shape())); // Computation logic here Ok(result) } ``` -------------------------------- ### Run SciRS2 Neural Example with Visualization Source: https://github.com/cool-japan/scirs/blob/master/scirs2-neural/examples/README.md Execute the 'model_visualization_example' with visualization features enabled using the 'visualization' flag. ```bash cargo run --example model_visualization_example --features="visualization" ``` -------------------------------- ### Run Image Segmentation Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Demonstrates thresholding and segmentation techniques for image analysis. Input images are expected in the examples/input/ directory. ```bash cargo run --example image_segmentation ``` -------------------------------- ### Quick Start: Minimize Rosenbrock Function with BFGS Source: https://github.com/cool-japan/scirs/blob/master/scirs2-optimize/docs/README.md This example demonstrates how to use the `minimize` function with the BFGS algorithm to find the minimum of the Rosenbrock function. It requires importing necessary types from `scirs2_optimize::prelude` and `ndarray::Array1`. ```rust use scirs2_optimize::prelude::*; use ndarray::Array1; fn main() -> Result<(), Box> { // Define the Rosenbrock function let rosenbrock = |x: &ArrayView1| -> f64 { let (a, b) = (1.0, 100.0); (a - x[0]).powi(2) + b * (x[1] - x[0].powi(2)).powi(2) }; // Starting point let x0 = Array1::from_vec(vec![-1.2, 1.0]); // Optimize let result = minimize(rosenbrock, &x0, Method::BFGS, None)?; println!("Solution: [{:.6}, {:.6}]", result.x[0], result.x[1]); println!("Function value: {:.2e}", result.fun); println!("Converged: {}", result.success); Ok(()) } ``` -------------------------------- ### Constrained Optimization Tutorial Source: https://github.com/cool-japan/scirs/blob/master/scirs2-optimize/docs/GETTING_STARTED.md Demonstrates how to minimize a function subject to inequality and equality constraints using the SLSQP method. Requires defining the objective function, constraints, and an initial guess. ```rust use scirs2_optimize::constrained::*; fn tutorial_4() -> Result<(), Box> { println!("=== Tutorial 4: General Constrained Optimization ==="); // Problem: minimize (x-1)² + (y-2)² // Subject to: x + y ≤ 3 (inequality) // x² + y² = 5 (equality) let objective = |x: &ArrayView1| -> f64 { (x[0] - 1.0).powi(2) + (x[1] - 2.0).powi(2) }; // Inequality constraint: 3 - x - y ≥ 0 let ineq_constraint = |x: &ArrayView1| -> f64 { 3.0 - x[0] - x[1] }; // Equality constraint: x² + y² - 5 = 0 let eq_constraint = |x: &ArrayView1| -> f64 { x[0].powi(2) + x[1].powi(2) - 5.0 }; let constraints = vec![ Constraint { fun: Box::new(ineq_constraint), constraint_type: ConstraintType::Inequality, jac: None, // Auto-computed }, Constraint { fun: Box::new(eq_constraint), constraint_type: ConstraintType::Equality, jac: None, }, ]; // Starting point (on the circle x² + y² = 5) let x0 = Array1::from_vec(vec![2.0, 1.0]); let result = minimize_constrained( objective, &x0, &constraints, Method::SLSQP, None )?; println!("Solution: [{:.6}, {:.6}]", result.x[0], result.x[1]); println!("Objective value: {:.6}", result.fun); // Verify constraints let ineq_val = ineq_constraint(&result.x.view()); let eq_val = eq_constraint(&result.x.view()); println!("Inequality constraint (≥0): {:.6}", ineq_val); println!("Equality constraint (=0): {:.6}", eq_val); assert!(ineq_val >= -1e-6, "Inequality constraint violated"); assert!(eq_val.abs() < 1e-6, "Equality constraint violated"); println!("✓ Tutorial 4 completed successfully!\n"); Ok(()) } ``` -------------------------------- ### Browser Quick Start with ES Modules Source: https://github.com/cool-japan/scirs/blob/master/scirs2-wasm/README.md This example demonstrates basic usage of scirs2-wasm in a browser environment using ES Modules. It shows how to initialize the WASM module and perform array operations like addition, mean, and standard deviation. ```javascript import init, * as scirs2 from 'scirs2-wasm'; async function main() { await init(); const a = new scirs2.WasmArray([1, 2, 3, 4]); const b = new scirs2.WasmArray([5, 6, 7, 8]); const sum = scirs2.add(a, b); const mean = scirs2.mean(a); const std = scirs2.std(a); console.log('Sum:', sum.to_array()); console.log('Mean:', mean, 'Std:', std); } main(); ``` -------------------------------- ### Install SciRS2 from Source Source: https://github.com/cool-japan/scirs/blob/master/scirs2-python/docs/guides/quickstart.md Follow these steps to clone the repository, install Rust and maturin, and then build and install SciRS2 from source for development purposes. Test dependencies are also installed. ```bash # Clone repository git clone https://github.com/cool-japan/scirs.git cd scirs/scirs2-python # Install Rust if not already installed curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install maturin pip install maturin # Build and install maturin develop --release # Install test dependencies pip install pytest numpy scipy scikit-learn ``` -------------------------------- ### Run Color Transformations Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Shows color space conversions between RGB and HSV, and RGB and LAB. Input images should be in examples/input/. ```bash cargo run --example color_transformations ``` -------------------------------- ### Install SCIRS2 Python Source: https://github.com/cool-japan/scirs/blob/master/scirs2-python/docs/guides/troubleshooting.md Install the SCIRS2 Python library using pip. Ensure NumPy is also installed. ```bash pip install scirs2 pip install numpy ``` -------------------------------- ### Install Rust and Build scirs2-python Source: https://github.com/cool-japan/scirs/blob/master/scirs2-python/docs/guides/troubleshooting.md Installs Rust using rustup, updates it, installs maturin, and then builds the scirs2-python package in development mode. ```bash # Install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Update Rust rustup update # Install maturin pip install maturin # Build cd scirs2-python maturin develop --release ``` -------------------------------- ### Build and Run Node.js Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-wasm/WASM_GUIDE.md Build the WASM module for Node.js and execute a sample Node.js script. ```bash wasm-pack build --target nodejs node examples/node_example.js ``` -------------------------------- ### Matrix Creation Examples Source: https://github.com/cool-japan/scirs/blob/master/scirs2-autograd/docs/QUICK_REFERENCE.md Shows how to create identity, diagonal, and extract diagonals from matrices. ```rust let identity = eye(3, ctx); // 3x3 identity matrix ``` ```rust let diag_mat = diag(&vector); // Diagonal matrix from vector ``` ```rust let diag_vec = extract_diag(&matrix); // Extract diagonal elements ``` -------------------------------- ### Run Corner Detection Comparison Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Compares different corner detection algorithms such as Harris, Shi-Tomasi, and FAST. Input images are expected in the examples/input/ directory. ```bash cargo run --example corner_detection_comparison ``` -------------------------------- ### Install cargo-scirs2-policy Source: https://github.com/cool-japan/scirs/blob/master/tools/cargo-scirs2-policy/README.md Install the tool using cargo. ```bash cargo install cargo-scirs2-policy ``` -------------------------------- ### Install wasm-opt (Binaryen) Source: https://github.com/cool-japan/scirs/blob/master/scirs2-wasm/WASM_GUIDE.md Installs `wasm-opt` from the Binaryen toolchain, used for optimizing WebAssembly binaries. Installation methods vary by OS or can be built from source. ```bash # macOS brew install binaryen # Ubuntu/Debian sudo apt-get install binaryen # From source git clone https://github.com/WebAssembly/binaryen cd binaryen && cmake . && make ``` -------------------------------- ### Run Noise Reduction Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Demonstrates various noise reduction techniques such as Gaussian blur, bilateral filtering, and median filtering. Input images are expected in examples/input/. ```bash cargo run --example noise_reduction ``` -------------------------------- ### Lorenz System Example in Rust Source: https://github.com/cool-japan/scirs/blob/master/scirs2-symbolic/TODO.md This example, located in the examples directory, demonstrates the use of scirs2_symbolic for discovering dynamics related to the Lorenz system, potentially using discover_multi. ```rust scirs2_symbolic::regression::discover_multi ``` -------------------------------- ### Global and Module Configuration Source: https://github.com/cool-japan/scirs/blob/master/docs/API_REFERENCE.md Demonstrates how to set global configuration parameters and module-specific configurations using ConfigBuilder and default configurations. ```rust use scirs2_core::config::{Config, ConfigBuilder}; // Global configuration let config = ConfigBuilder::new() .precision(1e-12) .parallel_threshold(1000) .gpu_memory_fraction(0.8) .build(); scirs2_core::config::set_global_config(config); // Module-specific configuration let linalg_config = scirs2_linalg::Config::default() .with_backend(scirs2_linalg::Backend::OxiBLAS) .with_threads(8); ``` -------------------------------- ### Run Non-Rigid Transformations Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Demonstrates non-rigid transformation methods including thin-plate splines and elastic deformations. Input images should be placed in examples/input/. ```bash cargo run --example non_rigid_transformations ``` -------------------------------- ### AdvancedBufferPool Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-core/docs/api_reference.md A practical example demonstrating how to configure and use the AdvancedBufferPool. ```APIDOC ## Example Usage ```rust use scirs2_core::memory::{AdvancedBufferPool, MemoryConfig, AllocationStrategy}; let config = MemoryConfig { strategy: AllocationStrategy::CacheAligned, alignment: 64, numa_aware: true, ..Default::default() }; let mut pool = AdvancedBufferPool::::with_config(config); let buffer = pool.acquire_vec_advanced(1000); // Use buffer for computation pool.release_vec_advanced(buffer); let report = pool.memory_report(); println!("Pool efficiency: {:.2}%", report.pool_efficiency * 100.0); ``` ``` -------------------------------- ### Physics Pipeline Example in Rust Source: https://github.com/cool-japan/scirs/blob/master/scirs2-symbolic/TODO.md An example demonstrating the use of scirs2_symbolic for physics applications, including data generation and regression discovery. This code is intended to be run as a Cargo example. ```rust scirs2_symbolic::regression::discover ``` -------------------------------- ### Testing the array! Macro Source: https://github.com/cool-japan/scirs/blob/master/scirs2-core/docs/ARRAY_MACRO_FIX.md Commands to run the example demonstrating the array! macro usage and to execute tests. ```bash cargo run --example array_macro_usage ``` ```bash cargo test array_macro_test ``` -------------------------------- ### Install SciRS2 for Development Source: https://github.com/cool-japan/scirs/blob/master/scirs2-python/README.md For development, install maturin and then use 'maturin develop' to build the Rust components from source. This method also avoids the need for system BLAS or FFTW installations. ```bash pip install maturin git clone https://github.com/cool-japan/scirs cd scirs/scirs2-python maturin develop --release ``` -------------------------------- ### Run Canny Edge Detection Example Source: https://github.com/cool-japan/scirs/blob/master/scirs2-vision/examples/README.md Demonstrates the Canny edge detector with various parameters. Ensure input images are in the examples/input/ directory. ```bash cargo run --example canny_edge_detection ``` -------------------------------- ### Pendulum Simulation Example in Rust Source: https://github.com/cool-japan/scirs/blob/master/scirs2-symbolic/TODO.md A runnable example demonstrating the use of the scirs2_symbolic library for simulating a pendulum. This example can be executed using Cargo and may utilize parallel and SIMD features. ```rust cargo run --example pendulum --features parallel,simd ``` -------------------------------- ### Run Specific Scenarios with Nextest Source: https://github.com/cool-japan/scirs/blob/master/scirs2-integration-tests/README.md Execute integration tests for specific module combinations by providing their corresponding keywords. Examples include 'neural' for autograd+neural, 'sparse_linalg' for linalg+sparse, and 'fft_signal' for signal+fft. ```bash # autograd + neural only cargo nextest run --all-features -p scirs2-integration-tests neural # linalg + sparse only cargo nextest run --all-features -p scirs2-integration-tests sparse_linalg # signal + fft only cargo nextest run --all-features -p scirs2-integration-tests fft_signal ``` -------------------------------- ### Quick Start: Symbolic Differentiation and Evaluation Source: https://github.com/cool-japan/scirs/blob/master/scirs2-symbolic/README.md Demonstrates building an expression, differentiating it symbolically, simplifying the result, and then evaluating it numerically. ```rust use scirs2_symbolic::{Expr, diff, simplify, eval}; use std::collections::HashMap; // Build the expression f(x) = x² + 3x let x = Expr::var("x"); let f = x.clone().pow(Expr::from(2.0)) + Expr::from(3.0) * x.clone(); // Differentiate symbolically: f'(x) = 2x + 3 let df = simplify(&diff(&f, "x")); println!("f'(x) = {}", df); // 2*x + 3 // Evaluate at x = 2: 2*2 + 3 = 7 let mut vars = HashMap::new(); vars.insert("x", 2.0_f64); let result = eval(&df, &vars).unwrap(); assert!((result - 7.0).abs() < 1e-10); ``` -------------------------------- ### Install wasm-pack Source: https://github.com/cool-japan/scirs/blob/master/scirs2-wasm/WASM_GUIDE.md Install the wasm-pack tool if you encounter the 'wasm-pack not found' error. ```bash cargo install wasm-pack ```