## Thursday, 23 June 2016

Just briefly introducing a new operator. Not sure how useful it is going to be, but may as well document it. Basically, I wanted to implement this equation:
```R0 = r0
R_k = R_k-1 + r_k * [simm(R_k-1,r_k)]^p
```
where r_k are superpositions, simm is our similarity metric, and if we set p = 0 this reduces to a simple sum:
`R_k = r1 + r2 + ... + r_k`
The intended effect is that you add new superpositions weighted somewhat on how close they are to those already in the sum. Noting of course, that simm gives results in [0,1]. Like I said, I don't know if this will turn out useful, but figured why not add it.

Here is the python:
```def simm_add(one,context,parameters):
try:
op,p = parameters.split(',')
p = int(p)                     # maybe try float(p) later
except:
return ket("",0)

for x in tail:
rk = x.apply_op(context,op)
similarity = silent_simm(Rk,rk)**p
Rk = Rk + rk.multiply(similarity)
return Rk
```
And a use case from earlier:
```  sadd |result 1> => simm-add[noise,1] select[1,1] rel-kets[noise] |>
...
```0 <= R_k <= r1 + r2 + ... + r_k