Skip to content

Commit

Permalink
Release v0.1.3
Browse files Browse the repository at this point in the history
	- Improve performance for the General case
	- Add scalar test and refactor tests
	- Add new dtype argument to request specific type
	- Add numpy floating point type to valid input types
	- Fix issues with raised warnings
  • Loading branch information
yohanchatelain committed Aug 2, 2023
1 parent a3190e1 commit 9826d3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# significantdigits package - v0.1.2
# significantdigits package - v0.1.3

Compute the number of significant digits based on the paper [Confidence Intervals for Stochastic Arithmetic](https://arxiv.org/abs/1807.09655).
This package is also inspired from the [Jupyter notebook](https://github.com/interflop/stochastic-confidence-intervals/blob/master/Intervals.ipynb) included with the publication.
This package is also inspired by the [Jupyter Notebook](https://github.com/interflop/stochastic-confidence-intervals/blob/master/Intervals.ipynb) included with the publication.

## Getting started

Expand Down Expand Up @@ -39,8 +39,7 @@ If the reference is unknown, one can use the sample average:
python3 -m pip install -U significantdigits
```

or if you want the lastest version of the code, you can install **from**
the repository directly
or if you want the latest version of the code, you can install it **from** the repository directly

```bash
python3 -m pip install -U git+https://github.com/verificarlo/significantdigits.git
Expand All @@ -52,19 +51,15 @@ the repository directly

### Inputs types

Functions accept the following types for the inputs:
Functions accept the following types of inputs:
```python
InputType: np.ndarray | tuple | list
```
Those types are accessible with the `get_input_type` function.

### Z computation

Metric are computed using Z, the distance
between the samples and the reference.
They are four possible cases depending on the
distance and the nature of the reference that are
summarized in this table:
Metrics are computed using Z, the distance between the samples and the reference.
They are four possible cases depending on the distance and the nature of the reference that is summarized in this table:

| | constant reference (x) | random variable reference (Y) |
| ------------------ | ---------------------- | ----------------------------- |
Expand Down Expand Up @@ -112,8 +107,7 @@ compute_z(array: ~InputType, reference: Optional[~ReferenceType], error: signifi

### Methods

Two methods exist for computing both significant and contributing digits
depending on wether the sample follow a Centered Normal distribution or not.
Two methods exist for computing both significant and contributing digits depending on whether the sample follows a Centered Normal distribution or not.
You can pass the method to the function by using the `Method` enum provided by the package.
The functions also accept the name as a string
`"cnh"` for `Method.CNH` and `"general"` for `Method.General`.
Expand Down Expand Up @@ -219,7 +213,7 @@ contributing_digits(array: ~InputType, reference: Optional[~ReferenceType] = Non
array_like containing contributing digits

```
### Utils functions
### Utils function

These are utility functions for the general case.

Expand All @@ -228,7 +222,7 @@ allows having an estimation
on the lower bound probability given the sample size.

`minimum_number_of_trials` gives the minimal sample size
required to reach requested `probability` and `confidence`.
required to reach the requested `probability` and `confidence`.

```python
probability_estimation_general(success: int, trials: int, confidence: float) -> float
Expand Down Expand Up @@ -287,5 +281,5 @@ under the Apache License v2.0 with LLVM Exceptions.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.
See https://llvm.org/LICENSE.txt for license information.

Copyright (c) 2020-2022 Verificarlo Contributors
Copyright (c) 2020-2023 Verificarlo Contributors

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "significantdigits"
version = "0.1.2"
version = "0.1.3"
description = "Solid stochastic statistic analysis of Stochastic Arithmetic"
authors = [
{ name = "Verificarlo contributors", email = "verificarlo@googlegroups.com" },
Expand Down
3 changes: 1 addition & 2 deletions significantdigits/_significantdigits.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import warnings
from enum import Enum, auto
from typing import Optional, Tuple, TypeVar, Union

import numpy as np
import scipy
import scipy.stats

from icecream import ic


class AutoName(Enum):
def _generate_next_value_(name, start, count, last_values):
Expand Down

0 comments on commit 9826d3b

Please sign in to comment.