> For the complete documentation index, see [llms.txt](https://docs.zama.org/concrete/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/concrete/2.7-1/get-started/compatibility.md).

# Compatibility

## Supported operations

This document lists the operations you can use inside the function that you are compiling.

{% hint style="info" %}
Some operations are not supported between two encrypted values. If attempted, a detailed error message will be raised.
{% endhint %}

### Supported Python operators.

* [\_\_abs\_\_](https://docs.python.org/3/reference/datamodel.html#object.__abs__)
* [\_\_add\_\_](https://docs.python.org/3/reference/datamodel.html#object.__add__)
* [\_\_and\_\_](https://docs.python.org/3/reference/datamodel.html#object.__and__)
* [\_\_eq\_\_](https://docs.python.org/3/reference/datamodel.html#object.__eq__)
* [\_\_floordiv\_\_](https://docs.python.org/3/reference/datamodel.html#object.__floordiv__)
* [\_\_ge\_\_](https://docs.python.org/3/reference/datamodel.html#object.__ge__)
* [\_\_getitem\_\_](https://docs.python.org/3/reference/datamodel.html#object.__getitem__)
* [\_\_gt\_\_](https://docs.python.org/3/reference/datamodel.html#object.__gt__)
* [\_\_invert\_\_](https://docs.python.org/3/reference/datamodel.html#object.__invert__)
* [\_\_le\_\_](https://docs.python.org/3/reference/datamodel.html#object.__le__)
* [\_\_lshift\_\_](https://docs.python.org/3/reference/datamodel.html#object.__lshift__)
* [\_\_lt\_\_](https://docs.python.org/3/reference/datamodel.html#object.__lt__)
* [\_\_matmul\_\_](https://docs.python.org/3/reference/datamodel.html#object.__matmul__)
* [\_\_mod\_\_](https://docs.python.org/3/reference/datamodel.html#object.__mod__)
* [\_\_mul\_\_](https://docs.python.org/3/reference/datamodel.html#object.__mul__)
* [\_\_ne\_\_](https://docs.python.org/3/reference/datamodel.html#object.__ne__)
* [\_\_neg\_\_](https://docs.python.org/3/reference/datamodel.html#object.__neg__)
* [\_\_or\_\_](https://docs.python.org/3/reference/datamodel.html#object.__or__)
* [\_\_pos\_\_](https://docs.python.org/3/reference/datamodel.html#object.__pos__)
* [\_\_pow\_\_](https://docs.python.org/3/reference/datamodel.html#object.__pow__)
* [\_\_radd\_\_](https://docs.python.org/3/reference/datamodel.html#object.__radd__)
* [\_\_rand\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rand__)
* [\_\_rfloordiv\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rfloordiv__)
* [\_\_rlshift\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rlshift__)
* [\_\_rmatmul\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rmatmul__)
* [\_\_rmod\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rmod__)
* [\_\_rmul\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rmul__)
* [\_\_ror\_\_](https://docs.python.org/3/reference/datamodel.html#object.__ror__)
* [\_\_round\_\_](https://docs.python.org/3/reference/datamodel.html#object.__round__)
* [\_\_rpow\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rpow__)
* [\_\_rrshift\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rrshift__)
* [\_\_rshift\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rshift__)
* [\_\_rsub\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rsub__)
* [\_\_rtruediv\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rtruediv__)
* [\_\_rxor\_\_](https://docs.python.org/3/reference/datamodel.html#object.__rxor__)
* [\_\_sub\_\_](https://docs.python.org/3/reference/datamodel.html#object.__sub__)
* [\_\_truediv\_\_](https://docs.python.org/3/reference/datamodel.html#object.__truediv__)
* [\_\_xor\_\_](https://docs.python.org/3/reference/datamodel.html#object.__xor__)

### Supported NumPy functions.

* [np.absolute](https://numpy.org/doc/stable/reference/generated/numpy.absolute.html)
* [np.add](https://numpy.org/doc/stable/reference/generated/numpy.add.html)
* [np.arccos](https://numpy.org/doc/stable/reference/generated/numpy.arccos.html)
* [np.arccosh](https://numpy.org/doc/stable/reference/generated/numpy.arccosh.html)
* [np.arcsin](https://numpy.org/doc/stable/reference/generated/numpy.arcsin.html)
* [np.arcsinh](https://numpy.org/doc/stable/reference/generated/numpy.arcsinh.html)
* [np.arctan](https://numpy.org/doc/stable/reference/generated/numpy.arctan.html)
* [np.arctan2](https://numpy.org/doc/stable/reference/generated/numpy.arctan2.html)
* [np.arctanh](https://numpy.org/doc/stable/reference/generated/numpy.arctanh.html)
* [np.around](https://numpy.org/doc/stable/reference/generated/numpy.around.html)
* [np.bitwise\_and](https://numpy.org/doc/stable/reference/generated/numpy.bitwise_and.html)
* [np.bitwise\_or](https://numpy.org/doc/stable/reference/generated/numpy.bitwise_or.html)
* [np.bitwise\_xor](https://numpy.org/doc/stable/reference/generated/numpy.bitwise_xor.html)
* [np.broadcast\_to](https://numpy.org/doc/stable/reference/generated/numpy.broadcast_to.html)
* [np.cbrt](https://numpy.org/doc/stable/reference/generated/numpy.cbrt.html)
* [np.ceil](https://numpy.org/doc/stable/reference/generated/numpy.ceil.html)
* [np.clip](https://numpy.org/doc/stable/reference/generated/numpy.clip.html)
* [np.concatenate](https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html)
* [np.copysign](https://numpy.org/doc/stable/reference/generated/numpy.copysign.html)
* [np.cos](https://numpy.org/doc/stable/reference/generated/numpy.cos.html)
* [np.cosh](https://numpy.org/doc/stable/reference/generated/numpy.cosh.html)
* [np.deg2rad](https://numpy.org/doc/stable/reference/generated/numpy.deg2rad.html)
* [np.degrees](https://numpy.org/doc/stable/reference/generated/numpy.degrees.html)
* [np.dot](https://numpy.org/doc/stable/reference/generated/numpy.dot.html)
* [np.equal](https://numpy.org/doc/stable/reference/generated/numpy.equal.html)
* [np.exp](https://numpy.org/doc/stable/reference/generated/numpy.exp.html)
* [np.exp2](https://numpy.org/doc/stable/reference/generated/numpy.exp2.html)
* [np.expand\_dims](https://numpy.org/doc/stable/reference/generated/numpy.expand_dims.html)
* [np.expm1](https://numpy.org/doc/stable/reference/generated/numpy.expm1.html)
* [np.fabs](https://numpy.org/doc/stable/reference/generated/numpy.fabs.html)
* [np.float\_power](https://numpy.org/doc/stable/reference/generated/numpy.float_power.html)
* [np.floor](https://numpy.org/doc/stable/reference/generated/numpy.floor.html)
* [np.floor\_divide](https://numpy.org/doc/stable/reference/generated/numpy.floor_divide.html)
* [np.fmax](https://numpy.org/doc/stable/reference/generated/numpy.fmax.html)
* [np.fmin](https://numpy.org/doc/stable/reference/generated/numpy.fmin.html)
* [np.fmod](https://numpy.org/doc/stable/reference/generated/numpy.fmod.html)
* [np.gcd](https://numpy.org/doc/stable/reference/generated/numpy.gcd.html)
* [np.greater](https://numpy.org/doc/stable/reference/generated/numpy.greater.html)
* [np.greater\_equal](https://numpy.org/doc/stable/reference/generated/numpy.greater_equal.html)
* [np.heaviside](https://numpy.org/doc/stable/reference/generated/numpy.heaviside.html)
* [np.hypot](https://numpy.org/doc/stable/reference/generated/numpy.hypot.html)
* [np.invert](https://numpy.org/doc/stable/reference/generated/numpy.invert.html)
* [np.isfinite](https://numpy.org/doc/stable/reference/generated/numpy.isfinite.html)
* [np.isinf](https://numpy.org/doc/stable/reference/generated/numpy.isinf.html)
* [np.isnan](https://numpy.org/doc/stable/reference/generated/numpy.isnan.html)
* [np.lcm](https://numpy.org/doc/stable/reference/generated/numpy.lcm.html)
* [np.ldexp](https://numpy.org/doc/stable/reference/generated/numpy.ldexp.html)
* [np.left\_shift](https://numpy.org/doc/stable/reference/generated/numpy.left_shift.html)
* [np.less](https://numpy.org/doc/stable/reference/generated/numpy.less.html)
* [np.less\_equal](https://numpy.org/doc/stable/reference/generated/numpy.less_equal.html)
* [np.log](https://numpy.org/doc/stable/reference/generated/numpy.log.html)
* [np.log10](https://numpy.org/doc/stable/reference/generated/numpy.log10.html)
* [np.log1p](https://numpy.org/doc/stable/reference/generated/numpy.log1p.html)
* [np.log2](https://numpy.org/doc/stable/reference/generated/numpy.log2.html)
* [np.logaddexp](https://numpy.org/doc/stable/reference/generated/numpy.logaddexp.html)
* [np.logaddexp2](https://numpy.org/doc/stable/reference/generated/numpy.logaddexp2.html)
* [np.logical\_and](https://numpy.org/doc/stable/reference/generated/numpy.logical_and.html)
* [np.logical\_not](https://numpy.org/doc/stable/reference/generated/numpy.logical_not.html)
* [np.logical\_or](https://numpy.org/doc/stable/reference/generated/numpy.logical_or.html)
* [np.logical\_xor](https://numpy.org/doc/stable/reference/generated/numpy.logical_xor.html)
* [np.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html)
* [np.maximum](https://numpy.org/doc/stable/reference/generated/numpy.maximum.html)
* [np.minimum](https://numpy.org/doc/stable/reference/generated/numpy.minimum.html)
* [np.multiply](https://numpy.org/doc/stable/reference/generated/numpy.multiply.html)
* [np.negative](https://numpy.org/doc/stable/reference/generated/numpy.negative.html)
* [np.nextafter](https://numpy.org/doc/stable/reference/generated/numpy.nextafter.html)
* [np.not\_equal](https://numpy.org/doc/stable/reference/generated/numpy.not_equal.html)
* [np.ones\_like](https://numpy.org/doc/stable/reference/generated/numpy.ones_like.html)
* [np.positive](https://numpy.org/doc/stable/reference/generated/numpy.positive.html)
* [np.power](https://numpy.org/doc/stable/reference/generated/numpy.power.html)
* [np.rad2deg](https://numpy.org/doc/stable/reference/generated/numpy.rad2deg.html)
* [np.radians](https://numpy.org/doc/stable/reference/generated/numpy.radians.html)
* [np.reciprocal](https://numpy.org/doc/stable/reference/generated/numpy.reciprocal.html)
* [np.remainder](https://numpy.org/doc/stable/reference/generated/numpy.remainder.html)
* [np.reshape](https://numpy.org/doc/stable/reference/generated/numpy.reshape.html)
* [np.right\_shift](https://numpy.org/doc/stable/reference/generated/numpy.right_shift.html)
* [np.rint](https://numpy.org/doc/stable/reference/generated/numpy.rint.html)
* [np.round](https://numpy.org/doc/stable/reference/generated/numpy.round.html)
* [np.sign](https://numpy.org/doc/stable/reference/generated/numpy.sign.html)
* [np.signbit](https://numpy.org/doc/stable/reference/generated/numpy.signbit.html)
* [np.sin](https://numpy.org/doc/stable/reference/generated/numpy.sin.html)
* [np.sinh](https://numpy.org/doc/stable/reference/generated/numpy.sinh.html)
* [np.spacing](https://numpy.org/doc/stable/reference/generated/numpy.spacing.html)
* [np.sqrt](https://numpy.org/doc/stable/reference/generated/numpy.sqrt.html)
* [np.square](https://numpy.org/doc/stable/reference/generated/numpy.square.html)
* [np.subtract](https://numpy.org/doc/stable/reference/generated/numpy.subtract.html)
* [np.sum](https://numpy.org/doc/stable/reference/generated/numpy.sum.html)
* [np.tan](https://numpy.org/doc/stable/reference/generated/numpy.tan.html)
* [np.tanh](https://numpy.org/doc/stable/reference/generated/numpy.tanh.html)
* [np.transpose](https://numpy.org/doc/stable/reference/generated/numpy.transpose.html)
* [np.true\_divide](https://numpy.org/doc/stable/reference/generated/numpy.true_divide.html)
* [np.trunc](https://numpy.org/doc/stable/reference/generated/numpy.trunc.html)
* [np.where](https://numpy.org/doc/stable/reference/generated/numpy.where.html)
* [np.zeros\_like](https://numpy.org/doc/stable/reference/generated/numpy.zeros_like.html)

### Supported `ndarray` methods.

* [np.ndarray.astype](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.astype.html)
* [np.ndarray.clip](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.clip.html)
* [np.ndarray.dot](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.dot.html)
* [np.ndarray.flatten](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.flatten.html)
* [np.ndarray.reshape](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.reshape.html)
* [np.ndarray.transpose](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.transpose.html)

### Supported `ndarray` properties.

* [np.ndarray.shape](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.shape.html)
* [np.ndarray.ndim](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ndim.html)
* [np.ndarray.size](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.size.html)
* [np.ndarray.T](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.T.html)

## Limitations

### Control flow constraints

Concrete doesn not support some control flow statements, including the `if` and `while` statement when the condition depends on an encrypted value. However, control flow statements with constant values are allowed, for example, `for i in range(SOME_CONSTANT)`, `if os.environ.get("SOME_FEATURE") == "ON":`.

### Type constraints

Floating-point inputs or floating-point outputs are not supported. You can have floating-point intermediate values as long as they can be converted to an integer Table Lookup, for example, `(60 * np.sin(x)).astype(np.int64)`.

### Bit width constraints

Bit width of encrypted values has a limit. We are constantly working on increasing the bit width limit. Exceeding this limit will trigger an error.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zama.org/concrete/2.7-1/get-started/compatibility.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
