Added missing derives dev

Wed, 30 Apr 2025 00:23:04 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Wed, 30 Apr 2025 00:23:04 -0500
branch
dev
changeset 106
1256e7f7f7ad
parent 105
103aa137fcb2
child 107
441d30e66a4a

Added missing derives

src/convex.rs file | annotate | diff | comparison | revisions
src/norms.rs file | annotate | diff | comparison | revisions
--- a/src/convex.rs	Tue Apr 29 07:55:18 2025 -0500
+++ b/src/convex.rs	Wed Apr 30 00:23:04 2025 -0500
@@ -9,6 +9,7 @@
 use crate::norms::*;
 use crate::operator_arithmetic::{Constant, Weighted};
 use crate::types::*;
+use serde::{Deserialize, Serialize};
 use std::marker::PhantomData;
 
 /// Trait for convex mappings. Has no features, just serves as a constraint
@@ -74,6 +75,7 @@
 }
 
 /// Constraint to the unit ball of the norm described by `E`.
+#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
 pub struct NormConstraint<F: Float, E: NormExponent> {
     radius: F,
     norm: NormMapping<F, E>,
@@ -178,6 +180,7 @@
 }
 
 /// Projection to the unit ball of the norm described by `E`.
+#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
 pub struct NormProjection<F: Float, E: NormExponent> {
     radius: F,
     exponent: E,
@@ -211,6 +214,7 @@
 }
 
 /// The zero mapping
+#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
 pub struct Zero<Domain: Space, F: Num>(PhantomData<(Domain, F)>);
 
 impl<Domain: Space, F: Num> Zero<Domain, F> {
@@ -271,6 +275,7 @@
 }
 
 /// The zero indicator
+#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
 pub struct ZeroIndicator<Domain: Space, F: Num>(PhantomData<(Domain, F)>);
 
 impl<Domain: Space, F: Num> ZeroIndicator<Domain, F> {
@@ -319,6 +324,7 @@
 }
 
 /// The squared Euclidean norm divided by two
+#[derive(Copy, Clone, Serialize, Deserialize)]
 pub struct Norm222<F: Float>(PhantomData<F>);
 
 impl</*Domain: Euclidean<F>,*/ F: Float> Norm222<F> {
--- a/src/norms.rs	Tue Apr 29 07:55:18 2025 -0500
+++ b/src/norms.rs	Wed Apr 30 00:23:04 2025 -0500
@@ -5,14 +5,14 @@
 use crate::euclidean::*;
 use crate::mapping::{Instance, Mapping, Space};
 use crate::types::*;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
 use std::marker::PhantomData;
 
 //
 // Abstract norms
 //
 
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
 /// Helper structure to convert a [`NormExponent`] into a [`Mapping`]
 pub struct NormMapping<F: Float, E: NormExponent> {
     pub(crate) exponent: E,

mercurial