mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
docs: improve the example in readme
This commit is contained in:
22
README.md
22
README.md
@@ -46,24 +46,20 @@ You can find more detailed installation instructions in [installing.md](docs/use
|
||||
|
||||
```python
|
||||
import concrete.numpy as hnp
|
||||
def f(x, y):
|
||||
|
||||
def add(x, y):
|
||||
return x + y
|
||||
|
||||
inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]
|
||||
compiler = hnp.NPFHECompiler(add, {"x": "encrypted", "y": "encrypted"})
|
||||
|
||||
compiler = hnp.NPFHECompiler(
|
||||
f, {"x": "encrypted", "y": "encrypted"},
|
||||
)
|
||||
print(f"Compiling...")
|
||||
circuit = compiler.compile_on_inputset(inputset)
|
||||
|
||||
print(circuit.run(3, 4))
|
||||
# 7
|
||||
print(circuit.run(1, 2))
|
||||
# 3
|
||||
print(circuit.run(7, 7))
|
||||
# 14
|
||||
print(circuit.run(0, 0))
|
||||
# 0
|
||||
examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
|
||||
for example in examples:
|
||||
result = circuit.run(*example)
|
||||
print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")
|
||||
```
|
||||
|
||||
# For developers
|
||||
@@ -88,4 +84,4 @@ Information about how to contribute are available in [contributing.md](docs/dev/
|
||||
|
||||
# License
|
||||
|
||||
This software is distributed under the BSD-3-Clause-Clear license. If you have any questions, please contact us at hello@zama.ai.
|
||||
This software is distributed under the BSD-3-Clause-Clear license. If you have any questions, please contact us at hello@zama.ai.
|
||||
|
||||
Reference in New Issue
Block a user