Skip to content

Commit

Permalink
Update version and changelog (#18)
Browse files Browse the repository at this point in the history
* Add default

* Bump version

* Hide inner fields when Serializing

* remove deepsource, update version
  • Loading branch information
sn99 authored Dec 19, 2023
1 parent a1f026b commit f3bc60f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
8 changes: 0 additions & 8 deletions .deepsource.toml

This file was deleted.

16 changes: 11 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.5.0] - 2023-12-13
## [0.5.1] -2023-12-19
### Fixed
- Issue #16
### Added
- Previous yanked version changes

## ~~[0.5.0] - 2023-12-13~~ yanked
### Added
- Function `append`.
- Implements trait `Default`

## ~~[0.4.0] - 2023-05-18~~ yanked
### Added
- Functions computing 'skewness', 'kurtosis', 'bimodality coefficient'

## [0.3.2] - 2022-07-29
### Fixed
- Issue #3
### Added
- Changelog file.

## [0.4.0] - 2023-05-18
### Added
- Functions computing 'skewness', 'kurtosis', 'bimodality coefficient'
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "simple_accumulator"
version = "0.5.0"
version = "0.5.1"
edition = "2021"
authors = ["sn99 <siddharthn.099@gmail.com>, purnatag <purnatag@gmail.com>"]
description = "A simple accumulator"
Expand All @@ -16,6 +16,7 @@ documentation = "https://docs.rs/simple_accumulator"
[dependencies]
num = "0.4.0"
rand = "0.8.5"
serde = { version = "1.0.193", features = ["derive"] }

[dependencies.float_eq]
version = "1"
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,14 @@ impl SimpleAccumulator {
// Running stats, Number of elements seen is incremented irrespective of buffer properties
// Calculation is online following Knuth's algorithm
self.total += 1;

let delta = y - self.mean;
let delta_n = delta / (self.total as f64);
self.mean += delta_n;

let term1 = delta * delta_n * (self.total as f64 - 1.0);
let stats1 = self.variance * (self.total as f64 - 2.0) + term1;

if self.total > 1 {
self.variance = stats1 / (self.total as f64 - 1.0);
}
Expand Down
3 changes: 1 addition & 2 deletions tests/test_fixed_append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ fn test_append_in_fixed_capacity_random() {

// and push values into it.
acc.append(&copy);


assert_eq!(acc.vec.len(), CAPACITY);

Expand All @@ -60,4 +59,4 @@ fn test_append_in_fixed_capacity_random() {
assert!(a.len() <= CAPACITY); // duplicates
assert_eq!(a.intersection(&b).count(), a.len());
assert_eq!(a.difference(&b).count(), 0); // both set must be equal.
}
}

0 comments on commit f3bc60f

Please sign in to comment.