# intOpsFuncs

Construct function handles on various integral operators.

## Contents

- Syntax
- Description
- Input Arguments
- Output Arguments
- More About
- References
- See Also
- Code

## Syntax

    [V, S, VGStar, VStar, TStar, QU, QStarU, Vqf, VqStarf] = intOpsFuncs(qROI, seti)

## Description

`[V, S, VGStar, VStar, TStar, QU, QStarU, Vqf, VqStarf] = intOpsFuncs(qROI, seti)` constructs several function handles on various integral operators (in case of 2D and 3D scattering problem).

## Input Arguments

- qROI : contrast in ROI
- seti : structural array

## Output Arguments

Note that the suffix "Star" is used to mark adjoints.

- V : volume potential , defined in solveLippmannSchwinger.html in "More About".
- S : S = @(s) simo(qROI, s, seti), see simo.html.
- VGStar : (receivers are placed on manifold .)
- VStar :
- TStar :
- QU : `QU = @(x) qROI .* x;`
- QStarU : `QStarU = @(x) conj(qROI) .* x;`
- Vqf : with respect to contrast q
- VqStarf : with respect to complex conjugate contrast q.

## More About

For reference see [1] or [2, Sec. 3].

- QU, QStarU : workaround for helmholtzHMode. The other models often need `qROI.*x` or `conj(qROI).*x` where HMode only needs `x`. (Note that helmholtzHMode is not supported in public version.)

## References

- [1] David Colton and Rainer Kress. Inverse Acoustic and Electromagnetic Scattering Theory. Springer, New York, 2013. URL: https://doi.org/10.1007/978-1-4614-4942-3.
- [2] Florian Bürgel, Kamil S. Kazimierski, and Armin Lechleiter. A sparsity regularization and total variation based computational framework for the inverse medium problem in scattering. Journal of Computational Physics, 339:1-30, 2017. URL: https://doi.org/10.1016/j.jcp.2017.03.011.

## See Also

- simo.html
- solveLippmannSchwinger.html

Corresponding functions for helmholtz2D:

- helmholtz2Dc2cAdjointf.html
- helmholtz2Dc2cf.html
- helmholtz2Dr2data.html
- helmholtz2Dr2dataAdjoint.html
- helmholtz2Dr2r.html
- helmholtz2Dr2rAdjoint.html

Corresponding functions for helmholtz3D:

- helmholtz3Dc2cAdjointf.html
- helmholtz3Dc2cf.html
- helmholtz3Dr2data.html
- helmholtz3Dr2dataAdjoint.html
- helmholtz3Dr2r.html
- helmholtz3Dr2rAdjoint.html

## Code

    function [V, S, VGStar, VStar, TStar, QU, QStarU, Vqf, VqStarf] = intOpsFuncs(qROI, seti)

    if strcmp(seti.model, 'helmholtz2D')
        V  = @(x) seti.k^2.*helmholtz2Dr2r(x, seti); % volume potential V: L^2(ROI) -> L^2(ROI)

        % Vf: volume potential V essentially from  L^2(CD) to L^2(CD),
        %     but with Fourier coefficients as input and output,
        %     see Vqf for correct usage.
        Vf  = @(x) seti.k^2.*helmholtz2Dc2cf(x, seti);

        % Vqf: respects contrast q and that Vf has Fourier coefficients as
        % input and output,
        Vqf = @(x) Vf(fftn(extendROItoCD(qROI .* restrictCDtoROI(ifftn(x),seti.ROImask),seti.ROImask)));

        VGStar = @(x) seti.k^2.*helmholtz2Dr2dataAdjoint(x, seti);

        VStar  = @(x) seti.k^2.*helmholtz2Dr2rAdjoint(x, seti);
        VStarf = @(x) seti.k^2.*helmholtz2Dc2cAdjointf(x, seti);
        VqStar = @(x) conj(qROI).*VStar(x);
        VqStarf = @(x) VStarf(fftn(extendROItoCD(conj(qROI) .* restrictCDtoROI(ifftn(x),seti.ROImask),seti.ROImask)));

        QU = @(x) qROI .* x;
        QStarU = @(x) conj(qROI) .* x;
    elseif  strcmp(seti.model, 'helmholtz3D')
        V  = @(x) seti.k^2.*helmholtz3Dr2r(x, seti); % volume potential
        Vf  = @(x) seti.k^2.*helmholtz3Dc2cf(x, seti);
        Vqf = @(x) Vf(fftn(extendROItoCD(qROI .* restrictCDtoROI(ifftn(x),seti.ROImask),seti.ROImask)));

        VGStar = @(x) seti.k^2.*helmholtz3Dr2dataAdjoint(x, seti);

        VStar  = @(x) seti.k^2.*helmholtz3Dr2rAdjoint(x, seti);
        VStarf = @(x) seti.k^2.*helmholtz3Dc2cAdjointf(x, seti);
        VqStar = @(x) conj(qROI).*VStar(x);
        VqStarf = @(x) VStarf(fftn(extendROItoCD(conj(qROI) .* restrictCDtoROI(ifftn(x),seti.ROImask),seti.ROImask)));

        QU = @(x) qROI .* x;
        QStarU = @(x) conj(qROI) .* x;
    elseif  strcmp(seti.model, 'helmholtzHMode2D') % not supported in public version
        V  = @(x) helmholtzHMode2Dr2r(x, qROI, seti); % volume potential
        Vf  = @(x) helmholtzHMode2Dc2cf(x, qROI, seti);
        Vqf =  Vf;

        VGStar = @(x) helmholtzHMode2Dr2dataAdjoint(x, qROI, seti);

        VStar  = @(x) helmholtzHMode2Dr2rAdjoint(x, qROI, seti);
        VqStar = @(x) VStar(x);

        VStarf  = @(x) helmholtzHMode2Dc2cAdjointf(x, qROI, seti);
        VqStarf = @(x) VStarf(x);

        QU = @(x) x;
        QStarU = @(x) x;
    else
        disp('intOpsFuncs.m: Error - model is not (yet ... ?) implemented');
    end

    S = @(s) simo(qROI, s, seti); % simo has support for two-grid (two-grid not supported in public version)

    if seti.mCD == 0
        TStar  = @(x) solveLippmannSchwinger(VqStar,x,seti);
    else
        [~, ~, ~, ~, ~, ~, ~, ~, VqStarfM] = intOpsFuncs(seti.setiM.qROI, seti.setiM);

        TStar = @(x) solveLippmannSchwinger(VqStar, x, seti, 'twoGrid', VqStarf, VqStarfM);
    end

    end