AdvancedPhotonSource / tike

Repository for ptychography software
http://tike.readthedocs.io
Other
29 stars 15 forks source link

Add forward and adjoint gradient operators for regularization, and 2d USFFT functions #82

Open nikitinvv opened 4 years ago

nikitinvv commented 4 years ago

Purpose

Add implementation of the forward gradient operator and its adjoint (negative divergence), and 2D usfft functions.

Approach

The operators were implemented by taking differences between neighboring elements for x,y,z dimensions. They can be used inside joint iterative schemes with several subproblems, where one of the subproblems is regularization given in terms of the TV or Tikhonov terms.

2d USFFT functions are the same as for 3D except for the dimensions change and one constant. It is worth to merge them into one USFFT function.

Pre-Merge Checklists

Submitter

Reviewer

pep8speaks commented 4 years ago

Hello @nikitinvv! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 16:1: E302 expected 2 blank lines, found 1 Line 43:1: E302 expected 2 blank lines, found 1 Line 47:15: E741 ambiguous variable name 'l' Line 129:1: E302 expected 2 blank lines, found 1 Line 228:1: E302 expected 2 blank lines, found 1 Line 232:15: E741 ambiguous variable name 'l' Line 245:17: E131 continuation line unaligned for hanging indent

Comment last updated at 2020-08-13 17:32:11 UTC
nikitinvv commented 4 years ago

@slnsrydn @carterbox could some of you merge 2d USFFT and 3d USFFT into 1 function?

carterbox commented 4 years ago

Is an ND USFFT separable like the an ND FFT is separable into the product of 1D FFTs or whatever?

nikitinvv commented 4 years ago

@carterbox, I just added the regularization operators that should be used in ptycho-tomo admm. They can be tested only when the admm is ready. Yes, Nd usfft can be done as separate 1d usfft, but on GPU it will be faster to do Nd FFT once than 1D FFT many times. As I see, in the current code it is enough to control only the number of inner loops in the scatter and gather operators, depending on the number of usfft dimensions. It can be done by recursive function calls.