Skip to content

Commit 23b7a3a

Browse files
committed
Ver 0.40.0
- Move from `arrow2` -> `arrow` & `parquet` - Change CompressionOptions (please refer to RELEASES.md)
2 parents fa6bf9f + 0f2c2cf commit 23b7a3a

File tree

12 files changed

+319
-154
lines changed

12 files changed

+319
-154
lines changed

Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "peroxide"
3-
version = "0.39.11"
3+
version = "0.40.0"
44
authors = ["axect <axect@outlook.kr>"]
55
edition = "2018"
66
description = "Rust comprehensive scientific computation library contains linear algebra, numerical analysis, statistics and machine learning tools with farmiliar syntax"
@@ -48,10 +48,9 @@ lapack = { version = "0.19", optional = true }
4848
serde = { version = "1.0", features = ["derive"], optional = true }
4949
rkyv = { version = "0.8", optional = true }
5050
json = { version = "0.12", optional = true }
51-
arrow2 = { version = "0.18", features = [
52-
"io_parquet",
53-
"io_parquet_compression",
54-
], optional = true }
51+
parquet = { version = "55", features = ["arrow", "snap"], optional = true }
52+
arrow = { version = "55", optional = true }
53+
indexmap = { version = "1", optional = true }
5554
num-complex = { version = "0.4", optional = true }
5655
rayon = { version = "1.10", optional = true }
5756

@@ -63,6 +62,6 @@ default = []
6362
O3 = ["blas", "lapack"]
6463
plot = ["pyo3"]
6564
nc = ["netcdf"]
66-
parquet = ["arrow2"]
65+
parquet = ["dep:parquet", "arrow", "indexmap"]
6766
complex = ["num-complex", "matrixmultiply/cgemm"]
6867
parallel = ["rayon"]

RELEASES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Release 0.40.0 (2025-07-24)
2+
3+
## Move from `arrow2` to `arrow` & `parquet`
4+
5+
- Remove `arrow2` dependency
6+
- Add `arrow` and `parquet` dependencies
7+
- Update `WithParquet` implementation
8+
- On user side, there are almost no changes in `DataFrame` API, but there is one change for `fuga` user:
9+
- `CompressionOptions` -> `UNCOMPRESSED`, `SNAPPY`, `GZIP(level)`, `LZ4`, `ZSTD(level)`, `BROTLI(level)`, `LZO`, `LZ4_RAW`
10+
- For `prelude user`, there are completely no changes. Default compression is `SNAPPY`.
11+
112
# Release 0.39.11 (2025-07-22)
213

314
- Implement `derivative` and `integral` of B-Spline

examples/area_under_spline.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use peroxide::fuga::*;
21
use anyhow::Result;
2+
use peroxide::fuga::*;
33

