text:
function[]=jlab_index(varargin)
%JLAB_INDEX  Alphabetical index into JLAB and JDATA contents.
%
% JDATA index
%   about_floats  - Historical dataset of eddy-resolving subsurface floats.
%   about_ibcao   - International Bathymetric Chart of the Arctic Ocean topography.
%   about_sandwell - One minute resolution topography data from Smith and Sandwell.
%   about_tpjaos  - Sea surface height anomalies from the Beckley merged dataset.
%   readtopo      - Read one-minute topography data from Smith and Sandwell.
%   topo_copyright - Copyright statement for the Smith and Sandwell topography.
%
% JLAB index
%   ab2kl         - Converts A and B to ellipse parameters Kappa and Lambda.
%   about_jtopo   - One-sixth degree global topography, from Smith and Sandwell + IBCAO.
%   allall        - ALLALL(X)=ALL(X(:))
%   anatrans      - Analytic part of signal.
%   anyany        - ANYANY(X)=ANY(X(:))
%   aresame       - Test whether two N-D arrays are the same.
%   arrayify      - Converts a set of scalars or arrays into column arrays.
%   axeshandles   - Returns handles to all axes children.
%   bellpoly      - Complete Bell polynomials.
%   besselitilde  - I-type Bessel function after factoring off exponential growth.
%   besselktilde  - K-type Bessel function after factoring off exponential decay.
%   bindata       - Rapidly sort data into adjacent bins.
%   blocklen      - Counts the lengths of 'blocks' in an array.
%   blocknum      - Numbers the contiguous blocks of an array.
%   blurspec      - Returns the blurred and aliased spectrum given the autocovariance.
%   boxon         - Sets 'box' property to 'off'.
%   boxon         - Sets 'box' property to 'on'.
%   catstruct     - Concatenates the array elements of a cell array of structures.
%   cell2col      - Converts cell arrays of numeric arrays into 'column-appended' form.
%   cellabs       - Absolute value of each element in a cell array.
%   celladd       - Addition acting on each element in a cell array.
%   cellchunk     - Converts cell array data into uniform length 'chunks'.
%   celldiv       - Division acting on each element in a cell array.
%   celldot       - Dot product for arrays of column vectors.
%   cellength     - Length of each element in a cell array.
%   cellfill      - Fills missing data marked by INFs in a cell array.
%   cellfirst     - Returns the first (or last) element of each entry in a cell array.
%   cellget       - Indexes a cell array of numerical arrays by ID number.
%   cellgrid      - Interpolate a cell array of numeric arrays onto a regular grid.
%   cellimag      - Imaginary part of each element in a cell array.
%   cellimit      - Limits the ranges of times in a cell array of numerical arrays.
%   cellindex     - Applies a cell array of indices to a cell array of column vectors.
%   celllog10     - Base ten logarithm of each element in a cell array.
%   cellmax       - Maximum of each element in a cell array.
%   cellmean      - Mean value of each element a cell array, possibly weighted.
%   cellmed       - Median value of each element a cell array.
%   cellmin       - Minimum of each element in a cell array.
%   cellmult      - Multiplication acting on each element in a cell array.
%   cellpack      - Removes all INF values from cell arrays of numeric arrays.
%   cellpair      - Complex pairing for elements in a cell array.
%   cellplot      - Rapidly plot all elements of a cell array of numeric arrays.
%   cellprune     - Removes all empty cells, or cells less than a specified length.
%   cellreal      - Real part of each element in a cell array.
%   cellsize      - Size of each element in a cell array along specified dimension.
%   cellsplit     - Splits cell arrays of numeric arrays at data gaps.
%   cellstd       - Standard deviation of each element a cell array, possibly weighted.
%   cellstrip     - Strips INF values from the beginnings or ends of cell arrays.
%   cellsum       - Sum of each element a cell array, possibly weighted.
%   chisquared    - The chi-squared distribution.
%   choose        - Binomial coefficient: CHOOSE(N,K) = N!K!/(N-K)!
%   closedcurves  - Locate and interpolate closed curves in a possibly periodic domain.
%   cms2kmd       - Converts centimeters per second to kilometers per day.
%   col2cell      - Converts 'column-appended' data into cell arrays of numeric arrays.
%   col2mat       - Expands 'column-appended' data into a matrix.
%   colbreaks     - Insert NANs into discontinuties in a vector.
%   colorquant    - Set the color axis according to quantiles of the data.
%   commentlines  - Returns the comment lines from m-files.
%   corfreq       - Coriolis frequency in radians per hour.
%   crop          - Gets rid of whitespace around an image. [by A. Bliss]
%   crop_license  - License statement for CROP by Andrew Bliss.
%   cum2mom       - Convert cumulants to moments.
%   curveinterp   - Interpolate a field or its gradient onto a set of curves.
%   curvemoments  - Centroid, area, and many other moments of a closed curve.
%   deg180        - Converts degrees to the range [-180,180].
%   deg360        - Converts degrees to the range [0, 360].
%   degunwrap     - Unwraps arrays given in degrees.
%   discretecolorbar - Plots a colorbar with discrete variation.
%   divgeom       - Geometric decomposition of eddy vorticity flux divergence.
%   dlines        - Add diagonal lines to a plot.
%   doublen       - Interpolates a time series to double its length.
%   ecconv        - Converts between eccentricity measures.
%   eddyfit2d     - Least squares fit of 2D velocity data to an eddy profile.
%   eddylevels    - Eddy ridge significance levels using the survival function.
%   eddyridges    - Coherent eddy ridges from Lagrangian trajectories.
%   ellband       - Bandwidth of modulated elliptical signals in two or three dimensions.
%   ellcurves     - Returns curves corresponding to specified ellipse properties.
%   elldiff       - Differentiation of modulated elliptical signals.
%   ellipseplot   - Plot ellipses.
%   ellparams     - Ellipse parameters of a modulated bivariate or trivariate oscillation.
%   ellpol        - Polarization parameters of an elliptical signal.
%   ellrad        - Average and instantaneous ellipse radius.
%   ellrossby     - Ellipse Rossby number, for oceanographic applications.
%   ellsig        - Creates a modulated elliptical signal in two or three dimensions.
%   ellvel        - Average and instantaneous ellipse velocities.
%   fillbad       - Linearly interpolate over bad data points.
%   findfiles     - Returns all files in a directory with a specified extension.
%   findpath      - Returns the full pathname of a directory on the Matlab search path.
%   fixlabels     - Specify precision of axes labels.
%   flipmap       - Flips the current colormap upside-down.
%   flipx         - Flips the direction of the x-axis
%   flipy         - Flips the direction of the y-axis
%   fminsearchbnd - FMINSEARCH, but with bound constraints by transformation. [By J. D'Errico]
%   fontsize      - Rapidly set title, axes, label, and text fontsizes.
%   fourier       - Returns the Fourier frequencies for a given length time series.
%   frac          - Fraction: FRAC(A,B)=A./B
%   griddrifters  - Average drifter velocities onto a space/time 3D grid.
%   gulf4plot     - A four-panel circulation plot for the Gulf of Mexico.
%   haxby         - The Haxby colormap.
%   haxby_copyright - Copyright statement for the HAXBY colormap.
%   hermfun       - Orthonormal Hermite functions. [with F. Rekibi]
%   hermpoly      - Hermite polynomials. [with F. Rekibi]
%   hlines        - Add horizontal lines to a plot.
%   hodograph     - Generate hodograph plots (simple and fancy).
%   imlog         - Imaginary part of log: IMLOG(X)=UNWRAP(IMAG(LOG(X)))
%   inellipse     - Locates points on the interior of ellipses.
%   inregion      - Tests whether lat/lon points lie within a specified box.
%   instmom       - Univariate and multivariate instantaneous moments.
%   interplatlon  - Interpolation for working with latitude and longitude.
%   inticks       - Sets the 'tickdir' property of the current axis to 'in'.
%   iseven        - True for even integer values; false otherwise.
%   isodd         - True for odd integer values; false otherwise.
%   isomax        - Returns those transform maxima that are isolated from others.
%   isridgepoint  - Finds wavelet ridge points using one of several criterion.
%   jdawson       - The Dawson function and its derivatives. [With P.J. Acklam]
%   jdeg2rad      - Converts degrees to radians.
%   jfig          - Shorthand for tweaking figures.
%   jhanning      - Hanning window.
%   jhelp         - Opens linked JLAB help files in Matlab's internal web browser.
%   jlab_addpath  - Adds JLAB and JDATA subdirectories to your Matlab search path.
%   jlab_allhelp  - Displays the help comments for all JLAB modules.
%   jlab_changes  - Changes to JLAB in each release.
%   jlab_highlights - Introduction to some of the most useful routines.
%   jlab_index    - Alphabetical index into JLAB and JDATA contents.
%   jlab_install  - Instructions for installing JLAB.
%   jlab_license  - License statement and permissions for JLAB package.
%   jlab_makefigs - Makes figures for papers by J.M. Lilly.
%   jlab_runtests - Runs a test suite for JLAB package.
%   jlab_thanks   - Sources of support for developing this software.
%   jmat2         - 2x2 rotation matrix through specified angle.
%   jmat3         - 3x3 rotation matrix through specified angle.
%   jpcolor       - Modified version of PCOLOR appropriate for cell-centered grids.
%   jprint        - Print to a specified directory and crop the resulting file.
%   jrad2deg      - Converts radians to degrees.
%   kl2ab         - Converts ellipse parameters Kappa and Lambda to A and B.
%   lansey        - The Lansey modification of Cynthia Brewer's "Spectral" colormap.
%   lansey_copyright - Copyright statement for the Lansey colormap.
%   latlon2uv     - Converts latitude and longitude to horizontal velocity.
%   latlon2xy     - Converts latitude and longitude into tangent plane coordinates.
%   latlon2xyz    - Converts latitude and longitude into 3D Cartesian coordinates.
%   latratio      - Set plot aspect ratio for latitude / longitude plot.
%   letterlabels  - For automatically putting letter labels on subplots.
%   linecolor     - Set line colors based on a property value within a colormap.
%   linehandles   - Finds all line and patch handles from a given set of axes.
%   linering      - Moves lines through the current line style order.
%   linestyle     - Rapidly set color, style, and width properties of lines.
%   linestyleparse - Parses the input string to LINESTYLE.
%   lininterp     - Fast linear interpolation for arbitrary-sized arrays.
%   lnsd          - Last non-singleton dimension of an array.
%   lonshift      - Shifts longitude origin for plotting purposes.
%   make          - Create a structure containing named variables as fields.
%   makefigs_analytic - has been moved to JLAB_MAKEFIGS.
%   makefigs_asilomar - has been moved to JLAB_MAKEFIGS.
%   makefigs_bandwidth - has been moved to JLAB_MAKEFIGS.
%   makefigs_closedcurves - Makes a sample figure for CLOSEDCURVES.
%   makefigs_curvemoments - Makes a sample figure for CURVEMOMENTS.
%   makefigs_dlines - Makes a sample figure for DLINES.
%   makefigs_doublen - Makes a sample figure for DOUBLEN.
%   makefigs_ecconv - Makes a sample figure for ECCONV.
%   makefigs_element - Makes all figures for Lilly (2017), "Element Analysis."
%   makefigs_ellband - Makes a sample figure for ELLBAND.
%   makefigs_ellipseplot - Makes a sample figure for ELLIPSEPLOT.
%   makefigs_ellvel - Makes a sample figure for ELLVEL.
%   makefigs_gulfcensus - Makes all figures for Lilly and Perez-Brunius (2021b).
%   makefigs_gulfdrifters - Makes all figures for Lilly and Perez-Brunius (2021a).
%   makefigs_hermfun - Makes a sample figure for HERMFUN.
%   makefigs_inellipse - Makes a sample figure for INELLIPSE.
%   makefigs_instmom - Makes some sample figures for INSTMOM.
%   makefigs_jdawson - Makes a sample figure for DJAWSON.
%   makefigs_jfig - Makes a sample figure for JFIG.
%   makefigs_jpcolor - Makes a sample figure for JPCOLOR.
%   makefigs_jtopo - Makes a sample figure for ABOUT_JTOPO.
%   makefigs_lansey - Makes a sample figure for LANSEY.
%   makefigs_matern - Makes all figures for Lilly et al. 2017.
%   makefigs_maternoise - Makes a sample figure for MATERNOISE.
%   makefigs_maternspec - Makes some sample figures for MATERNSPEC.
%   makefigs_mconf - Makes sample figure for MCONF.
%   makefigs_morlfreq - Makes a sample figure for MORLFREQ.
%   makefigs_morlwave - Makes a sample figure for MORLWAVE.
%   makefigs_morsearea - Makes a sample figure for MORSEAREA.
%   makefigs_morsebox - Makes a sample figure for MORSEBOX.
%   makefigs_morsefreq - Makes a sample figure for MORSEFREQ.
%   makefigs_morseregion - Makes somes sample figures for MORSEREGION.
%   makefigs_morsespace - Makes some sample figures for MORSESPACE.
%   makefigs_morsewave - Makes some sample figures for MORSEWAVE.
%   makefigs_morsies - has been moved to JLAB_MAKEFIGS.
%   makefigs_mspec - Makes some sample figures for MSPEC.
%   makefigs_multivariate - has been moved to JLAB_MAKEFIGS.
%   makefigs_patchcontourf - Makes a sample figure for PATCHCONTOURF.
%   makefigs_periodize - Makes a sample figure for PERIODIZE.
%   makefigs_polysmooth - Makes some sample figures for POLYSMOOTH.
%   makefigs_polysmooth2 - Makes a sample figure for POLYSMOOTH using TPJAOS.MAT.
%   makefigs_psi2fields - Makes a sample figure for PSI2FIELDS.
%   makefigs_regionplot - Makes some sample figures for REGIONPLOT.
%   makefigs_ridges - has been moved to JLAB_MAKEFIGS.
%   makefigs_ridgetrim - Makes a sample figure for RIDGETRIM.
%   makefigs_ridgewalk - Makes a sample figure for RIDGEWALK.
%   makefigs_seminfhaxby - Makes a sample figure for SEMINFHAXBY.
%   makefigs_simplepdf - Makes a sample figure for SIMPLEPDF.
%   makefigs_slidetrans - Makes a sample figure for SLIDETRANS.
%   makefigs_sphereinterp - Makes two sample figures for SPHEREINTERP.
%   makefigs_stickvect - Makes a sample figure for STICKVECT.
%   makefigs_superfamily - has been moved to JLAB_MAKEFIGS.
%   makefigs_topoplot - Makes a sample figure for TOPOPLOT.
%   makefigs_trackextract - Makes a sample figure for TRACKEXTRACT.
%   makefigs_trajextract - Makes a sample figure for TRAJEXTRACT.
%   makefigs_trajwrap - Makes a sample figure for TRAJWRAP.
%   makefigs_transfer - Makes all figures for Lilly and Elipot (2021).
%   makefigs_trivariate - has been moved to JLAB_MAKEFIGS.
%   makefigs_twodhist - Makes a sample figure for TWODHIST.
%   makefigs_twodmed - Makes a sample figure for TWODMED.
%   makefigs_twodstats - Makes a sample figure for TWODSTATS.
%   makefigs_vortex - has been moved to JLAB_MAKEFIGS.
%   makefigs_wavespecplot - Makes a sample figure for WAVESPECPLOT.
%   makefigs_wavetrans - Makes a sample figure for WAVETRANS.
%   makefigs_widgist - Makes some sample figures for WIGDIST.
%   mat2col       - Compress NAN-padded matrix data into long columns.
%   materncfun    - Returns the normalization or C-function for a Matern process.
%   maternchol    - Cholesky decomposition of Matern and fBm covariances. [with A. Sykulski]
%   materncov     - Autocovariance of the Matern random process and variations.
%   maternedge    - Long-time cutoff edge for the Matern impulse response function.
%   maternfit     - Parametric spectral fit to the Matern form. [with A. Sykulski]
%   maternfun     - Returns the Matern function.
%   maternimp     - Impulse response function for the Matern random process.
%   maternoise    - Realizations of the Matern process and variations, including fBm. [with A. Sykulski]
%   maternspec    - Fourier spectrum of the Matern random process and variations.
%   matinv        - Fast inversion of arrays of small matrices.
%   matmult       - Matrix multiplication for arrays of matrices.
%   matsave       - Create and save structure of variables as a mat-file.
%   max2eddy      - Converts transform maxima into oceanic coherent eddy properties.
%   maxmax        - MAXMAX(X)=MAX(X(ISFINITE(X)))
%   maxprops      - Returns properties of wavelet transform maxima.
%   mconf         - Confidence intervals for the multitaper spectral estimate.
%   minmin        - MINMIN(X)=MIN(X(ISFINITE(X)))
%   mom2cum       - Convert moments to cumulants.
%   monthstats    - Mean month and standard deviation using circular statistics.
%   morlfreq      - Compute Morlet wavelet carrier frequency given peak frequency.
%   morlwave      - Morlet wavelet.
%   morseafun     - Returns the generalized Morse wavelet amplitude or a-function.
%   morsearea     - Time-frequency concentration area of Morse wavelets. [with F. Rekibi]
%   morsebox      - Heisenberg time-frequency box for generalized Morse wavelets.
%   morsederiv    - Frequency-domain derivatives of generalized Morse wavelets.
%   morsefreq     - Frequency measures for generalized Morse wavelets. [with F. Rekibi]
%   morsehigh     - High-frequency cutoff of the generalized Morse wavelets.
%   morsemom      - Frequency-domain moments of generalized Morse wavelets.
%   morseproj     - Projection coefficient for two generalized Morse wavelets.
%   morseprops    - Properties of the demodulated generalized Morse wavelets.
%   morseregion   - Generalized Morse wavelet time-frequency concentration region.
%   morsespace    - Logarithmically-spaced frequencies for generalized Morse wavelets.
%   morsewave     - Generalized Morse wavelets of Olhede and Walden (2002).
%   morsexpand    - Generalized Morse wavelets via time-domain Taylor series.
%   mspec         - Multitaper power and cross spectra.
%   msvd          - Singular value decomposition for polarization analysis.
%   ncinterp      - One-line interpolation from 3D lat/lon/time field in NetCDF file.
%   ncload        - Load all variables from a NetCDF file and convert trajectories to cells.
%   nocontours    - Removes contours from a CONTOURF plot.
%   noisedrifters - Create a noise Lagrangian dataset matching mean and variance.
%   nonnan        - Return all non-NAN elements of an array.
%   noxlabels     - Remove some or all x-axis tick mark labels.
%   noylabels     - Remove some or all y-axis tick mark labels.
%   oprod         - Outer product:  OPROD(X,Y)=X*CONJ(Y')
%   orbitbreaks   - Separate orbit into passes based on turning points.
%   outticks      - Sets the 'tickdir' property of the current axis to 'out'.
%   packfig       - Squeeze together rows and/or columns of the current figure.
%   patchcontourf - Generate filled contours using patches, with specified colors.
%   pdfprops      - Mean and variance associated with a probability distribution.
%   periodindex   - Returns time index in increments of instantaneous period.
%   periodize     - Returns a doubly periodic version of an input array.
%   polparams     - Spectral matrix polarization parameters.
%   polysmooth    - Mapping using local polynomial fitting, also known as loess.
%   polysmooth_bandwidth - Determine bandwidth given population for POLYSMOOTH.
%   polysmooth_kernel - Returns the weighting kernel employed by POLYSMOOTH.
%   polysmooth_presort - Sort arguments to POLYSMOOTH in case of missing data.
%   polysmooth_sortfield - Returns sorted field values for a mapping problem.
%   printall      - Print and close all open figures.
%   provec        - Generate progressive vector diagrams (simple and fancy).
%   psi2fields    - Velocity and other fields from the streamfunction. [with P.E. Isachsen]
%   quadinterp    - Fast quadratic interpolation for arbitrary-sized arrays.
%   radearth      - The radius of the earth in kilometers.
%   regionplot    - Plots a simple box indicating a latitude / longitude region.
%   reporttest    - Reports the result of an m-file function auto-test.
%   res           - Residual after flooring:  RES(X)=X-FLOOR(X)
%   ridgechains   - Forms ridge curves by connecting transform ridge points.
%   ridgeinterp   - Interpolate quantity values onto ridge locations.
%   ridgelen      - Wavelet ridge length expressed as number of full cycles.
%   ridgemap      - Maps ridge quantities back onto the time series.
%   ridgemult     - Ridge multiplicity, the number of simultaneous ridges present.
%   ridgetrim     - Trim edge effect regions from wavelet ridges.
%   ridgewalk     - Extract wavelet transform ridges, including bias estimates.
%   rot           - Complex-valued rotation:  ROT(X)=EXP(SQRT(-1)*X)
%   sampletimes   - Computes mean sampling intervals and their statistics.
%   seminfhaxby   - The seminf-Haxby colormap.
%   sig2latlon    - Converts an oscillatory signal to lat/lon displacements.
%   simpleddy     - Streamfunction, velocity, and vorticity for various eddy profiles.
%   simplepdf     - Gaussian, uniform, Cauchy, and exponential pdfs.
%   sleptap       - Calculate Slepian tapers.
%   slidetrans    - Sliding-window ('moving-window') Fourier transform.
%   specdiag      - Diagonalize a 2 x 2 spectral matrix.
%   sphere2uvw    - Converts a 3D spherical vector to a 3D Cartesian vector.
%   spherecurl    - Curl of a vector field on the surface of a sphere.
%   spheredist    - Computes great circle distances on a sphere.
%   spherediv     - Divergence of a vector field on the surface of a sphere.
%   spheregrad    - Gradient of a field on the surface of a sphere.
%   sphereinterp  - Fast linear interpolation on the sphere from non-plaid grids.
%   spherelap     - Laplacian of a field on the surface of a sphere.
%   spheresort    - Sorted great circle distances to nearby points on the earth.
%   spheretrans   - Wavelet transform for oscillations on the surface of a sphere.
%   squared       - Squares the modulus of its argument:  SQUARED(X)=ABS(X).^2
%   standalone    - Create stand-alone version of an m-file, including dependencies.
%   stickvect     - Plots "stick vectors" for multicomponent velocity time series.
%   structindex   - Applies an index to all array-valued fields in a structure.
%   tidefreq      - Frequencies of the eight major tidal components.
%   timeseries_boundary - Apply boundary conditions to data before transform.
%   tmat          - 2x2 complex grouping matrix.  TMAT = [1  i; 1 -i] / SQRT(2)
%   to_grab_from_caller - Returns a string to grab variable values from caller.
%   to_overwrite  - Returns a string to overwrite original arguments.
%   topo_copyright - Copyright statement for the Smith and Sandwell topography.
%   topoplot      - Plot regional or global topography at one-sixth degree resolution.
%   trackextract  - Extracts alongtrack altimetry segments within given region.
%   trajchunk     - Chunks Lagrangian trajectories based on the Coriolis period.
%   trajextract   - Extracts Lagrangian trajectory segments within given region.
%   trajunwrap    - Unwraps Lagrangian trajectories from a periodic domain.
%   trajwrap      - Wraps Lagrangian trajectories to fit within a periodic domain.
%   transmax      - Locates modulus maximum points of wavelet transform.
%   transmaxdist  - Distributions of wavelet transform maxima in noise.
%   twodhist      - Two-dimensional histogram.
%   twodmed       - Median value of a function of two variables.
%   twodsort      - Distances from data points to nearby grid points.
%   twodstats     - Mean, variance, and covariance of functions of two variables.
%   twospecplot   - Plots a pair of rotary or Cartesian spectra.
%   use           - Copies structure fields into named variables in workspace.
%   uv2latlon     - Integrates horizontal velocity to give latitude and longitude.
%   uvplot        - Plots the real and imaginary parts of a signal on the same axis.
%   vcolon        - Condenses its arguments, like X(:).
%   vdiff         - Length-preserving first central difference.
%   vectmult      - Matrix multiplication for arrays of vectors.
%   vempty        - Initializes multiple variables to empty sets or empty cell arrays.
%   vfilt         - Filtering along rows without change in length.
%   vindex        - Indexes an N-D array along a specified dimension.
%   vindexinto    - Indexes into N-D array along a specified dimension.
%   vlines        - Add vertical lines to a plot.
%   vmean         - Mean over non-NaN elements along a specified dimension.
%   vmedian       - Median over finite elements along a specified dimension.
%   vmoment       - Central moment over non-NaN elements along a specfied dimension.
%   vrep          - Replicates an array along a specified dimension.
%   vrms          - Root-mean-square of non-NaN elements along a specified dimension.
%   vshift        - Cycles the elements of an array along a specified dimension.
%   vsize         - Returns the sizes of multiple arguments.
%   vsqueeze      - Squeezes multiple input arguments simultaneously.
%   vstd          - Standard deviation over non-NaN elements along a specfied dimension.
%   vsum          - Sum over non-NaN elements along a specified dimension.
%   vswap         - VSWAP(X,A,B) replaces A with B in numeric array X.
%   vtranspose    - Transpose multiple input arguments simultaneously.
%   vzeros        - Initializes multiple variables to arrays of zeros or nans.
%   wavespecplot  - Plot of wavelet spectra together with time series.
%   wavetrans     - Continuous wavelet transform.
%   whichdir      - Returns directory name containing file in search path.
%   wigdist       - Wigner distribution (alias-free algorithm).
%   windtrans     - Ekman-like transfer-functions for the wind-driven response.
%   xlin          - Sets x-axis scale to linear.
%   xlog          - Sets x-axis scale to logarithmic.
%   xoffset       - Offsets lines in the x-direction after plotting.
%   xtick         - Sets locations of x-axis tick marks.
%   xy2latlon     - Converts tangent plane coordinates into latitude and longitude.
%   xyz2latlon    - Converts 3D Cartesian coordinates into latitude and longitude.
%   yearfrac      - Converts a DATENUM into 'year.fraction' and 'month.fraction'.
%   ylin          - Sets y-axis scale to linear.
%   ylog          - Sets y-axis scale to log.
%   yoffset       - Offsets lines in the y-direction after plotting.
%   ytick         - Sets locations of y-axis tick marks.
%   ztick         - Sets locations of z-axis tick marks.
%   __________________________________________________________________
%   This is part of JLAB --- type 'help jlab' for more information
%   (C) 2015--2021 J.M. Lilly --- type 'help jlab_license' for details

if nargin==0
    help jlab_index
else
    if strcmpi(varargin{1},'--create')
        jlab_index_create;
        return
    end
end

function[]=jlab_index_create
jlab_dir=whichdir('jlab_license');
jdata_dir=[jlab_dir(1:end-4) 'jdata'];

for k=1:2
    switch k
        case 1
            mfiles=findfiles(jlab_dir,'m','recursive');
        case 2
            mfiles=findfiles(jdata_dir,'m','recursive');
    end
    for i=1:length(mfiles)
        if strcmp(mfiles{i},'Contents.m')
            mfiles{i}=[];
        end
    end
    mfiles=mfiles(cellength(mfiles)>0);
    mfiles=strs2mat(mfiles);

    for i=size(mfiles,2):-1:1
        [temp,sorter]=sort(mfiles(:,i));
        mfiles=mfiles(sorter,:);
    end
    clear comments
    for i=1:size(mfiles,1)
        %mfiles(i,:)
        comments{i}=commentlines(mfiles(i,:));
    end
    switch k
        case 1
            comments1=strs2mat(comments);
        case 2
            comments2=strs2mat(comments);
    end
end

% clear comments
% comments{1}=comments2;
% comments{2}=comments1;

disp('Start here -->')
disp('%JLAB_INDEX  Alphabetical index into JLAB and JDATA contents.')
disp('%')
disp('% JDATA index')
disp(comments2)
disp('%')
disp('% JLAB index')
disp(comments1)

function[mat]=strs2mat(strcell)

for i=1:length(strcell)
    strcell{i}=real(strcell{i}');
end

cell2col(strcell);
col2mat(strcell);
vswap(strcell,nan,32);
mat=char(strcell');

function[]=jlab_index_test

%reporttest('JLAB_INDEX',aresame())

author: jonathanlilly

repo: jLab

save_path: github-repos/MATLAB/jonathanlilly-jLab


text:
function f = chebfun3double(f, op, dom, pref, isEqui)
%CHEBFUN3DOUBLE   CHEBFUN3 constructor for discrete tensor of values
%   This algorithm is equivalent to chebfun3classic for double inputs.

% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

% The input is a discrete tensor of values.
pseudoLevel = pref.cheb3Prefs.chebfun3eps;
tech = pref.tech();

f = chebfun3();
if ( ~isEqui && numel(op) == 1 )
    f = constructor(f, @(x,y,z) op + 0*x, dom);
    return;
end

% N.B. We cannot detect if MESHGRID was used to generate values unless we
% know also the (x,y,z) points used to generate those values. If we knew
% beforehand that ALL users WILL generate their tensor of values ONLY from
% meshgrid pts, all we need is to say vals = permute(vals,[2 1 3]); to
% generate a tensor corresponding to ''meshgrid'', in which case a copy of
% ``tensorGrid`` should also be used accordingly. op = permute(op,[2 1 3]);
if ( ~isEqui )
    m = size(op, 1);
    n = size(op, 2);
    p = size(op, 3);
    out = tech.tensorGrid([m, n, p], dom);
    xx = out{1};
    yy = out{2};
    zz = out{3};
else
    % Equispaced points from ndgrid, not meshgrid!
    x = linspace(dom(1), dom(2), size(op, 1));
    y = linspace(dom(3), dom(4), size(op, 2));
    z = linspace(dom(5), dom(6), size(op, 3));
    [xx, yy, zz] = ndgrid(x, y, z);
end

% Calculate a tolerance and find numerical rank to this tolerance: The
% tolerance assumes the samples are generated by NDGRID from a function.
% It depends on the size of the sample tensor, hscale of domain, vscale of
% the samples, condition number of the function, and the accuracy target in
% chebfun3 preferences.
[relTol, absTol] = getTol3D(xx, yy, zz, op, max(size(op)), dom, pseudoLevel);
pref.chebfuneps = relTol;

% Perform 3D ACA with complete pivoting:
factor = 0;
[colsValues, rowsValues, pivotVals2D, ~, tubesValues, pivotVals3D, ~, ~, ...
    ~] = completeACA3D(op, absTol, factor, dom, pref);

sepRank = numel(pivotVals3D); % first separation rank
diagValues2D = cell(sepRank, 1);
for k=1:sepRank
    diagValues2D{k} = diag(1./pivotVals2D{k});
end

% BTD ---> Tucker compression:
[core, colsValues, rowsValues] = btd2tucker(colsValues, rowsValues, ...
    diagValues2D, pivotVals3D, absTol);

% Construct a CHEBFUN3 object and call a sampleTest.
if ( ~isEqui )
    f.cols = chebfun(colsValues, dom(1:2), pref);
    f.rows = chebfun(rowsValues, dom(3:4), pref);
    f.tubes = chebfun(tubesValues, dom(5:6), pref);
else
    f.cols = chebfun(colsValues, dom(1:2), 'equi', pref);
    f.rows = chebfun(rowsValues, dom(3:4), 'equi', pref);
    f.tubes = chebfun(tubesValues, dom(5:6), 'equi', pref);
end
f.core = core;
f.domain = dom;
return

end

%%
function [relTol, absTol] = getTol3D(xx, yy, zz, vals, grid, dom, ...
    pseudoLevel)

relTol = 2*grid^(4/5) * pseudoLevel; % this should be vscale and hscale invariant
vscale = max(abs(vals(:)));
[m,n,p] = size(vals);
% Remove some edge values so that df_dx, df_dy and df_dz have the same size.
% xx changes in the first mode:
df_dx = diff(vals(:, 1:n-1, 1:p-1), 1, 1) ./ diff(xx(:, 1:n-1, 1:p-1), 1, 1);
% yy changes row-wise (2nd mode):
df_dy = diff(vals(1:m-1, :, 1:p-1), 1, 2) ./ diff(yy(1:m-1, :, 1:p-1), 1, 2);
% zz changes tube-wise (3rd mode):
df_dz = diff(vals(1:m-1, 1:n-1, :), 1, 3) ./ diff(zz(1:m-1, 1:n-1, :), 1, 3);
gradNorms = [max(abs(df_dx(:))), max(abs(df_dy(:))), max(abs(df_dz(:)))];
% A vector of gradient information over the domain.
if ( isempty(gradNorms) )
    % This happens if the input in not a trivariate function in which case
    % we basically disable using gradient information:
    gradNorms = 1;
end
domDiff = [diff(dom(1:2)) diff(dom(3:4)) diff(dom(5:6))];
absTol = max(max(gradNorms.*domDiff), vscale) * relTol;
% absTol should depend on the vscale of the function while it also uses
% derivative information to prevent issues like the one mentioned in
% https://github.com/chebfun/chebfun/issues/1491.

end

%%
function [colsBtd, rowsBtd, pivotValues2D, pivotIndices2D, fibers, ...
    pivotValues3D, pivotIndices3D, ifail3D, ifail2D] = completeACA3D(A, ...
    tol, factor, dom, pref)
%   Non-adaptive (fixed-size) MACA, i.e., a 3D analogue of Gaussian
%   elimination with complete pivoting.
%
%   INPUTS:     A:        A given tensor of function values at 3D chebpts.
%
%               tol:      A given tolerance on the magnitude of the pivots.
%
%               factor:   The ratio between the width of A and the number
%                         of iterations (rank) allowed in Gaussian elimination.
%
%  OUTPUTS:     colsBtd: A cell-array containing skeleton columns of slices
%                        in block term decomposition.
%
%               rowsBtd: A cell-array containing skeleton rows of slices in
%                        block term decomposition.
%
%               pivotValues2D: A cell array containing the values of pivots
%                              in 2D ACAs.
%
%               pivotIndices2D: A cell array containing indices i.e.,
%                               locations of of 2D pivot points.
%
%                       fibers: A matrix of size n1 x ITER. Each of its columns
%                             contains the values of the updated (residue)
%                             tensor at the pivot fiber.
%
%               pivotValues3D: A row vector containing the values of the
%                             pivot entries during the iterations.
%
%               pivotIndices3D: A matrix of size rank x 3, where rank = iter.
%                         Each of its rows contain the index of one 3D pivotValues.
%
%                      ifail: We fail if iter >= (width/factor).

% Developer Note: The output of this code should satisfy the following
% slice decomposition:
%       AA \approx temp,
% where AA is a copy of A from input, and temp is computed as follows:
%   temp = zeros(size(A2));
%   for i = 1:3,
%    temp = temp + chebfun3.outerProd(slices(:,:,i),fibers(:,i)./pivotValues3D(i));
%   end
%   norm(AA(:) - temp(:))
%
% An analogous BTD decomposotion should also hold.

pseudoLevel = pref.cheb3Prefs.chebfun3eps;
tech = pref.tech();

% Set up output variables.
[n1, n2, n3] = size(A);
width = min(n3, n1*n2);        % Use to tell us how many pivots we can take
                               % See Developer note in the following.
pivotValues3D = zeros(1);      % Store an unknown number of Pivot values
pivotIndices3D = zeros(1, 3);  % Store (col, row, tube) = entries of pivot location
ifail3D = 1;                   % Assume we fail in 3D ACA
ifail2D = 1;                   % Assume we also fail in the 2D ACAs
globalTol = [];
sliceDim = [1 2];              % See Developer note in the following.

% Main algorithm
iter = 0;                      % Count number of interpolated rows/slices.
[infNorm, ind] = max(abs(reshape(A, numel(A), 1))); % Complete pivoting
[col, row, tube] = ind2sub(size(A), ind);

scl = infNorm;
% If the function is the zero function.
if ( scl == 0 )
    pivotValues3D = 0;
    fibers = 0;
    colsBtd{1} = 0;
    rowsBtd{1} = 0;
    pivotValues2D = 0;
    pivotIndices2D = [0 0];
    ifail3D = 0;
    ifail2D = 0;
else
    fibers(:,1) = zeros(size(A, 3), 1);
    colsBtd{1} = zeros(size(A, sliceDim(1)), 1);
    rowsBtd{1} = zeros(size(A, sliceDim(2)), 1);
    pivotValues2D{1} = 0;
    pivotIndices2D{1} = [0 0];
    slices(:,:,1) = zeros(size(A,sliceDim(1)), size(A, sliceDim(2)), 1);
end
dom2D = dom(1:4);

while ( ( infNorm > tol ) && ( iter < width / factor) ...
        && ( iter < width ) )
    fibers(:, iter+1) = A(col, row, :);  % Extract skeleton tubes. Each
    % column in "fibers" is N3 x 1.

    slices(:,:,iter+1) = A(:,:,tube);    % Extract skeleton slices to be
    % decomposed further. Each slice in "slices" is N1 x N2.

    % Developer Note: As the above lines show, we are always separating the
    % last variable from the first two. The point is that the function
    % handle has already been permuted outside this subroutine and
    % therefore the tensor A here contains values of the permuted function.
    % In this sense, here we are in essense separating the variable chosen
    % by the dimension clustering step, and not necessarily the last
    % variable z.

    PivVal3D = A(col, row, tube);        % = f(X(col), Y(row), Z(tube)) in
                                         % the 1st iteration.

    % Use the first slice to compute globalTol for 2D ACAs applied to all
    % slices.
    if ( iter == 0 )
        out = tech.tensorGrid([n1, n2], dom2D);
        xx2D = out{1};
        yy2D = out{2};
        globalTol = GetTol2D(xx2D, yy2D, slices(:,:,1), dom2D, pseudoLevel);
    end

    % Apply 2D ACA to each slice to form columns and rows in block term
    % decomposition:
    [colsBtd{iter+1}, pivotValues2D{iter+1}, rowsBtd{iter+1}, ...
        pivotIndices2D{iter+1}, ifail2DIter] = ...
        chebfun2ACA(slices(:, :, iter+1), globalTol, factor);

    % Developer Note: Since we use globalTol for slices after 1st
    % iteration, it might be that these 2D ACA's don't fail, while with a
    % localTol they would fail. So, it is auaully the 1st slice which shows
    % whether or not we got the 2D rank right. So, just use that one:
    if ( iter == 0 )
        ifail2D = ifail2DIter;
    end

    % Update the tensor, i.e., compute the residual tensor:
    A = A - chebfun3.outerProd(colsBtd{iter+1} * ...
        (diag(1./(pivotValues2D{iter+1}))) * (rowsBtd{iter+1}.'), ...
        fibers(:,iter+1) ./ PivVal3D);
    % Equivalently, we have:
    % A = A - chebfun3.outerProd(slices(:,:,iter+1),fibers(:,iter+1)./PivVal3D);

    % Keep track of progress in 3D ACA:
    iter = iter + 1;              % One more fiber and slice are removed from A
    pivotValues3D(iter) = PivVal3D;           % Store pivot value in 3D ACA
    pivotIndices3D(iter, :)=[col row tube];    % Store pivot location in 3D ACA

    % Find next 3D pivot value and its location:
    [infNorm, ind] = max(abs(A(:)));
    [col, row, tube] = ind2sub(size(A), ind);
end

if ( ( iter > 0 ) && ( all(pivotValues2D{iter} == 0) ) )
    % If the last 2D pivot was zero, remove it
    colsBtd=colsBtd(1:iter-1);
    rowsBtd=rowsBtd(1:iter-1);
    pivotValues2D = pivotValues2D(1:iter-1);
    pivotIndices2D = pivotIndices2D(1:iter-1);
    fibers = fibers(:, 1:iter-1);
    pivotValues3D = pivotValues3D(1:iter-1);
    pivotIndices3D=pivotIndices3D(1:iter-1,:);
    infNorm = 0; % If the last 2D pivot was zero, infNorm will be NaN and
    % it makes the next statement result in ifail3D \neq 0; So, put it 0 to
    % get ifail3D = 0;
end

if ( infNorm <= tol )
    ifail3D = 0;                               % We didn't fail in 3D ACA.
    if ( iter == 0 )
        ifail2D = 0;
    end
end
if ( iter > width/factor )
    ifail3D = 1;                               % We did fail in 3D ACA.
end

end
%%

%%
function absTol = GetTol2D(xx, yy, vals, dom, pseudoLevel)
% GETTOL2D   Calculate a tolerance for the Chebfun2 constructor.
%
%  This is the 2D analogue of the tolerance employed in the chebtech
%  constructors. It is based on a finite difference approximation to the
%  gradient, the size of the approximation domain, the internal working
%  tolerance, and an arbitrary (4/5) exponent.

[m, n] = size(vals);
grid = max(m, n);
relTol = grid^(4/5) * pseudoLevel; % this should be vscale and hscale invariant

% Remove some edge values so that df_dx and df_dy have the same size.
% xx is generated by ndgrid, i.e., xx changes in the first mode:
dfdx = diff(vals(:, 1:n-1), 1, 1) ./ diff(xx(:, 1:n-1), 1, 1);
% yy is generated by ndgrid, i.e., yy changes row-wise (2nd mode):
dfdy = diff(vals(1:m-1, :), 1, 2) ./ diff(yy(1:m-1, :), 1, 2);
gradNorms = [max(abs(dfdx(:))), max(abs(dfdy(:)))];
% A vector of gradient information over the domain.
if ( isempty(gradNorms) )
    % This happens if the input in not a trivariate function.
    gradNorms = 1;
end

vscale = max(abs(vals(:)));
domDiff = [diff(dom(1:2)) diff(dom(3:4))];
absTol = max(max(gradNorms.*domDiff), vscale) * relTol;
end

%%
function [col, pivotVals, row, pivotLoc, ifail2D] = chebfun2ACA(op, ...
    tol, factor)
% Perform GE with complete pivoting:

if ( factor ~= 0 )
    % FACTOR in the 3D steps is either 0 (in case of constructionFromDoubles)
    % or 2sqrt(2) otherwise. For 2D steps however, we are happy with
    % FACTOR = 0 or 2 as in Chebfun2. This IF conditional, makes it
    % possible to rewrite FACTOR in 2D steps, but at the same time keeping
    % it zero fro constructionFromDoubles.
    factor = 2;
end
[pivotVals, pivotLoc, row, col, ifail2D] = completeACA2D(op, tol, factor);
end

%%
function [pivotValue, pivotElement, rows, cols, ifail2D] = ...
    completeACA2D(A, tol, factor)
% 2D ACA with complete pivoting which is the continuous analogue of
% Gaussian elimination with complete pivoting.
% We attempt to adaptively find the numerical rank of function in the 2D
% level. This is _almost_ the same as the one in chebfun2/constructor.

% Set up output variables.
[nx, ny] = size(A);
width = min(nx, ny);        % Use to tell us how many pivots we can take.
pivotValue = zeros(1);      % Store an unknown number of Pivot values.
pivotElement = zeros(1, 2); % Store (j,k) entries of pivot location.
ifail2D = 1;                  % Assume we fail.

% Main algorithm
zRows = 0;                  % count number of zero cols/rows.
[infNorm, ind] = max(abs(reshape(A, numel(A), 1)));
[row, col] = chebfun3.myind2sub(size(A) , ind);

% Bias toward diagonal for square matrices (see reasoning below):
if ( ( nx == ny ) && ( max(abs(diag(A))) - infNorm) > -tol )
    [infNorm, ind] = max(abs(diag(A)));
    row = ind;
    col = ind;
end

scl = infNorm;
% If the function is the zero function
if ( scl == 0 )
    pivotValue = 0;
    cols = 0;
    rows = 0;
    ifail2D = 0;
else
    cols(:,1) = zeros(size(A, 1), 1);
    rows(1,:) = zeros(1, size(A, 2));
end

while ( ( infNorm > tol ) && ( zRows < width / factor) ...
        && ( zRows < min(nx, ny) ) )

    cols(:, zRows+1) = A(:, col);             % Extract skeleton columns
    rows(zRows+1, :) = A(row, :);             % Extract skeleton rows
    PivVal = A(row, col);
    A = A - cols(:, zRows+1)*(rows(zRows+1,:)./PivVal); % One step of GE

    % Keep track of progress.
    zRows = zRows + 1;                       % One more row is interpolated
    pivotValue(zRows) = PivVal;              % Store value of 2D pivot
    pivotElement(zRows, :)=[row col];        % Store index of 2D pivot

    % Find value and index of next 2D pivot
    [infNorm, ind] = max(abs(A(:))); % Slightly faster
    [row, col] = chebfun3.myind2sub(size(A), ind);

    % Have a bias towards the diagonal of A, so that it can be used as a test
    % for nonnegative definite functions. (Complete GE and Cholesky are the
    % same as nonnegative definite functions have an absolute maximum on the
    % diagonal, except there is the possibility of a tie with an off-diagonal
    % absolute maximum. Bias toward diagonal maxima to prevent this.)
    if ( ( nx == ny ) && ( max(abs(diag(A))) - infNorm) > -tol )
        [infNorm, ind] = max(abs(diag(A)));
        row = ind;
        col = ind;
    end
end

if ( infNorm <= tol )
    ifail2D = 0;                               % We didn't fail in 2D ACA
end
if ( zRows >= (width/factor) )
    ifail2D = 1;                               % We did fail in 2D ACA
end

rows = rows.';                               % To unify all the columns,
                                             % rows and tubes, store
                                             % skeleton rows also as column
                                             % vectors.
end

%%
function [core, colsTucker, rowsTucker] = btd2tucker(colsValues, ...
    rowsValues, diagValues2D, pivotVals3D, absTol)
allCols = [];
allRows = [];
allDiags = [];
nn = numel(pivotVals3D);
sizeIndex = zeros(nn, 1);

for kkk = 1:nn
    sizeIndex(kkk) = size(rowsValues{kkk}, 2);
    allCols = [allCols, colsValues{kkk}];
    allRows = [allRows, rowsValues{kkk}];
    allDiags = [allDiags; diag(diagValues2D{kkk})];
end
sizeIndex = cumsum([0; sizeIndex]);

% Compress allCols and allRows:
if ( size(allCols, 2) > 1 )
    [Su, ~, Vu, colsTucker] = completeACA2D(allCols, absTol, 0);
    % factor = 0, because we want the ACA to be applied even if op is not
    % low-rank. In contrast to Chebfun2, we now have
    % allCols = colsTucker * diag(1./Su) * Vu'.
    % Moreover, we use the same absTol to chop columns, the same tolerance
    % used to chop fibers so that ranks are less inconsistent for symmetric
    % functions.
    Vu = Vu*diag(1./Su);
else
    colsTucker = allCols;
    Vu = 1;
end

if ( size(allRows, 2) > 1 )
    [Sv, ~, Vv, rowsTucker] = completeACA2D(allRows, absTol, 0);
    Vv = Vv*diag(1./Sv);
else
    rowsTucker = allRows;
    Vv = 1;
end

% Form the core tensor:
core = zeros(size(colsTucker, 2), size(rowsTucker, 2), nn);
for kkk = 1:nn
    core(:,:,kkk) = Vu(sizeIndex(kkk)+1:sizeIndex(kkk+1), :).' * ...
        diag(allDiags(sizeIndex(kkk)+1:sizeIndex(kkk+1))) * ...
        Vv(sizeIndex(kkk)+1:sizeIndex(kkk+1), :)./pivotVals3D(kkk);
end

if ( (max(abs(allCols(:))) == 0) || (max(abs(allRows(:))) == 0) )
    % zero input
    core = 0;
end

end

author: chebfun

repo: chebfun

save_path: github-repos/MATLAB/chebfun-chebfun


text:
function f = sin( f )
%SIN   Sine of a CHEBFUN2.

% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

% Empty check:
if ( isempty( f ) )
    return
end

f = compose( f, @sin );

end


text:
function integral = piecewise_linear_product_integral ( a, b, f_num, f_x, ...
  f_v, g_num, g_x, g_v )

%*****************************************************************************80
%
%% PIECEWISE_LINEAR_PRODUCT_INTEGRAL: piecewise linear product integral.
%
%  Discussion:
%
%    We are given two piecewise linear functions F(X) and G(X) and we wish
%    to compute the exact value of the integral
%
%      INTEGRAL = Integral ( A <= X <= B ) F(X) * G(X) dx
%
%    The functions F(X) and G(X) are defined as tables of coordinates X and
%    values V.  A piecewise linear function is evaluated at a point X by
%    evaluating the interpolant to the data at the endpoints of the interval
%    containing X.
%
%    It must be the case that A <= B.
%
%    It must be the case that the node coordinates F_X(*) and G_X(*) are
%    given in ascending order.
%
%    It must be the case that:
%
%      F_X(1) <= A and B <= F_X(F_NUM)
%      G_X(1) <= A and B <= G_X(G_NUM)
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    30 April 2009
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real A, B, the limits of integration.
%
%    Input, integer F_NUM, the number of nodes for F.
%
%    Input, real F_X(F_NUM), the node coordinates for F.
%
%    Input, real F_V(F_NUM), the nodal values for F.
%
%    Input, integer G_NUM, the number of nodes for G.
%
%    Input, real G_X(G_NUM), the node coordinates for G.
%
%    Input, real G_V(G_NUM), the nodal values for G.
%
%    Output, real INTEGRAL, the integral of F(X) * G(X)
%    from A to B.
%
  integral = 0.0;

  if ( f_x(f_num) <= a || g_x(g_num) <= a )
    return
  end

  if ( f_num < 2 || g_num < 2 )
    return
  end

  xr = a;

  f_left = 1;
  f_left = r8vec_bracket3 ( f_num, f_x, xr, f_left );
  fr = f_v(f_left) + ( xr - f_x(f_left) ) * ( f_v(f_left+1) - f_v(f_left) ) ...
    / ( f_x(f_left+1) - f_x(f_left) );

  g_left = 1;
  g_left = r8vec_bracket3 ( g_num, g_x, xr, g_left );
  gr = g_v(g_left) + ( xr - g_x(g_left) ) * ( g_v(g_left+1) - g_v(g_left) ) ...
    / ( g_x(g_left+1) - g_x(g_left) );

  xr_max = b;
  xr_max = min ( xr_max, f_x(f_num) );
  xr_max = min ( xr_max, g_x(g_num) );

  while ( xr < xr_max )
%
%  Shift right values to left.
%
    xl = xr;
    fl = fr;
    gl = gr;
%
%  Determine the new right values.
%  The hard part is figuring out how to advance XR some, but not too much.
%
    xr = xr_max;

    for i = 1 : 2
      if ( f_left + i <= f_num )
        if ( xl < f_x(f_left+i) && f_x(f_left+i) < xr )
          xr = f_x(f_left+i);
          break
        end
      end
    end

    for i = 1 : 2
      if ( g_left + i <= g_num )
        if ( xl < g_x(g_left+i) && g_x(g_left+i) < xr )
          xr = g_x(g_left+i);
          break
        end
      end
    end

    f_left = r8vec_bracket3 ( f_num, f_x, xr, f_left );
    fr = f_v(f_left) + ( xr - f_x(f_left) ) * ( f_v(f_left+1) - f_v(f_left) ) ...
      / ( f_x(f_left+1) - f_x(f_left) );

    g_left = r8vec_bracket3 ( g_num, g_x, xr, g_left );
    gr = g_v(g_left) + ( xr - g_x(g_left) ) * ( g_v(g_left+1) - g_v(g_left) ) ...
      / ( g_x(g_left+1) - g_x(g_left) );
%
%  Form the linear polynomials for F(X) and G(X) over [XL,XR],
%  then the product H(X), integrate H(X) and add to the running total.
%
    if ( eps <= abs ( xr - xl ) )

      f1 = fl - fr;
      f0 = fr * xl - fl * xr;

      g1 = gl - gr;
      g0 = gr * xl - gl * xr;

      h2 = f1 * g1;
      h1 = f1 * g0 + f0 * g1;
      h0 = f0 * g0;

      h2 = h2 / 3.0;
      h1 = h1 / 2.0;

      bit = ( ( h2 * xr + h1 ) * xr + h0 ) * xr ...
          - ( ( h2 * xl + h1 ) * xl + h0 ) * xl;

      integral = integral + bit / ( xr - xl ) / ( xr - xl );

    end

  end

  return
end

author: johannesgerer

repo: jburkardt-m


text:
% Test file for chebtech/isreal.m

function pass = test_isreal(pref)

if ( nargin < 1 )
    pref = chebtech.techPref();
end

for n = 1:2
    if ( n == 1 )
        testclass = chebtech1();
    else
        testclass = chebtech2();
    end

    % Test a scalar-valued function:
    f = testclass.make(@(x) sin(x) + 1i*cos(x), [], pref);
    pass(n, 1) = ~isreal(f);

    f = testclass.make(@(x) 1i*cos(x), [], pref);
    pass(n, 2) = ~isreal(f);

    f = testclass.make(@(x) sin(x), [], pref);
    pass(n, 3) = isreal(f);

    % Test an array-valued function:
    f = testclass.make(@(x) [sin(x) + 1i*cos(x), exp(x)], [], pref);
    pass(n, 4) = ~isreal(f);

    f = testclass.make(@(x) [1i*cos(x), exp(x)], [], pref);
    pass(n, 5) = ~isreal(f);

    f = testclass.make(@(x) [sin(x), exp(x)], [], pref);
    pass(n, 6) = isreal(f);
end

end


text:
% op_combinesubspecs.m
% Jamie Near, McGill University 2014.
%
% USAGE:
% out=op_combinesubspecs(in,mode);
%
% DESCRIPTION:
% Combine the subspectra in an acquisition either by addition or
% subtraction.
%
% INPUTS:
% in        = input data in matlab structure format.
% mode      = -"diff" adds the subspectra together (this is counter intuitive,
%             but the reason is that many "difference editing" sequences use phase
%             cycling of the readout ADC to achieve "subtraction by addition".
%             -"summ" performs a subtraction of the subspectra.
%
% OUTPUTS:
% out       = Output following combination of subspectra.

function out=op_combinesubspecs(in,mode);

if in.flags.subtracted
    error('ERROR:  Subspectra have already been combined!  Aborting!');
end
if in.flags.isFourSteps
    error('ERROR: data with four steps must first be converted using op_fourStepCombine.m!  Aborting!');
end

% if ~in.flags.freqcorrected
%     disp('WARNING:  Frequency correction has not yet been performed!');
% end
% if ~in.flags.phasecorrected
%     disp('WARNING:  Phase correction has not yet been performed!');
% end

if mode=='diff'
    %add the spectrum along the subSpecs dimension;
    fids=sum(in.fids,in.dims.subSpecs);
    fids=fids/in.sz(in.dims.subSpecs); %divide by number of subspecs so that this is an averaging operation;
elseif mode=='summ'
    %subtract the spectrum along the subSpecs dimension;
    fids=diff(in.fids,1,in.dims.subSpecs);
    fids=fids/in.sz(in.dims.subSpecs); %divide by nymber of subspecs so that this is an averaging operation;
end

fids=squeeze(fids);

%re-calculate Specs using fft
specs=fftshift(ifft(fids,[],in.dims.t),in.dims.t);

%change the dims variables
if in.dims.t>in.dims.subSpecs
    dims.t=in.dims.t-1;
else
    dims.t=in.dims.t;
end
if in.dims.coils>in.dims.subSpecs
    dims.coils=in.dims.coils-1;
else
    dims.coils=in.dims.coils;
end
if in.dims.averages>in.dims.subSpecs
    dims.averages=in.dims.averages-1;
else
    dims.averages=in.dims.averages;
end
dims.subSpecs=0;
if in.dims.extras>in.dims.subSpecs
    dims.extras=in.dims.extras-1;
else
    dims.extras=in.dims.extras;
end

%re-calculate the sz variable
sz=size(fids);

%FILLING IN DATA STRUCTURE
out=in;
out.fids=fids;
out.specs=specs;
out.sz=sz;
out.dims=dims;
out.subspecs=1;
out.averages=in.averages/2;

%FILLING IN THE FLAGS
out.flags=in.flags;
out.flags.writtentostruct=1;
out.flags.subtracted=1;

author: CIC-methods

repo: FID-A

save_path: github-repos/MATLAB/CIC-methods-FID-A


text:
% eeg_rejsuperpose() - superpose rejections of a EEG dataset.
%
% Usage:
%   >> EEGOUT = eeg_rejsuperpose( EEGIN, typerej, Rmanual, Rthres, ...
%                    Rconst, Rent, Rkurt, Rfreq, Rothertype);
%
% Inputs:
%   EEGIN      - input dataset
%   typerej    - type of rejection (1=raw data; 0=ica).
%   Rmanual    - include manual rejection (0|1).
%   Rthres     - include threshold rejection (0|1).
%   Rconst     - include rejection of constant activity (0|1).
%   Rent       - include entropy rejection (0|1).
%   Rkurt      - include kurtosis rejection (0|1).
%   Rfreq      - include frequcy based rejection (0|1).
%   Rothertype - include manual rejection (0|1).
%
% Outputs:
%   EEGOUT     - with rejglobal and rejglobalE fields updated
%
% See also: eeglab()

% Copyright (C) 2001 Arnaud Delorme, Salk Institute, arno@salk.edu
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

function [EEG, com] = eeg_rejsuperpose( EEG, typerej, Rmanual, Rthres, Rconst, ...
                              Rent, Rkurt, Rfreq, Rothertype);

if nargin < 9
	help eeg_rejsuperpose;
	return;
end;

typerej = ~typerej;
rejglobal  = zeros( 1, EEG.trials);
rejglobalE = zeros( EEG.nbchan, EEG.trials);

if typerej == 0 | Rothertype
	if Rmanual
		rejglobal  = rejarray( rejglobal,  EEG.reject.rejmanual); % see bottom for the
		rejglobalE = rejarray( rejglobalE, EEG.reject.rejmanualE); % function rejarray
	end;
	if Rthres
		rejglobal  = rejarray( rejglobal,  EEG.reject.rejthresh);
		rejglobalE = rejarray( rejglobalE, EEG.reject.rejthreshE);
	end;
	if Rfreq
		rejglobal  = rejarray( rejglobal,  EEG.reject.rejfreq);
		rejglobalE = rejarray( rejglobalE, EEG.reject.rejfreqE);
	end;
	if Rconst
		rejglobal  = rejarray( rejglobal,  EEG.reject.rejconst);
		rejglobalE = rejarray( rejglobalE, EEG.reject.rejconstE);
	end;
	if Rent
		rejglobal  = rejarray( rejglobal,  EEG.reject.rejjp);
		rejglobalE = rejarray( rejglobalE, EEG.reject.rejjpE);
	end;
	if Rkurt
		rejglobal  = rejarray( rejglobal,  EEG.reject.rejkurt);
		rejglobalE = rejarray( rejglobalE, EEG.reject.rejkurtE);
	end;
end;

% ---------------

if typerej == 1 | Rothertype
	if Rmanual
		rejglobal  = rejarray( rejglobal,  EEG.reject.icarejmanual);
		rejglobalE = rejarray( rejglobalE, EEG.reject.icarejmanualE);
	end;
	if Rthres
		rejglobal  = rejarray( rejglobal,  EEG.reject.icarejthresh);
		rejglobalE = rejarray( rejglobalE, EEG.reject.icarejthreshE);
	end;
	if Rfreq
		rejglobal  = rejarray( rejglobal,  EEG.reject.icarejfreq);
		rejglobalE = rejarray( rejglobalE, EEG.reject.icarejfreqE);
	end;
	if Rconst
		rejglobal  = rejarray( rejglobal,  EEG.reject.icarejconst);
		rejglobalE = rejarray( rejglobalE, EEG.reject.icarejconstE);
	end;
	if Rent
		rejglobal  = rejarray( rejglobal,  EEG.reject.icarejjp);
		rejglobalE = rejarray( rejglobalE, EEG.reject.icarejjpE);
	end;
	if Rkurt
		rejglobal  = rejarray( rejglobal,  EEG.reject.icarejkurt);
		rejglobalE = rejarray( rejglobalE, EEG.reject.icarejkurtE);
	end;
end;

EEG.reject.rejglobal = rejglobal;
EEG.reject.rejglobalE = rejglobalE;

com =sprintf('%s = eeg_rejsuperpose( %s, %d, %d, %d, %d, %d, %d, %d, %d);', ...
	  inputname(1), inputname(1), ~typerej, Rmanual, Rthres, Rconst, Rent, Rkurt, Rfreq, Rothertype);

return;

% subfunction rejecting an array ------
function dest = rejarray( dest, ori)
	if ~isempty(ori)
		dest = dest | ori;
	end;
return;

author: PatternRecognition

repo: OpenBMI


text:
function [imdef, grad] = imdeform3_and_grad(imfix, T, varargin) %, interp_type, out_type, out_val, pix_resolution)
% deform image
    interp_type = 0;
    out_type = 0;
    out_val = 0;
    pix_resolution = [1,1,1];

    if nargin >= 3
        if ~isempty(varargin{1})
            interp_type = varargin{1};
        end
    end
    if nargin >= 4
        if ~isempty(varargin{2})
            out_type = varargin{2};
        end
    end
    if nargin >= 5
        if ~isempty(varargin{3})
            out_val = varargin{3};
        end
    end
    if nargin >= 6
        if ~isempty(varargin{4})
            pix_resolution = varargin{4};
            T = conv_2d_T_from_phys_to_pix(T, pix_resolution);
        end
    end

    if size(imfix, 1) ~= size(T, 1) || size(imfix, 2) ~= size(T, 2) ||...
            size(imfix, 3) ~= size(T, 3) || size(T, 4) ~= 3
        error('Dimensions dont match');
    end

    if isa(imfix, 'single') && isa(T, 'single')
        [imdef, grad] = mex_3d_volume_warp_and_grad_float(imfix, T, interp_type, out_type, out_val);
    elseif isa(imfix, 'double') && isa(T, 'double')
        [imdef, grad] = mex_3d_volume_warp_and_grad_double(imfix, T, interp_type, out_type, out_val);
    else
        error('Variables class mismatch')
    end
end

repo: pTVreg


text:
% Compile libraries and download network

[home_dir, name, ext] = fileparts(mfilename('fullpath'));

warning('ON', 'STRCF:install')

% mtimesx
if exist('external_libs/mtimesx', 'dir') == 7
    cd external_libs/mtimesx
    mtimesx_build;
    cd(home_dir)
else
    error('STRCF:install', 'Mtimesx not found.')
end

% PDollar toolbox
if exist('external_libs/pdollar_toolbox/external', 'dir') == 7
    cd external_libs/pdollar_toolbox/external
    toolboxCompile;
    cd(home_dir)
else
    warning('STRCF:install', 'PDollars toolbox not found. Clone this submodule if you want to use HOG features. Skipping for now.')
end

% matconvnet
if exist('external_libs/matconvnet/matlab', 'dir') == 7
    cd external_libs/matconvnet/matlab
    try
        disp('Trying to compile MatConvNet with GPU support')
        vl_compilenn('enableGpu', true)
    catch err
        warning('STRCF:install', 'Could not compile MatConvNet with GPU support. Compiling for only CPU instead.\nVisit http://www.vlfeat.org/matconvnet/install/ for instructions of how to compile MatConvNet.\nNote: remember to move the mex-files after re-compiling.');
        vl_compilenn;
    end
    status = movefile('mex/vl_*.mex*');
    cd(home_dir)

    % donwload network
    cd feature_extraction
    mkdir networks
    cd networks
    if ~(exist('imagenet-vgg-m-2048.mat', 'file') == 2)
        disp('Downloading the network "imagenet-vgg-m-2048.mat" from "http://www.vlfeat.org/matconvnet/models/imagenet-vgg-m-2048.mat"...')
        urlwrite('http://www.vlfeat.org/matconvnet/models/imagenet-vgg-m-2048.mat', 'imagenet-vgg-m-2048.mat')
        disp('Done!')
    end
    cd(home_dir)
else
    warning('STRCF:install', 'Matconvnet not found. Clone this submodule if you want to use CNN features. Skipping for now.')
end

repo: STRCF


text:
function ap = context_test(dataset, cls)
% Rescore detections on the test dataset using the context
% rescoring SVMs trained by context_train.m.
%   ap = context_test(dataset, cls)
%
% Return value
%   ap          AP score for context rescoring
%
% Arguments
%   dataset     Dataset to context rescore
%   cls         Object class to rescore (if not given, all are rescored)

% AUTORIGHTS
% -------------------------------------------------------
% Copyright (C) 2011-2012 Ross Girshick
% Copyright (C) 2008, 2009, 2010 Pedro Felzenszwalb, Ross Girshick
%
% This file is part of the voc-releaseX code
% (http://people.cs.uchicago.edu/~rbg/latent/)
% and is available under the terms of an MIT-like license
% provided in COPYING. Please retain this notice and
% COPYING if you use this file (or a portion of it) in
% your project.
% -------------------------------------------------------

conf = voc_config();
cachedir = conf.paths.model_dir;
VOCopts  = conf.pascal.VOCopts;
VOCyear  = conf.pascal.year;

if nargin < 1
  dataset = conf.eval.test_set;
end

if nargin < 2
  cls = [];
end

% Get detections, filter bounding boxes, and context feature vectors
% to be rescored
[ds_all, bs_all, X] = context_data(dataset, VOCyear);

ids = textread(sprintf(VOCopts.imgsetpath, dataset), '%s');
numids = length(ids);
numcls = length(VOCopts.classes);
ap = zeros(numcls, 1);

fprintf('Rescoring detections\n');
if ~isempty(cls)
  cls_inds = strmatch(cls, VOCopts.classes, 'exact');
else
  cls_inds = 1:numcls;
end

ap = nan(numcls, 1);

for c = cls_inds
  cls = VOCopts.classes{c};
  fprintf('%d/%d %s ', c, numcls, cls);
  try
    load([cachedir cls '_boxes_' dataset '_context_' VOCyear]);
  catch
    load([cachedir cls '_context_classifier']);
    pos_ind = find(model.Label == 1);
    for i = 1:numids
      if ~isempty(X{c,i})
        [~, ~, s] = svmpredict(ones(size(X{c,i},1), 1), X{c,i}, model);
        s = model.Label(1)*s;
        ds_all{c}{i}(:,end) = s;
        bs_all{c}{i}(:,end) = s;
      end
    end
    ds = ds_all{c};
    bs = bs_all{c};
    save([cachedir cls '_boxes_' dataset '_context_' VOCyear], 'ds', 'bs');
  end
  ap(c) = pascal_eval(cls, ds, dataset, VOCyear, ['context_' VOCyear]);
  fprintf(' %.3f\n', ap(c));
end

fprintf('average = %f\n', nanmean(ap));

author: rbgirshick

repo: voc-dpm

save_path: github-repos/MATLAB/rbgirshick-voc-dpm


text:
function jframe = getjframe(hFig)
% getjframe Retrieves the underlying Java frame for a figure
%
% Syntax:
%    jframe = getjframe(hFigureOrComponent)
%
% Description:
%    GETJFRAME retrieves the current figure (gcf)'s underlying Java frame,
%    thus enabling access to all 35 figure callbacks that are not exposed
%    by Matlab's figure.
%
%    Notable callbacks include: FocusGainedCallback, FocusLostCallback,
%    KeyPressedCallback, KeyReleasedCallback, MouseEnteredCallback,
%    MouseExitedCallback, MousePressedCallback, MouseReleasedCallback,
%    WindowActivatedCallback, WindowClosedCallback, WindowClosingCallback,
%    WindowOpenedCallback, WindowStateChangedCallback and 22 others.
%
%    The returned jframe object also allows access to other useful window
%    features: 'AlwaysOnTop', 'CloseOnEscapeEnabled', 'Resizable',
%    'Enabled', 'HWnd' (for those interested in Windows integration) etc.
%    Type "get(jframe)" to see the full list of properties.
%
%    GETJFRAME(hFig) retrieves a specific figure's underlying Java frame.
%    hFig is a Matlab handle, or a list of graphic handles (not necessarily
%    figure handle(s) - the handles' containing figure is used).
%
% Examples:
%    get(getjframe,'ListOfCallbacks');  %display list of supported callbacks
%    set(getjframe,'WindowStateChangedCallback','disp(''Window min/maxed'')')
%    set(getjframe,'WindowDeiconifiedCallback',@winMaximizedCallback)
%    set(getjframe,'WindowIconifiedCallback',{@winMinimizedCallback,mydata})
%    set(getjframe,'CloseOnEscapeEnabled','on')
%    jframes = getjframe([gcf,hButton]);  % get 2 java frames, from 2 figures
%
% Bugs and suggestions:
%    Please send to Yair Altman (altmany at gmail dot com)
%
% Change log:
%    2007-08-05: First version posted on MathWorks File Exchange
%    2007-08-11: Added Matlab figure handle property; improved responsiveness handling; added support for array of handles; added sanity checks for illegal handles
%    2011-10-14: Fix for R2011b
%    2014-09-02: Fix for R2014b (HG2)
%    2018-06-28: Additional fixes for R2014b onward (HG2)
%    2019-03-01: Extra check for additional robustness
%
% See also:
%    gcf, findjobj (on the File Exchange)

% Programmed by Yair M. Altman: altmany(at)gmail.com
% $Revision: 1.2 $  $Date: 2020/02/07 07:00:37 $

  try
      % Default figure = current (gcf)
      if nargin < 1 || ~all(ishghandle(hFig))
          if nargin && ~all(ishghandle(hFig))
              error('hFig must be a valid GUI handle or array of handles');
          end
          hFig = gcf;
      end

      % Require Java engine to run
      if ~usejava('jvm')
          error([mfilename ' requires Java to run.']);
      end

      % Initialize output var (needed in case hFig is empty)
      jframe = handle([]);

      % Loop over all requested figures
      for figIdx = 1 : length(hFig)

          % Get the root Java frame
          jff = getJFrame(hFig(figIdx));

          % Add the 'ListOfCallbacks' read-only property to jframe
          fields = fieldnames(get(jff));
          cb1Idx = find(~cellfun('isempty',strfind(fields,'Callback'))); %#ok<*STRCL1>
          cb2Idx = find(~cellfun('isempty',strfind(fields,'CallbackData')));
          cbIdx = setdiff(cb1Idx, cb2Idx)';
          cbNames = fields(cbIdx);
          jframe(figIdx) = handle(jff,'callbackproperties');
          addReadOnlyProp(jframe(figIdx),'ListOfCallbacks',cbNames);

          % Add another read-only property for direct access to the wrapped java object
          addReadOnlyProp(jframe(figIdx),'JavaComponent',jff);

          % Add another read-only property for direct access to the original Matlab figure handle
          addReadOnlyProp(jframe(figIdx),'MatlabFigureHandle',hFig(figIdx));
      end

  % Error handling
  catch
      v = version;
      if v(1)<='6'
          err.message = lasterr;  %#ok<*LERR> % no lasterror function...
      else
          err = lasterror;
      end
      try
          err.message = regexprep(err.message,'Error using ==> [^\n]+\n','');
      catch
          try
              % Another approach, used in Matlab 6 (where regexprep is unavailable)
              startIdx = findstr(err.message,'Error using ==> '); %#ok<*FSTR>
              stopIdx = findstr(err.message,char(10)); %#ok<*CHARTEN>
              for idx = length(startIdx) : -1 : 1
                  idx2 = min(find(stopIdx > startIdx(idx)));  %#ok ML6
                  err.message(startIdx(idx):stopIdx(idx2)) = [];
              end
          catch
              % never mind...
          end
      end
      if isempty(findstr(mfilename,err.message))
          % Indicate error origin, if not already stated within the error message
          err.message = [mfilename ': ' err.message];
      end
      if v(1)<='6'
          while err.message(end)==char(10)
              err.message(end) = [];  % strip excessive Matlab 6 newlines
          end
          error(err.message);
      else
          rethrow(err);
      end
  end

%% Add a read-only property to an object
function addReadOnlyProp(obj,propName,initValue)
  try
      % This will fail in R2014b+ since schema.prop is no longer supported in HG2
      sp = schema.prop(obj,propName,'mxArray');
      set(obj,propName,initValue);
      set(sp,'AccessFlags.PublicSet','off');
  catch
      % Never mind - property might already exist...
  end

%% Get the root Java frame (up to 10 tries, to wait for figure to become responsive)
function jframe = getJFrame(hFigHandle)

  % Ensure that hFig is a figure handle...
  hFig = ancestor(hFigHandle,'figure');
  if isempty(hFig)
      error(['Cannot retrieve the figure handle for handle ' num2str(hFigHandle)]);
  end

  jframe = [];
  maxTries = 10;
  while maxTries > 0
      try
          % Get the figure's underlying Java frame
          oldWarn = warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
          jf = get(handle(hFig),'JavaFrame');
          warning(oldWarn);

          % Get the Java frame's root frame handle
          %jframe = jf.getFigurePanelContainer.getComponent(0).getRootPane.getParent;
          try
              jClient = jf.fFigureClient;  % This works up to R2011a
          catch
              try
                  jClient = jf.fHG1Client;  % This works from R2008b-R2014a
              catch
                  jClient = jf.fHG2Client;  % This works from R2014b and up
              end
          end
          jframe = jClient.getWindow;  % equivalent to above...
          if ~isempty(jframe)
              break;
          else
              maxTries = maxTries - 1;
              drawnow; pause(0.1);
          end
      catch
          maxTries = maxTries - 1;
          drawnow; pause(0.1);
      end
  end
  if isempty(jframe)
      try jframe = javax.swing.SwingUtilities.getWindowAncestor(jf.getAxisComponent); catch, end % see controllibutils.centerfig (%matlabroot%\toolbox\shared\controllib\graphics\+controllibutils.m)
  end
  if isempty(jframe)
      error('Cannot retrieve the java frame for the specified handle');
  end

author: canlab

repo: CanlabCore

save_path: github-repos/MATLAB/canlab-CanlabCore


text:
% Authors: A. Iscen, G. Tolias, Y. Avrithis, T. Furon, O. Chum. 2017.
% find index for the truncated affinity
function f = findtrunc(v, qv, k, imids)

   [knn, ~] = knn_wrap(v, qv, k,100);
   f = find(ismember(imids,knn));

author: ahmetius

repo: diffusion-retrieval