Description of sopt_mltb_div_op
Description: sopt_mltb_div_op - Compute divergence

Home > matlab > misc > sopt_mltb_div_op.m

# sopt_mltb_div_op

## PURPOSE

sopt_mltb_div_op - Compute divergence

## SYNOPSIS

function I = sopt_mltb_div_op(dx, dy, weights_dx, weights_dy)

## DESCRIPTION

     sopt_mltb_div_op - Compute divergence

     Compute the divergence (adjoint of the gradient) of a two dimensional
     signal from the horizontal and vertical gradients.

     Inputs:

       - dx: Gradient in x.

       - dy: Gradient in y.

       - weights_dx: Weights in the x direction.

       - weights_dy: Weights in the y direction.

     Outputs:

       - I: Divergence.

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function I = sopt_mltb_div_op(dx, dy, weights_dx, weights_dy)
    0002 % sopt_mltb_div_op - Compute divergence
    0003 %
    0004 % Compute the divergence (adjoint of the gradient) of a two dimensional
    0005 % signal from the horizontal and vertical gradients.
    0006 %
    0007 % Inputs:
    0008 %
    0009 %   - dx: Gradient in x.
    0010 %
    0011 %   - dy: Gradient in y.
    0012 %
    0013 %   - weights_dx: Weights in the x direction.
    0014 %
    0015 %   - weights_dy: Weights in the y direction.
    0016 %
    0017 % Outputs:
    0018 %
    0019 %   - I: Divergence.
    0020
    0021 if nargin > 2
    0022     dx = dx .* conj(weights_dx);
    0023     dy = dy .* conj(weights_dy);
    0024 end
    0025
    0026 I = [dx(1, :) ; dx(2:end-1, :)-dx(1:end-2, :) ; -dx(end-1, :)];
    0027 I = I + [dy(:, 1) , dy(:, 2:end-1)-dy(:, 1:end-2) , -dy(:, end-1)];
    0028
    0029 end