Sorry for the late reply!

thank you this helped a lot, I am able to compile computation of the gaussian matrix now written as

```
def mul_tlu(A, B):
apbsq = ((A + B).astype(np.float64) ** 2 // 4).astype(np.int64)
ambsq = ((A - B).astype(np.float64) ** 2 // 4).astype(np.int64)
return apbsq - ambsq
def dot_product(A, B):
len_A = A.shape[0] if hasattr(A, 'shape') else len(A)
len_B = B.shape[0] if hasattr(B, 'shape') else len(B)
if len_A != len_B:
raise ValueError("The input vectors must have the same length.")
result = 0
for i in range(len_A):
a = A[i]
b = B[i]
result += mul_tlu(a, b)
return result
def gaussian_matrix(X_train, X_test, inv_sigma_sq):
n_rows = X_train.shape[0]
n_cols = X_test.shape[0]
K = []
for i in range(n_rows):
row = []
for j in range(n_cols):
diff = X_train[i] - X_test[j]
diff_sq = dot_product(diff, diff)
div_sigma = mul_tlu(diff_sq, inv_sigma_sq)
c = np.exp(-div_sigma).astype(np.int64)
row.append(c)
K.append(row)
K = cnp.array(K)
return K
```

with all input encypted. However the prediction function

```
def gaussian_predict(X_train,X_test,sigma, alphas):
sigma = sigma.astype(np.int64)
inv_sigma_sq = (1 / sigma) ** 2
K = gaussian_matrix(X_train, X_test, inv_sigma_sq)
alphas = alphas.astype(np.int64)
y_predicted = dot_product(K, alphas)
return y_predicted.astype(np.int64)
```

still causes problems (not pasting the full output here)

```
Traceback (most recent call last):
File "fhe_krr.py", line 77, in <module>
circuit = compiler.compile(inputset )
File "/home/jan/miniconda3/envs/fhe/lib/python3.8/site-packages/concrete/numpy/compilation/compiler.py", line 439, in compile
self._evaluate("Compiling", inputset)
File "/home/jan/miniconda3/envs/fhe/lib/python3.8/site-packages/concrete/numpy/compilation/compiler.py", line 280, in _evaluate
self._trace(first_sample)
File "/home/jan/miniconda3/envs/fhe/lib/python3.8/site-packages/concrete/numpy/compilation/compiler.py", line 211, in _trace
fuse(self.graph, self.artifacts)
File "/home/jan/miniconda3/envs/fhe/lib/python3.8/site-packages/concrete/numpy/compilation/utils.py", line 60, in fuse
fused_node, node_before_subgraph = convert_subgraph_to_subgraph_node(
File "/home/jan/miniconda3/envs/fhe/lib/python3.8/site-packages/concrete/numpy/compilation/utils.py", line 569, in convert_subgraph_to_subgraph_node
raise RuntimeError(
RuntimeError: A subgraph within the function you are trying to compile cannot be fused because it has multiple input nodes
%0 = X_train # EncryptedTensor<float64, shape=(5, 30)>
%1 = X_test # EncryptedTensor<float64, shape=(2, 30)>
%2 = sigma # EncryptedScalar<uint1>
%3 = alphas # EncryptedTensor<uint1, shape=(5,)>
```

So concrete is having trouble fusing a subgraph with multiple input nodes. I tried many different variants but could not find a solution yet.

Any suggestion is welcome!