Skip to content

Fix#4: Implemented variance function#9

Open
DjYash007 wants to merge 1 commit into
bsoc-bitbyte:mainfrom
DjYash007:variance
Open

Fix#4: Implemented variance function#9
DjYash007 wants to merge 1 commit into
bsoc-bitbyte:mainfrom
DjYash007:variance

Conversation

@DjYash007

Copy link
Copy Markdown

Overview

  1. This PR fixes or fixes part of Implement variance #4.
  2. This PR implements the variance function for f64 slices in the primary module.

The implementation:

  • Returns None for empty input and an edge case where sample has one element.
  • Returns the variance.
  • Uses existing mean module to calculate the mean and simple control flow logic for finding the solution.
  • Also uses correct type references for avoiding compile time errors.

Essential Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)
  • The PR is made from a branch that's not called "main/master".

Proof that changes are correct

Verified locally with:

cargo test --test variance

2026-06-08-194341

Full cargo test currently also attempts to compile tests for median, variance, and std_deviation, which are separate unimplemented functions/issues and are not part of this PR.

@DjYash007 DjYash007 changed the title Implemented variance function Fix#4: Implemented variance function Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant