Files
torus/docs/dev/api/torus.fhe.representation.utils.md
zeekay f968edf75a Rename the Concrete dialect and project identifiers to Torus
The MLIR dialect, its conversion passes (TFHEToConcrete, ConcreteToCAPI,
ConcreteToLLVM), the optimizer component, the compiler binary, the Rust
crate and the program_info parameter file all still carried the upstream
project's name. They now carry this one's.

Two things deliberately keep the word, because in them it is not the name.
mlir::OpTrait CRTP parameters mean "the derived type", so they are spelled
Derived and OpTy — LLVM's other conventional spelling for the same idiom.
concreteShape is a capnp field: renaming it would change the serialized
protocol, and the prose describing it is ordinary English.

This also repairs references the earlier partial rename left dangling:
Security.cpp included concrete/curves.gen.h and the directory is torus/,
torus-cpu.h included concrete-num_complex.h, the Torus dialect CMakeLists
named ConcreteOps.td, and compiler/setup.py asked find_namespace_packages
for a "concrete" package that no longer exists — so it built without the
package it ships.
2026-08-27 13:17:38 -07:00

2.0 KiB

module torus.fhe.representation.utils

Declaration of various functions and constants related to representation of computation.

Global Variables

  • KWARGS_IGNORED_IN_FORMATTING
  • SPECIAL_OBJECT_MAPPING
  • NODES_THAT_HAVE_TLU_WHEN_ALL_INPUTS_ARE_ENCRYPTED

function format_constant

format_constant(
    constant: Any,
    maximum_length: int = 45,
    keep_newlines: bool = False
) → str

Get the textual representation of a constant.

Args: constant (Any): constant to format

maximum_length (int, default = 45): maximum length of the resulting string

keep_newlines (bool, default = False): whether to keep newlines or not

Returns: str: textual representation of constant


function format_indexing_element

format_indexing_element(indexing_element: Union[int, integer, slice, Any])

Format an indexing element.

This is required mainly for slices. The reason is that string representation of slices are very long and verbose. To give an example, x[:, 2:] will have the following index [slice(None, None, None), slice(2, None, None)] if printed naively. With this helper, it will be formatted as [:, 2:].

Args: indexing_element (Union[int, np.integer, slice]): indexing element to format

Returns: str: textual representation of indexing_element