mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
switched from Arc to Rc
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::modulus::prime::Prime;
|
||||
use crate::poly::{Poly, PolyRNS};
|
||||
use crate::modulus::WordOps;
|
||||
use num::traits::Unsigned;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Ring<O: Unsigned> {
|
||||
pub n: usize,
|
||||
@@ -28,7 +28,7 @@ impl<O: Unsigned> Ring<O> {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RingRNS<O: Unsigned>(pub Vec<Arc<Ring<O>>>);
|
||||
pub struct RingRNS<O: Unsigned>(pub Vec<Rc<Ring<O>>>);
|
||||
|
||||
impl<O: Unsigned> RingRNS<O> {
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ use crate::poly::PolyRNS;
|
||||
use crate::ring::{Ring, RingRNS};
|
||||
use crate::scalar::ScalarRNS;
|
||||
use num_bigint::BigInt;
|
||||
use std::sync::Arc;
|
||||
use std::rc::Rc;
|
||||
|
||||
impl RingRNS<u64> {
|
||||
pub fn new(n: usize, moduli: Vec<u64>) -> Self {
|
||||
assert!(!moduli.is_empty(), "moduli cannot be empty");
|
||||
let rings: Vec<Arc<Ring<u64>>> = moduli
|
||||
let rings: Vec<Rc<Ring<u64>>> = moduli
|
||||
.into_iter()
|
||||
.map(|prime| Arc::new(Ring::new(n, prime, 1)))
|
||||
.map(|prime| Rc::new(Ring::new(n, prime, 1)))
|
||||
.collect();
|
||||
return RingRNS(rings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user