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

add Conjugate Gradient with Momentum #185

Merged
merged 19 commits into from
Sep 25, 2024
Merged

add Conjugate Gradient with Momentum #185

merged 19 commits into from
Sep 25, 2024

Conversation

Lenoush
Copy link
Contributor

@Lenoush Lenoush commented Aug 29, 2024

In base.py , add a first draft of cg function with
cg(self, kspace_data, x_init=None, num_iterations=10, tol=1e-4)
where x_init = initial image , tol = tolerance

Classique example of gradient descent :

def cg(fourier_op, kspace_data, num_iterations):
    L = fourier_op.get_lipschitz_cst()
    image = np.zeros(fourier_op.shape)
    for i in range(num_iterations):
         grad = fourier_op.data_consistency(image, kspace_data)
         image = image - grad * L
    return image

Help of :

@Lenoush Lenoush requested a review from chaithyagr August 29, 2024 14:05
@Lenoush Lenoush linked an issue Aug 29, 2024 that may be closed by this pull request
@Lenoush Lenoush marked this pull request as draft August 29, 2024 14:05
@paquiteau
Copy link
Member

I think this would be more suited in mrinufft.extras

@chaithyagr
Copy link
Member

@Lenoush I think I agree with @paquiteau, can we move this to extras module. Also it would help to have test and an example?

@chaithyagr chaithyagr marked this pull request as ready for review September 23, 2024 07:33
@Lenoush Lenoush requested a review from paquiteau September 24, 2024 09:06
Copy link
Member

@paquiteau paquiteau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very good !
The example deserves more explanation (add a ref to the CG algorithm, Wikipedia is okay)

examples/example_cg.py Show resolved Hide resolved
@Lenoush Lenoush requested a review from paquiteau September 25, 2024 07:33
Copy link
Member

@paquiteau paquiteau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paquiteau paquiteau merged commit 092c795 into master Sep 25, 2024
12 checks passed
@Lenoush Lenoush deleted the add-cg-method branch September 25, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for CG method for quick reconstruction of the images
3 participants