Skip to content

Commit

Permalink
Ver 0.34.4
Browse files Browse the repository at this point in the history
- Derive Serialize and Deserialize for Matrix
  • Loading branch information
Axect committed Jan 28, 2024
2 parents 2787d2b + 66e18c8 commit 96a76c5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "peroxide"
version = "0.34.3"
version = "0.34.4"
authors = ["axect <[email protected]>"]
edition = "2018"
description = "Rust comprehensive scientific computation library contains linear algebra, numerical analysis, statistics and machine learning tools with farmiliar syntax"
Expand Down
5 changes: 5 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Release 0.34.4 (2024-01-28)

* Derive `Serialize` and `Deserialize` for `Matrix`
* Remove explicit implementation for `Default` for `Shape`

# Release 0.34.3 (2023-11-25)

* Update `peroxide-num` to `v0.1.4`
Expand Down
20 changes: 10 additions & 10 deletions src/structure/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,13 +607,13 @@
#[cfg(feature="csv")]
extern crate csv;

#[cfg(feature="csv")]
use self::csv::{ReaderBuilder, StringRecord, WriterBuilder};

#[cfg(feature = "O3")]
extern crate blas;
#[cfg(feature = "O3")]
extern crate lapack;

#[cfg(feature="csv")]
use self::csv::{ReaderBuilder, StringRecord, WriterBuilder};
use ::matrixmultiply;
#[cfg(feature = "O3")]
use blas::{daxpy, dgemm, dgemv};
Expand All @@ -622,6 +622,9 @@ use lapack::{dgecon, dgeqrf, dgetrf, dgetri, dgetrs, dorgqr, dgesvd, dpotrf};
#[cfg(feature = "O3")]
use std::f64::NAN;

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

pub use self::Shape::{Col, Row};
use crate::numerical::eigen::{eigen, EigenMethod};
use crate::traits::{
Expand Down Expand Up @@ -661,8 +664,10 @@ pub type Perms = Vec<(usize, usize)>;
/// println!("{}", a); // Similar to [[1,2],[3,4]]
/// println!("{}", b); // Similar to [[1,3],[2,4]]
/// ```
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Default, Debug, PartialEq, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum Shape {
#[default]
Col,
Row,
}
Expand All @@ -678,12 +683,6 @@ impl fmt::Display for Shape {
}
}

impl Default for Shape {
fn default() -> Self {
Shape::Col
}
}

/// R-like matrix structure
///
/// # Examples
Expand All @@ -700,6 +699,7 @@ impl Default for Shape {
/// }; // [[1,2],[3,4]]
/// ```
#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Matrix {
pub data: Vec<f64>,
pub row: usize,
Expand Down

0 comments on commit 96a76c5

Please sign in to comment.