Identifying multiplication depth

Is there a way to identify the multiplication depth of a final ciphertext produced by an OpenFHE CKKS program, either through a function (such as ciphertext.depth would be helpful, but I’m not sure if something like that exists) or a systematic code analysis?

My program is made up of a number of operations (using EvalInnerProduct, EvalMerge, EvalChebyshev, EvalAdd) and I seem to have difficulty estimating the overall depth from my understanding of these functions.

Thanks a lot

You can use ctxt->GetLevel() to retrieve the current level of the ciphertext ctxt. The ciphertext property level starts at 0 (for fresh encryption at the maximum parameters) and keeps incrementing as you multiply until you reach the maximum multiplicative depth. This is an easy way to keep track of the multiplication budget consumed. However, there are some subtleties when multiplication does not consume a level. But for most purposes, this method should be good enough.

1 Like