44
fn main() -> Result<()> {
55
// 1. Define the B-spline
@@ -30,14 +30,18 @@ fn main() -> Result<()> {
3030
// 3. Perform numerical integration using self-contained Gauss-Legendre quadrature
3131
let t_start = 0f64;
3232
let t_end = 4f64;
33-
33+
3434
//let area = gauss_legendre_integrate(
3535
// |t| integrand(t, &spline, &deriv_spline),
3636
// t_start,
3737
// t_end,
3838
// 64,
3939
//);
40-
let area = integrate(|t| integrand(t, &spline, &deriv_spline), (t_start, t_end), G7K15R(1e-4, 20));
40+
let area = integrate(
41+
|t| integrand(t, &spline, &deriv_spline),
42+
(t_start, t_end),
43+
G7K15R(1e-4, 20),
44+
);
4145

4246
// 4. Print the result
4347
println!("The area under the B-spline curve (∫y dx) is: {}", area);
@@ -47,21 +51,24 @@ fn main() -> Result<()> {
4751
{
4852
let t = linspace(t_start, t_end, 200);
4953
let (x, y): (Vec<f64>, Vec<f64>) = spline.eval_vec(&t).into_iter().unzip();
50-
54+
5155
let mut plt = Plot2D::new();
5256
plt.set_title(&format!("Original B-Spline (Area approx. {:.4})", area))
5357
.set_xlabel("x")
5458
.set_ylabel("y")
5559
.insert_pair((x.clone(), y.clone()))
56-
.insert_pair((control_points.iter().map(|p| p[0]).collect(), control_points.iter().map(|p| p[1]).collect()))
60+
.insert_pair((
61+
control_points.iter().map(|p| p[0]).collect(),
62+
control_points.iter().map(|p| p[1]).collect(),
63+
))
5764
.set_plot_type(vec![(0, PlotType::Line), (1, PlotType::Scatter)])
5865
.set_color(vec![(0, "blue"), (1, "red")])
5966
.set_legend(vec!["Spline", "Control Points"])
6067
.set_style(PlotStyle::Nature)
6168
.set_path("example_data/bspline_with_area.png")
6269
.set_dpi(600)
6370
.savefig()?;
64-
71+
6572
println!("Generated plot: example_data/bspline_with_area.png");
6673
}
6774

examples/bspline_calculus.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use peroxide::fuga::*;
21
use anyhow::Result;
2+
use peroxide::fuga::*;
33

44
fn main() -> Result<()> {
55
// 1. Define the B-spline
@@ -53,7 +53,8 @@ fn main() -> Result<()> {
5353
let deriv_control_y: Vec<f64> = deriv_spline.control_points.iter().map(|p| p[1]).collect();
5454

5555
let mut plt_deriv = Plot2D::new();
56-
plt_deriv.set_title("B-Spline Derivative (Hodograph)")
56+
plt_deriv
57+
.set_title("B-Spline Derivative (Hodograph)")
5758
.set_xlabel("dx/dt")
5859
.set_ylabel("dy/dt")
5960
.insert_pair((dx, dy))
@@ -71,7 +72,8 @@ fn main() -> Result<()> {
7172
let integ_control_y: Vec<f64> = integ_spline.control_points.iter().map(|p| p[1]).collect();
7273

7374
let mut plt_integ = Plot2D::new();
74-
plt_integ.set_title("B-Spline Integral")
75+
plt_integ
76+
.set_title("B-Spline Integral")
7577
.set_xlabel("Integral of x")
7678
.set_ylabel("Integral of y")
7779
.insert_pair((ix, iy))

examples/df_parquet.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use peroxide::fuga::*;
2+
3+
fn main() -> Result<(), Box<dyn Error>> {
4+
#[cfg(feature = "parquet")]
5+
{
6+
let a = Series::new(vec![1, 2, 3, 4]);
7+
let b = Series::new(vec![0.1, 0.2, 0.3, 0.4]);
8+
let c = Series::new(vec![true, false, false, true]);
9+
let d = Series::new(
10+
vec!["a", "b", "c", "d"]
11+
.into_iter()
12+
.map(|x| x.to_string())
13+
.collect(),
14+
);
15+
16+
let mut df = DataFrame::new(vec![a, b, c, d]);
17+
df.set_header(vec!["a", "b", "c", "d"]);
18+
println!("Write:");
19+
df.print();
20+
21+
df.write_parquet("example_data/df_parquet.parquet", UNCOMPRESSED)?;
22+
23+
println!("\nRead:");
24+
let mut dg = DataFrame::read_parquet("example_data/df_parquet.parquet")?;
25+
dg.print();
26+
27+
println!("\nConvert:");
28+
dg[2].as_type(Bool);
29+
dg.print();
30+
}
31+
32+
Ok(())
33+
}

src/fuga/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
//! df.print();
122122
//!
123123
//! # #[cfg(feature="parquet")] {
124-
//! df.write_parquet("example_data/test.parquet", CompressionOptions::Uncompressed).unwrap();
124+
//! df.write_parquet("example_data/test.parquet", SNAPPY).unwrap();
125125
//! # }
126126
//! }
127127
//! ```
@@ -228,4 +228,4 @@ pub use crate::traits::matrix::{
228228
};
229229

230230
#[cfg(feature = "parquet")]
231-
pub use arrow2::io::parquet::write::CompressionOptions;
231+
pub use parquet::basic::Compression::*;

src/numerical/ode.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,9 +1291,7 @@ impl ODEIntegrator for GL4 {
12911291
let delta = (&J_inv * &F_vec).mul_scalar(-1.0);
12921292

12931293
// U <- U + delta
1294-
U.iter_mut()
1295-
.zip(delta.iter())
1296-
.for_each(|(u, d)| *u += *d);
1294+
U.iter_mut().zip(delta.iter()).for_each(|(u, d)| *u += *d);
12971295

12981296
let mut F_new = vec![0.0; m];
12991297
compute_F(problem, t, y, dt, &U, &mut F_new)?;
@@ -1394,7 +1392,7 @@ fn compute_F<P: ODEProblem>(
13941392
y1[i] = y[i] + dt * (A11 * k1_slice[i] + A12 * k2_slice[i]);
13951393
y2[i] = y[i] + dt * (A21 * k1_slice[i] + A22 * k2_slice[i]);
13961394
}
1397-
1395+
13981396
// F is an output parameter, its parts f1 and f2 are stored temporarily
13991397
let (f1, f2) = F.split_at_mut(n);
14001398
problem.rhs(t + C1 * dt, &y1, f1)?;

src/numerical/optimize.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
111111
pub use self::OptMethod::{GaussNewton, GradientDescent, LevenbergMarquardt};
112112
use self::OptOption::{InitParam, MaxIter};
113+
use crate::fuga::ConvToMat;
113114
use crate::numerical::utils::jacobian;
114115
use crate::structure::ad::{ADVec, AD};
115116
use crate::structure::matrix::Matrix;
@@ -247,7 +248,7 @@ where
247248

248249
// Take various form of initial data
249250
let p_init_vec = p_init.to_f64_vec();
250-
let y = y_vec.into();
251+
let y = y_vec.to_col();
251252

252253
// Declare mutable values
253254
let mut p: Matrix = p_init_vec.clone().into();

src/prelude/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
//! df.print();
118118
//!
119119
//! # #[cfg(feature="parquet")] {
120-
//! df.write_parquet("example_data/test.parquet", CompressionOptions::Uncompressed).unwrap();
120+
//! df.write_parquet("example_data/test.parquet", SNAPPY).unwrap();
121121
//! # }
122122
//! }
123123
//! ```

src/prelude/simpler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::traits::math::{Norm, Normed};
1414
#[allow(unused_imports)]
1515
use crate::traits::matrix::{Form, LinearAlgebra, MatrixTrait, SolveKind, PQLU, QR, UPLO, WAZD};
1616
#[cfg(feature = "parquet")]
17-
use arrow2::io::parquet::write::CompressionOptions;
17+
use parquet::basic::Compression;
1818
#[cfg(feature = "parquet")]
1919
use std::error::Error;
2020

@@ -198,7 +198,7 @@ pub trait SimpleParquet: Sized {
198198
#[cfg(feature = "parquet")]
199199
impl SimpleParquet for DataFrame {
200200
fn write_parquet(&self, path: &str) -> Result<(), Box<dyn Error>> {
201-
WithParquet::write_parquet(self, path, CompressionOptions::Uncompressed)
201+
WithParquet::write_parquet(self, path, Compression::SNAPPY)
202202
}
203203

204204
fn read_parquet(path: &str) -> Result<Self, Box<dyn Error>> {

0 commit comments

Comments
 (0)