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
//! `ndatafusion` provides linear algebra and machine learning scalar and aggregate UDFs for
//! `DataFusion`.
//!
//! Register the scalar and aggregate catalog with [`register_all`], or register the full SQL
//! surface including table functions with [`register_all_session`]. Call the functions from SQL or
//! by constructing expressions with helpers from [`functions`].
//!
//! The current catalog supports `Float32` and `Float64` across dense vector, dense matrix, sparse
//! CSR, fixed-shape tensor, variable-shape tensor, grouped statistics/model fits, and selected
//! solver routines. The current complex-valued slice covers dense vector, dense matrix,
//! complex PCA, fixed-shape tensor, and variable-shape tensor operations over canonical
//! `ndarrow.complex64` columns.
//!
//! Use the `make_*` constructor family when SQL starts from ordinary `List` values. If a table
//! already stores canonical `FixedSizeList` or extension-backed Arrow values, call the numerical
//! UDFs directly. Selected constructor, aggregate, and control-parameter UDFs also support named
//! arguments in SQL. For numerical UDFs, prefer positional data arguments first and named trailing
//! control arguments after.
//!
//! # Quick Start
//!
//! ```no_run
//! use datafusion::prelude::SessionContext;
//!
//! #[tokio::main]
//! async fn main() -> datafusion::common::Result<()> {
//! let mut ctx = SessionContext::new();
//! ndatafusion::register_all(&mut ctx)?;
//!
//! let batches = ctx
//! .sql(
//! "SELECT
//! vector_dot(make_vector(left_values, 2), make_vector(right_values, 2)) AS dot,
//! matrix_determinant(make_matrix(matrix_values, 2, 2)) AS det
//! FROM (
//! SELECT
//! [3.0, 4.0] AS left_values,
//! [4.0, 0.0] AS right_values,
//! [9.0, 0.0, 0.0, 4.0] AS matrix_values
//! )",
//! )
//! .await?
//! .collect()
//! .await?;
//!
//! assert_eq!(batches[0].num_rows(), 1);
//! Ok(())
//! }
//! ```
//!
//! # Constructors
//!
//! The constructor UDFs convert ordinary nested `List` values into the canonical Arrow contracts
//! used by the numerical catalog. They are not required when input columns already use those
//! canonical contracts:
//!
//! - `make_vector`
//! - `make_matrix`
//! - `make_tensor`
//! - `make_variable_tensor`
//! - `make_csr_matrix_batch`
//!
//! # Included UDF Groups
//!
//! The registered catalog includes:
//!
//! - constructors for canonical numerical values
//! - dense vector operations, including the current complex-vector subset
//! - complex dense matrix products, statistics, iterative solvers, matrix functions, and the
//! current complex eigen / Schur / polar subset
//! - dense matrix operations, decompositions, direct solvers, and Sylvester matrix equations
//! - sparse CSR operations
//! - fixed-shape and variable-shape tensor operations, including the current complex tensor subset
//! - differentiation, optimization, and matrix-equation helpers
//! - statistics, real and complex PCA, iterative solvers, and linear regression
//! - grouped aggregate fits for covariance, correlation, PCA, and linear regression
//! - sparse factorization, tensor decomposition, and the `unpack_struct` table function via
//! [`register_all_session`]
//!
//! For the complete SQL function inventory and notes on result contracts, see `CATALOG.md` in the
//! repository root. For small copy-paste query examples, see `EXERCISES.md`.
//!
//! ## Features
//!
//! Feature forwarding follows `nabled` directly:
//!
//! * `blas`
//! * `lapack-provider`
//! * `openblas-system`
//! * `openblas-static`
//! * `netlib-system`
//! * `netlib-static`
//! * `magma-system`
//! * `accelerator-rayon`
//! * `accelerator-wgpu`
pub
pub
pub
pub
pub use ;