Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerMethod will produce slightly different results for every call #806

Open
evelinaametova opened this issue Mar 22, 2021 · 3 comments · May be fixed by #1585
Open

PowerMethod will produce slightly different results for every call #806

evelinaametova opened this issue Mar 22, 2021 · 3 comments · May be fixed by #1585
Assignees

Comments

@evelinaametova
Copy link
Contributor

https://github.com/vais-ral/CCPi-Framework/blob/598f758d660e9da92878d6819502321cb7c2b09e/Wrappers/Python/cil/optimisation/operators/Operator.py#L134

Shouldn't this random allocation be seeded? If not seeded, reconstructions with exactly the same input will produce slightly different results.

@jakobsj
Copy link
Contributor

jakobsj commented Mar 22, 2021 via email

@gfardell gfardell added this to the version 21.3 milestone Sep 20, 2021
@paskino
Copy link
Contributor

paskino commented Sep 20, 2021

Suggest to add a new self._random_number_seed member in LinearOperator that will be used by calculate_norm

def calculate_norm(self, **kwargs):
'''Returns the norm of the LinearOperator as calculated by the PowerMethod
:param iterations: number of iterations to run
:type iterations: int, optional, default = 25
:param x_init: starting point for the iteration in the operator domain
:type x_init: same type as domain, a subclass of :code:`DataContainer`, optional, None
:parameter force: forces the recalculation of the norm
:type force: boolean, default :code:`False`
'''
x0 = kwargs.get('x_init', None)
iterations = kwargs.get('iterations', 25)
s1, sall, svec = LinearOperator.PowerMethod(self, iterations, x_init=x0)
return s1

to create x0 if no x_init is passed

@gfardell gfardell modified the milestones: version 21.3, Future Version Oct 29, 2021
@MargaretDuff MargaretDuff linked a pull request Nov 22, 2023 that will close this issue
8 tasks
@MargaretDuff
Copy link
Member

In #1645 we found that we needed a random seed for the power method tests! It would be good to be able to set the random seed in the argument of the power method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants