Skip to content

Commit d840d62

Browse files
committed
Add example to readme
1 parent 84210cd commit d840d62

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ Arithmetic operations, comparisons, and conversions are supported across several
4949
- [`MatQ`](TODO_Link_to_documentation): Represents matrices over $\mathbb Q$.
5050
- [`PolyOverQ`](TODO_Link_to_documentation): Represents polynomials with coefficients over $\mathbb Q$.
5151

52+
## Quick Example
53+
```rust
54+
use qfall_math::{integer_mod_q::MatZq, integer::MatZ};
55+
56+
# parameters: nr_rows, nr_columns, modulus
57+
let mat_a = MatZq::sample_uniform(2, 3, 257);
58+
# parameters: nr_rows, nr_columns, lower_bound, upper_bound
59+
let vec_s = MatZ::sample_uniform(1, 2, 0, 2);
60+
# parameters: nr_rows, nr_columns, center, Gaussian parameter
61+
let vec_e = MatZ::sample_discrete_gauss(1, 3, 0, 4.0);
62+
63+
# SIS-instance: t = A * e^T mod 257
64+
let vec_t = mat_a * vec_e.transpose();
65+
66+
# LWE-instance: b = s * A + e mod 257
67+
let vec_b = vec_s * mat_a + vec_e;
68+
```
69+
5270
## Bugs
5371
Please report bugs through the [GitHub issue tracker](https://github.com/qfall/math/issues).
5472

@@ -78,5 +96,5 @@ Furthermore, we utilized [serde](https://crates.io/crates/serde) and [serde_json
7896

7997
## License
8098

81-
This library is distributed under the **Mozilla Public License Version 2.0** which can be found [here](https://github.com/qfall/math/blob/dev/LICENSE).
99+
This library is distributed under the [Mozilla Public License Version 2.0]((https://github.com/qfall/math/blob/dev/LICENSE)).
82100
Permissions of this weak copyleft license are conditioned on making the source code of licensed files and modifications of those files available under the same license (or in certain cases, under one of the GNU licenses). Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work may be distributed under different terms and without source code for files added to the larger work.

0 commit comments

Comments
 (0)