thewalrus icon indicating copy to clipboard operation
thewalrus copied to clipboard

Allow user to choose algorithm in hafnian wrapper

Open josh146 opened this issue 5 years ago • 1 comments

Currently, when calling the hafnian Python wrapper, all you specify is whether recursive is True or False:

hafnian(A, loop=True, recursive=True, quad=True, approx=False, etc...)

We then apply logic to call the best case hafnian algorithm considering the matrix+options the user has provided.

We should modify it to look like this:

hafnian(A, loop=True, algorithm="best", options={})

where algorithm is a string containing the algorithm to use:

  • best is the current logic (and the default)

  • recursive

  • trace

  • approx

and options are the algorithm specific options, i.e. options={'samples': 100} for the approx algorithm, options={'quad': True} for the recursive, options={'powtrace': 'eigenvalues'} for the trace algorithm, etc.

Note: the moment/repeated hafnian will have to remain its own function, since it also takes rpt as an argument.

josh146 avatar Aug 24 '19 08:08 josh146

@nquesada is this still relevant? Current function signature here

sduquemesa avatar Mar 03 '22 21:03 sduquemesa