text:
function[varargout]=instmom(varargin)
%INSTMOM  Univariate and multivariate instantaneous moments.
%   don't need this because it really doesn't seep things up much from
%   using anatrans and instmome
%
%   [A,OMEGA,UPSILON]=INSTMOM(X), where X is an analytic signal, computes
%   the amplitude A, instantaneous *radian* frequency OMEGA, and
%   instantaneous bandwidth assuming a unit sample rate.
%
%   X is an array with the first dimension being "time".  Thus, X can be a
%   matrix of analytic signals oriented as column vectors, or a 2- or 3-D
%   wavelet transform such as output by WAVETRANS.
%
%   The output arrays are the same size as X.
%
%   The instantaneous frequency, bandwidth, and curvature are defined as
%
%            A    = abs X
%          OMEGA  = d/dt Im ln X = d/dt arg X
%         UPSILON = d/dt Re ln X = d/dt ln abs X
%
%   where i=SQRT(-1) as usual.
%
%   INSTMOM(X,DIM) computes the moments along dimension DIM, instead of
%   the default of computing the moments along the rows (DIM=1).
%
%   For details, see
%
%       Lilly & Olhede (2010), "Bivariate instantaneous frequency and
%            bandwidth", IEEE Trans. Sig. Proc., 58 (2), 591--603.
%   _____________________________________________________________________
%
%   Sample interval
%
%   INSTMOM(DT,...) uses sample interval DT, where DT is a scalar, for
%   computing time derivatives.  DT=1 is the default.
%   _____________________________________________________________________
%
%   Joint instantaneous moments
%
%   INSTMOM can also calculate the joint instananeous moments of
%   multivariate signals, as defined in Lilly and Olhede (2010).
%
%   [JA,JOMEGA,JUPSILON]=INSTMOM(X1,X2,...,XN,DIM) returns the *joint*
%   instantaneous moments calculated across the N signals X1,X2,... XN,
%   based on the univariate instantaneous moments along dimension DIM.
%
%   The joint instantaneous amplitude JA is the root-mean-square of the
%   component amplitudes across dimension JDIM, while JOMEGA is power-
%   weighted average of the component instantaneous frequencies.
%
%   For details and for the definition of the joint instantaneous bandwidth
%   JUPSILON, see Lilly and Olhede (2010).
%
%   [JA,JOMEGA,JUPSILON]=INSTMOM(X,DIM,JDIM) also works, where the joint
%   instantaneous moments are calculated across dimensions JDIM of X.
%
%   The joint instantaneous moments JA, JOMEGA, and JUPSILON then have the
%   same size as X, except along dimension JDIM where they have only one
%   entry.  Note that DIM is no longer optional when JDIM is used.
%   _____________________________________________________________________
%
%   Instantaneous curvature
%
%   INSTMOM can also return the next-higher order instantaneous moment,
%   which is more rarely encountered.
%
%   [A,OMEGA,UPSILON,XI]=INSTMOM(X) returns the instantaneous curvature XI,
%   defined as
%
%            XI   = d^2/dt^2 abs X / abs X + i d^2/dt^2 arg X
%                 = UPSILON^2 + d/dt UPSILON + i d/dt OMEGA
%
%   Similarly [JA,JOMEGA,JUPSILON,JXI]=INSTMOM(X,DIM,JDIM) returns the
%   joint instantaneous curvature JXI for the multivariate signal X.
%
%   For details on the univariate and joint instantaneous curvature, see
%
%       Lilly and Olhede (2012a), "Analysis of modulated multivariate
%            oscillations", IEEE Trans. Sig. Proc., 60 (2), 600--612.
%   _____________________________________________________________________
%
%   Boundary conditions
%
%   The first and last points must be treated differently, as the central
%   difference is not defined there.  Three different methods can be used.
%
%   INSTMOM(...,STR) specifies the method: STR= 'endpoint' (the default),
%   'periodic', or 'nans'.  See VDIFF for details.
%   _____________________________________________________________________
%
%   'instmom --f' generates some sample figures.
%
%   Usage: [a,om]=instmom(x);
%          [a,om,up,xi]=instmom(dt,x);
%          [a,om,up,xi]=instmom(dt,x,dim);
%          [a,om,up,xi]=instmom(dt,x1,x2,x3,x4,dim);
%          [a,om,up,xi]=instmom(dt,x,dim,jdim);
%   __________________________________________________________________
%   This is part of JLAB --- type 'help jlab' for more information
%   (C) 2007--2019 J.M. Lilly --- type 'help jlab_license' for details

%   _____________________________________________________________________
%
%   Higher-order modulation functions
%
%   [OMEGA,RHO1,...RHON]=INSTMOM(X) also outputs the higher-order
%   instantaneous modulation functions.  RHO1 is identical to the
%   bandwidth, and RHO2 is called the curvature.
%
%   For details see
%
%      Lilly and Olhede (2010).  On the analytic wavelet transform.
%
%   Note that the modulation functions are defined in their non-normalized
%   form, that is, not divided by powers of the instananeous frequency,
%   unlike in Lilly and Olhede (2010).
%
%   _____________________________________________________________________

if strcmpi(varargin{1}, '--t')
    instmom_test,return
elseif strcmpi(varargin{1}, '--f')
    type makefigs_instmom
    makefigs_instmom;
    return
end

if length(varargin{1})==1
    dt=varargin{1};
    varargin=varargin(2:end);
else
    dt=1;
end

str='endpoint';
dim=1;
jdim=[];
for i=1:4
    if ischar(varargin{end})
        str=varargin{end};
        varargin=varargin(1:end-1);
    else
        if length(varargin{end})==1
            if length(varargin{end-1})==1
                dim=varargin{end-1};
                jdim=varargin{end};
                varargin=varargin(1:end-2);
            else
                dim=varargin{end};
                varargin=varargin(1:end-1);
            end
        end
    end
end

N=length(varargin);
if N==1
    x=varargin{1};
else
    jdim=lnsd(varargin{1})+1;
    sizex1=size(varargin{1});
    sizex1=sizex1(1:jdim-1);
    x=zeros([sizex1 N]);
    for i=1:N
         x=vindexinto(x,varargin{i},i,jdim);
    end
end

%Note: there are different ways to reasonably define the instantaneous
%frequency as a vdiff of the signal.  These differ greatly actually.
%Diffing the unwrapped angle seems to give the best results.  If you take
%the Im of the diffed log, you will break the wavelet phase algorithm!

%You definitely don't want to just do diff(x).  This differences the real
%and imaginary parts separately, which are themselves rapidly varying.

om=vdiff(unwrap(angle(x),[],dim),dim,str)./dt;
up=vdiff(log(abs(x)),dim,str)./dt;
eta=om-sqrt(-1)*up;

varargout{1}=abs(x);
varargout{2}=om;
nmax=nargout-2;

%I prefer this version, though difference is minor
%if nmax>=1
%   varargout(3)=frac(1,abs(x)).*vdiff(vdiff(abs(x),1,str),1,str)./dt./dt+sqrt(-1)*vdiff(om,1,str)./dt;
%end

if nmax>=1
    etadiff=cell(nmax,1);
    polyargs=cell(nmax,1);
    bcell=cell(nmax,1);

    etadiff{1}=vdiff(eta,dim,str)./dt;
    polyargs{1}=up;

    for n=2:nmax
        etadiff{n}=vdiff(etadiff{n-1},dim,str)./dt;
        polyargs{n}=sqrt(-1)*etadiff{n-1};
    end

    temp=bellpoly(polyargs);
    for n=1:length(temp)
        varargout{n+2}=temp{n};
    end
end

%When JDIM is input, this tells me to output joint quantities
if ~isempty(jdim)
    if nargout==1
        varargout{1}=jointmom(x,jdim);
    elseif nargout==2
        [varargout{1},varargout{2}]=jointmom(x,varargout{2},jdim);
    elseif nargout==3
        [varargout{1},varargout{2},varargout{3}]=jointmom(x,varargout{2},varargout{3},jdim);
    elseif nargout==4
        [varargout{1},varargout{2},varargout{3},varargout{4}]=jointmom(x,varargout{2},varargout{3},varargout{4},jdim);
    end
end

function[varargout]=jointmom(varargin)
%JOINTMOM  Joint instantaneous frequency, bandwidth, and curvature.
%
%   OMEGAX=JOINTMOM(X,OMEGA,DIM) where X is an array of multiple analytic
%   signals and OMEGA is an array of their instantaneous frequencies, gives
%   the joint instaneous frequency OMEGAX averaged over dimension DIM.
%
%   X is presumed to have time oriented in rows.  The output matrix OMEGAX
%   are the same size as X except along dimension DIM, where the output
%   matrices will have length one.  X and OMEGA are the same size.
%
%   [OMEGAX,UPSILONX]=JOINTMOM(X,UPSILON,DIM) also works, where UPSILON
%   are the individual bandwidths, and UPSILONX is the joint quantity.
%   UPSILON is the same size as X and OMEGA.
%
%   Finally [OMEGAX,UPSILONX,XIX]=JOINTMOM(X,UPSILON,XI,DIM) also returns
%   the joint instantaneous curvature XIX given individual curvatures XI.
%
%   For details, see
%
%       Lilly & Olhede (2010), "Bivariate instantaneous frequency and
%            bandwidth", IEEE Trans. Sig. Proc., 58 (2), 591--603.
%
%   See also INSTMOM.
%
%   Usage: [a,om]=jointmom(x,om,dim);
%          [a,om,up]=jointmom(x,om,up,dim);
%          [a,om,up,xi]=jointmom(x,om,xi,dim);
%   __________________________________________________________________
%   This is part of JLAB --- type 'help jlab' for more information
%   (C) 2009--2014 J.M. Lilly --- type 'help jlab_license' for details

dim=varargin{end};
x=varargin{1};
varargin=varargin(2:end-1);

if ~isempty(varargin)
    om=varargin{1};
end
if length(varargin)>1
    upsilon=varargin{2};
end
if length(varargin)>2
   xi=varargin{3};
end

varargout{1}=sqrt(vmean(abs(x).^2,dim));
if nargout>1
    varargout{2}=vmean(om,dim,squared(x));
    ombar=vrep(varargout{2},size(x,dim),dim);
end
if nargout>2
    varargout{3}=sqrt(vmean(abs(upsilon+sqrt(-1)*(om-ombar)).^2,dim,squared(x)));
end
if nargout>3
    varargout{4}=sqrt(vmean(abs(xi+2*sqrt(-1)*upsilon.*(om-ombar)-(om-ombar).^2).^2,dim,squared(x)));
end
if nargout>4
     error('Sorry, INSTMOM only outputs the first two deviation vectors for joint moments.')
end

function[]=instmom_test

load npg2006
use npg2006

[a1,om1,up1,c1]=instmom(cv);
[a2,om2,up2,c2]=instmom(permute(cv,[2 1]),2);

reporttest('INSTMOM moments computed along different dimensions match', aresame([om1 up1 c1],[om2(:) up2(:) c2(:)]));
jointmom_test;

function[]=jointmom_test
load solomon
use solomon

[x,z]=anatrans(x,z);

[ax,omx,upx]=instmom(x);
[az,omz,upz]=instmom(z);

ombar=frac(abs(x).^2.*omx+abs(z).^2.*omz,abs(x).^2+abs(z).^2);
upbar=sqrt(frac(abs(x).^2.*(upx.^2+(omx-ombar).^2)+abs(z).^2.*(upz.^2+(omz-ombar).^2),abs(x).^2+abs(z).^2));

[a,om,up]=instmom([x z],1,2);

reporttest('INSTMOM joint moments using Solomon Islands frequency',aresame(om,ombar,1e-8))
reporttest('INSTMOM joint moments using Solomon Islands bandwidth',aresame(up,upbar,1e-8))

[a2,om2,up2]=instmom(x,z,1);

reporttest('INSTMOM joint moments alternate form',aresame([a om up],[a2 om2 up2]))

author: jonathanlilly

repo: jLab

save_path: github-repos/MATLAB/jonathanlilly-jLab


text:
function [ loss, real_x ] = loss_with_gradient_single_before( data, net )
train = data.train;
label = data.label;
LL = double(-1:0.02:1);
N = numel(net.layers);

res = struct(...
    'x',cell(1,N+1),...
    'dzdx',cell(1,N+1),...
    'dzdw',cell(1,N+1));
res(1).x = train;

%% forword propagation
for n = 1:N
    l = net.layers{n};
    switch l.type
        case 'X_org'
            res(n+1).x = xorg (res(n).x , l.weights{1} , l.weights{2});
        case 'Convo'
            res(n+1).x = convo(res(n).x , l.weights{1});
        case 'Non_linorg'
          res(n+1).x = zorg( LL ,res(n).x , l.weights{1});
        case 'Multi_org'
            res(n+1).x = betaorg(res(n-1).x , res(n).x ,l.weights{1} );
        case 'X_mid'
            res(n+1).x = xmid( res(n-1).x , res(n).x, res(1).x , l.weights{1} , l.weights{2});
        case 'Non_linmid'
           res(n+1).x = zmid(LL, res(n).x , res(n-2).x , l.weights{1} );
        case 'Multi_mid'
            res(n+1).x = betamid(res(n-3).x , res(n-1).x , res(n).x ,l.weights{1});
        case 'Multi_final'
            res(n+1).x = betafinal(res(n-3).x , res(n-1).x , res(n).x, l.weights{1});
        case 'loss'
              res(n+1).x = rnnloss(res(n).x, label);
        otherwise
            error('No such layers type.');
      end;

end;
    loss = res(end).x;
    loss = double(loss);
    real_x = res(end-1).x;
end

repo: Deep-ADMM-Net


text:
function msm_to_mm_test08 ( )

%*****************************************************************************80
%
%% MSM_TO_MM_TEST08 tests MSM_TO_MM_ARRAY_REAL_GENERAL.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    02 November 2008
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'MSM_TO_MM_TEST08\n' );
  fprintf ( 1, '  Convert an MSM to MM array real general format.\n' );

  output_filename = 'msm_to_mm_test08.mm';

  a = r8mat_indicator ( 5, 3 );
%
%  Have MSM_TO_MM write the matrix to a file.
%
  msm_to_mm ( output_filename, a, 'array', 'real', 'general' );

  return
end

author: johannesgerer

repo: jburkardt-m


text:
function accuracy = ClassifyDataset(dataset, labels, P, G)
% returns the accuracy of the model P and graph G on the dataset
%
% Inputs:
% dataset: N x 10 x 3, N test instances represented by 10 parts
% labels:  N x 2 true class labels for the instances.
%          labels(i,j)=1 if the ith instance belongs to class j
% P: struct array model parameters (explained in PA description)
% G: graph structure and parameterization (explained in PA description)
%
% Outputs:
% accuracy: fraction of correctly classified instances (scalar)
%
% Copyright (C) Daphne Koller, Stanford Univerity, 2012

N = size(dataset, 1);
accuracy = 0.0;
calclabels = zeros(size(labels));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% YOUR CODE HERE
if size(size(G),2) == 2
	G1 = G; G2 = G;
else
	G1 = reshape(G(:,:,1),10,2);
	G2 = reshape(G(:,:,2),10,2);
end

for i = 1:N
	data = reshape(dataset(i,:,:),10,3);
	log1 = log(P.c(1));
	log2 = log(P.c(2));
	for j = 1:10
		if G1(j,1) == 1   % construct g1 and g2 in the beginning from g
			%do shit
			theta1 = P.clg(j).theta(1,:);   theta2 = P.clg(j).theta(2,:);
			parent1 = data(G1(j,2),:);   parent2 = data(G2(j,2),:);
			mu_y1 = sum(theta1(1:4).*[1, parent1]);mu_y2 = sum(theta2(1:4).*[1, parent2]);
			mu_x1 = sum(theta1(5:8).*[1, parent1]);mu_x2 = sum(theta2(5:8).*[1, parent2]);
			mu_a1 = sum(theta1(9:12).*[1, parent1]);mu_a2 = sum(theta2(9:12).*[1, parent2]);
			log1 += lognormpdf(data(j,1),mu_y1,P.clg(j).sigma_y(1));
			log1 += lognormpdf(data(j,2),mu_x1,P.clg(j).sigma_x(1));
			log1 += lognormpdf(data(j,3),mu_a1,P.clg(j).sigma_angle(1));
			log2 += lognormpdf(data(j,1),mu_y2,P.clg(j).sigma_y(2));
			log2 += lognormpdf(data(j,2),mu_x2,P.clg(j).sigma_x(2));
			log2 += lognormpdf(data(j,3),mu_a2,P.clg(j).sigma_angle(2));

		else
			log1 += lognormpdf(data(j,1),P.clg(j).mu_y(1),P.clg(j).sigma_y(1));
			log1 += lognormpdf(data(j,2),P.clg(j).mu_x(1),P.clg(j).sigma_x(1));
			log1 += lognormpdf(data(j,3),P.clg(j).mu_angle(1),P.clg(j).sigma_angle(1));
			log2 += lognormpdf(data(j,1),P.clg(j).mu_y(2),P.clg(j).sigma_y(2));
			log2 += lognormpdf(data(j,2),P.clg(j).mu_x(2),P.clg(j).sigma_x(2));
			log2 += lognormpdf(data(j,3),P.clg(j).mu_angle(2),P.clg(j).sigma_angle(2));
		end
	end
	calclabels(i,:) = [log1,log2];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[temp,temp1] = max(calclabels,[],2);
[temp,temp2] = max(labels,[],2);
accuracy = sum(temp1==temp2)/N;
fprintf('Accuracy: %.2f\n', accuracy);

author: anhncs

repo: Probabilistic-Graphical-Models


text:
function Retinex = retinex_frankle_mccann(L, nIterations)

% RETINEX_FRANKLE_McCANN:
%         Computes the raw Retinex output from an intensity image, based on the
%         original model described in:
%         Frankle, J. and McCann, J., "Method and Apparatus for Lightness Imaging"
%         US Patent #4,384,336, May 17, 1983
%
% INPUT:  L           - logarithmic single-channel intensity image to be processed
%         nIterations - number of Retinex iterations
%
% OUTPUT: Retinex     - raw Retinex output
%
% NOTES:  - The input image is assumed to be logarithmic and in the range [0..1]
%         - To obtain the retinex "sensation" prediction, a look-up-table needs to
%         be applied to the raw retinex output
%         - For colour images, apply the algorithm individually for each channel
%
% AUTHORS: Florian Ciurea, Brian Funt and John McCann.
%          Code developed at Simon Fraser University.
%
% For information about the code see: Brian Funt, Florian Ciurea, and John McCann
% "Retinex in Matlab," by Proceedings of the IS&T/SID Eighth Color Imaging
% Conference: Color Science, Systems and Applications, 2000, pp 112-121.
%
% paper available online at http://www.cs.sfu.ca/~colour/publications/IST-2000/
%
% Copyright 2000. Permission granted to use and copy the code for research and
% educational purposes only.  Sale of the code is not permitted. The code may be
% redistributed so long as the original source and authors are cited.

global RR IP OP NP Maximum
RR = L;
Maximum = max(L(:));                                 % maximum color value in the image
[nrows, ncols] = size(L);

shift = 2^(fix(log2(min(nrows, ncols)))-1);          % initial shift
OP = Maximum*ones(nrows, ncols);                     % initialize Old Product

while (abs(shift) >= 1)
   for i = 1:nIterations
      CompareWith(0, shift);                         % horizontal step
      CompareWith(shift, 0);                         % vertical step
   end
   shift = -shift/2;                                 % update the shift
end
Retinex = NP;

function CompareWith(s_row, s_col)
global RR IP OP NP Maximum
IP = OP;
if (s_row + s_col > 0)
   IP((s_row+1):end, (s_col+1):end) = OP(1:(end-s_row), 1:(end-s_col)) + ...
   RR((s_row+1):end, (s_col+1):end) - RR(1:(end-s_row), 1:(end-s_col));
else
   IP(1:(end+s_row), 1:(end+s_col)) = OP((1-s_row):end, (1-s_col):end) + ...
   RR(1:(end+s_row),1:(end+s_col)) - RR((1-s_row):end, (1-s_col):end);
end
IP(IP > Maximum) = Maximum;                          % The Reset operation
NP = (IP + OP)/2;                                    % average with the previous Old Product
OP = NP;                                             % get ready for the next comparison

author: AomanHao

repo: Matlab-Image-Dehaze-Enhance


text:
function M0 = matching_ind_und(CIJ)
%MATCHING_IND_UND       matching index
%
%   M0 = MATCHING_IND_UND(CIJ) computes matching index for undirected
%   graph specified by adjacency matrix CIJ. Matching index is a measure of
%   similarity between two nodes' connectivity profiles (excluding their
%   mutual connection, should it exist).
%
%   Inputs:     CIJ,    undirected adjacency matrix
%
%   Outputs:    M0,     matching index matrix.
%
%   Richard Betzel, Indiana University, 2013
%
CIJ0 = CIJ;
K = sum(CIJ0);
R = K ~= 0;
N = sum(R);
CIJ = CIJ0(R,R);
I = ~eye(N);
M = zeros(N,N);
for i = 1:N

    c1 = CIJ(i,:);
    use = bsxfun(@or,c1,CIJ);
    use(:,i) = 0;
    use = use.*I;

    ncon1 = bsxfun(@times,use,c1);
    ncon2 = bsxfun(@times,use,CIJ);
    ncon = sum(ncon1 + ncon2,2);

    M(:,i) = 2*sum(ncon1 & ncon2,2)./ncon;

end
M = M.*I;
M(isnan(M)) = 0;
M0 = zeros(size(CIJ0));
M0(R,R) = M;

author: fieldtrip

repo: fieldtrip

save_path: github-repos/MATLAB/fieldtrip-fieldtrip


text:
function T = spm_type(x, arg)
% translates data type specifiers between SPM & Matlab representations
% FORMAT T = spm_type(x, arg)
% x    - specifier
% T    - type
% arg  - optional string argument, can be
%    - 'maxval'  - return maximum allowed value.
%    - 'minval'  - return minimum allowed value.
%    - 'nanrep'  - return 1 if there is a NaN representation.
%    - 'bits'    - return the number of bits per voxel.
%    - 'intt'    - return 1 if values rounded to nearest integer.
%_______________________________________________________________________
%
% Format specifiers are based on NIFTI-1.  If the input is
% a number then the corresponding matlab string is returned by default.
% If the input is a string then the appropriate TYPE is returned.
% However, if the optional arg argument is supplied then other
% information will be returned instead.
%
% With no arguments, a list of data types is returned.
%_______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% John Ashburner & Andrew Holmes
% $Id$

prec = char('uint8','int16','int32','float32','float64','int8','uint16','uint32');
types   = [    2      4      8   16   64   256    512    768];
maxval  = [2^8-1 2^15-1 2^31-1  Inf  Inf 2^7-1 2^16-1 2^32-1];
minval  = [    0  -2^15  -2^31 -Inf -Inf  -2^7      0      0];
nanrep  = [    0      0      0    1    1     0      0      0];
bits    = [    8     16     32   32   64     8     16     32];
intt    = [    1      1      1    0    0     1      1      1];

if nargin==0,
    T=types;
    return;
end;

if ischar(x),
    sel = [];
    for i=1:numel(types),
        if strcmpi(deblank(prec(i,:)),deblank(x)),
            sel = i;
            break;
        end;
    end;
else,
    sel = find(types == x);
end;
if nargin == 1,
    if ischar(x),
        if isempty(sel), T = NaN;
        else, T = types(sel); end;
    else,
        if isempty(sel), T = 'unknown';
        else, T = deblank(prec(sel,:)); end;
    end;
elseif isempty(sel),
    T = NaN;
else,
    switch lower(arg)
    case 'maxval',  T = maxval(sel);
    case 'minval',  T = minval(sel);
    case 'nanrep',  T = nanrep(sel);
    case 'bits',    T = bits(sel);
    case 'intt',    T = intt(sel);
    otherwise,      T = NaN;
    end;
end;


text:
report_this_filefun(mfilename('fullpath'));

% plot the results
% old and re3 (initially ) is the b-value matrix
%
re3=zvg;
r=ra;

zv2 = zvg;
l = ra > 30.00;
zvg(l)=nan;
figure
clf
[X,Y,Z] = meshgrid(gy,gx,gz);
zs = [-16 -12 -7 -1];
sl = slice(X,Y,Z,zvg,[mean(gy)] ,[ mean(gx)],[-20 -50]);

clf
sl = slice(X,Y,Z,pro,X2,Y2,Z2);
hold on
sl = slice(X,Y,Z,pro,X2,Y2,Z2);

hold on
rotate3d on
caxis([0 0.3])
%set(gca,'XLim',[s1_east s2_west],'xgrid','off')
%set(gca,'YLim',[s4_south s3_north],'ygrid','off')
%set(gca,'ZLim',[ -max(a.Depth)-2 0 ],'zgrid','off')

shading interp
cob = colorbar('vert')
set(cob,'TickDir','out','pos',[0.8 0.3 0.07 0.3])
set(gca,'Box','on','vis','on')
tmp = ra*nan;
tmp(1,1,1) = 0;
tmp(1,1,2) = 1;
hold on
sl = slice(X,Y,Z,tmp,[mean(gy)] ,[ -118.6],zs);
caxis([0 0.4])
set(sl(:),'EdgeColor',[0.5 0.5 0.5]);
view([-36 10])
axis([min(gy) max(gy) min(gx) max(gx) min(gz) max(gz)]);
grid off
plot3(a.Latitude,a.Longitude,-a.Depth,'yo','MarkerSize',2)
hold on

main =  [ -118.5370   34.2133   94.0453    1.0000   17.0000    6.7000   18.4010];

epimax = plot3(main(:,2),main(:,1),-main(:,7),'hm');
set(epimax,'LineWidth',2.5,'MarkerSize',18,...
    'MarkerFaceColor','w','MarkerEdgeColor','r')
hold on
aft1 = [ -118.6700   34.3692   97.3163    4.0000   26.0000    5.1000   16.4510];
epimax = plot3(aft1(:,2),aft1(:,1),-aft1(:,7),'^m');
set(epimax,'LineWidth',2.5,'MarkerSize',16,...
    'MarkerFaceColor','w','MarkerEdgeColor','m')

author: CelsoReyes


text:
2
37
4
GD
2
male
female
CN
2
C1
C2
EM
3
P
U
N
SJ
10
S1
S2
S3
S4
S5
S6
S7
S8
S9
S10
1
0
20
6
../Lukas_Coarse2/m.AlvaranP051303.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.AstorA072903.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.BlumenkronF070103.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.CabrerraD121002.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.ChieppaM112703.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.CrawfordA020604.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.DeleonM062403.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.DezwartJ120302.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.DuaneD010904.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/m.DudekJ062303.full.reg+tlrc.BRIK
1
../Lukas_Coarse2/f.AhnS102803.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.BosettiF090103.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.BrewerD040113.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.BrownC011403.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.ChapinH090103.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.DakinK101403.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.DanubeC050103.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.GauriT121603.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.GoltzM111103.full.reg+tlrc.BRIK
2
../Lukas_Coarse2/f.GrutzmacherS090903.full.reg+tlrc.BRIK
2
1
1
1
2
1
3
2
1
2
2
2
3
test3


text:
function RelFiles = buildReleaseZIP( WorkingDir, zipFileName, MainFile, RelFiles, RuntimeDependencies )
% Creates a ZIP file of all release dependencies for a main file
%
% Syntax:	BUILDRELEASEZIP( WORKINGDIR, ZIPFILENAME, MAINFILE, RUNTIMEDEPENDENCIES )
%
% Inputs:
% 	WorkingDir          - The working directory of the project to release.
% 	zipFileName         - The name the final ZIP file.
% 	MainFile            - The path to the file for which to determine the
%                         dependencies and consequently build the release
%                         ZIP.
%   RelFiles            - A list of files to release (the main file's
%                         dependencies are added to this list).
% 	RuntimeDependencies - If true, dependencies are found during a profiled
%                         runtime.
%
% Outputs:
% 	RelFiles            - The final list of released files.
%
% Example:
%     wrkdir = 'C:\myProject\';
%     zipFname = 'myProject_release';
%     mainFile = 'C:\myProject\examples\fullyfledgedexample.m';
%     buildReleaseZIP( wrkdir, zipFname, mainFile, {}, true )
%
% See also: requiredFilesAndProducts, zip

% Author: Jacob Donley
% University of Wollongong
% Email: jrd089@uowmail.edu.au
% Copyright: Jacob Donley 2017
% Date: 09 August 2017
% Version: 1.1 (09 August 2017)
% Version: 1.0 (07 May 2017)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Get all dependencies of the main file
flist = matlab.codetools.requiredFilesAndProducts( MainFile );                      % Full dependency file list

%% Get dependencies of the main file during runtime (includes anonymous functions and dynamic function handles)
% The MATLAB profiler is used here and can take quite some time if the main file is slow to run
if RuntimeDependencies
    profile on;                                                                        % Turn the profiler on
    [p,f]=fileparts(MainFile);
    func = strrep(strrep([p filesep f],filesep,'.'),'+','');                           % Deal with class folders and create function handle
    evalin('caller',[func ';']);                                                       % Assume file runs without arguments and run
    p = profile('info');                                                               % Stop the profiler after execution and get the profiler information
    flist = [flist {p.FunctionTable.FileName}];                                        % Append the runtime functions to the list
    dbs=dbstack;                                                                       % Get history of called functions for this runtime
    flist(contains(flist,{dbs.name})) = [];                                            % Remove references to this function and parents
end

%% Only keep files in working directory
RelFiles = unique([RelFiles(:)' flist(contains(flist,WorkingDir))]);                    % Release files

%% Copy to temp directory so zipping retains folder structure
newdirs = unique(cellfun(@fileparts, strrep(RelFiles, WorkingDir, ''),'un',0));     % Determine structure
tmpdir = [tempname filesep];                                                        % Get temp directory
cellfun(@(a) mkdir( [tmpdir a] ), newdirs);                                         % Create temp folder structure
cellfun(@(a,b) copyfile(a,[tmpdir b]), RelFiles, strrep(RelFiles, WorkingDir, '')); % Copy

%% Zip the entire folder
zip(zipFileName, tmpdir, WorkingDir);

%% Clean up
rmdir(tmpdir,'s');                                                                  % Delete all the temporarily copied files

end

author: jtkim-kaist

repo: Speech-enhancement


text:
% This is material illustrating the methods from the book
% Financial Modelling  - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors:  Joerg Kienitz
%           Daniel Wetterau
%
% Please send comments, suggestions, bugs, code etc. to
% kienitzwetterau_FinModelling@gmx.de
%
% (C) Joerg Kienitz, Daniel Wetterau
%
% Since this piece of code is distributed via the mathworks file-exchange
% it is covered by the BSD license
%
% This code is being provided solely for information and general
% illustrative purposes. The authors will not be responsible for the
% consequences of reliance upon using the code or for numbers produced
% from using the code.

clear; clc;
%% Parameters
S = 100;                                   % Spot prices
T = 5;      % maturities

r = 0;                      % discount factors
d = 0;                              % dividends

titS = 'MC NIG CIR - Asset Paths';

legend_base = 'Base scenario';

alpha = 10;
beta = -3;                            % CEV exponent base scenario
delta = 1;
mu = 0;
lambda = 2;
kappa = 1;
eta = 0.5;

%% Simulation parameters
NTime = 120; NSim = 1; NBatches = 1;
NTime_clock = 10;
K = ones(NTime+1,1);
K = T*cumsum(K)/(NTime+1);
K1 = K(2:end);

rstream = RandStream('mt19937ar','Seed',12345);
rstreamstate = rstream.State;

PathS = MC_NIGCIR(S,r,d,T,alpha,beta,delta,kappa,eta,lambda,NTime,NSim,NBatches);
%% Changing lambda
lambda_low = 1;
lambda_high = 3;

    rstream.State = rstreamstate;
    PathS_low = MC_NIGCIR(S,r,d,T,alpha,beta,delta,kappa,eta,lambda_low,NTime,NSim,NBatches);
    rstream.State = rstreamstate;
    PathS_high = MC_NIGCIR(S,r,d,T,alpha,beta,delta,kappa,eta,lambda_high,NTime,NSim,NBatches);

legend_low = 'Changing \lambda low';
legend_high = 'Changing \lambda high';

createfigure_path(K,PathS_low, PathS, PathS_high, titS, legend_low, legend_base, legend_high);

% calculate the returns
ReturnsS1_low = calcreturns(PathS_low,0);
ReturnsS1 = calcreturns(PathS,0);
ReturnsS1_high = calcreturns(PathS_high,0);

createfigure_returns(K1,ReturnsS1_low, ReturnsS1, ReturnsS1_high, titS, legend_low, legend_base, legend_high);

%% Changing kappa
kappa_low = 0.5;
kappa_high = 2;

    rstream.State = rstreamstate;
    PathS_low = MC_NIGCIR(S,r,d,T,alpha,beta,delta,kappa_low,eta,lambda,NTime,NSim,NBatches);
    rstream.State = rstreamstate;
    PathS_high = MC_NIGCIR(S,r,d,T,alpha,beta,delta,kappa_high,eta,lambda,NTime,NSim,NBatches);

legend_low = 'Changing \kappa low';
legend_high = 'Changing \kappa high';

createfigure_path(K,PathS_low, PathS, PathS_high, titS, legend_low, legend_base, legend_high);

% calculate the returns
ReturnsS1_low = calcreturns(PathS_low,0);
ReturnsS1 = calcreturns(PathS,0);
ReturnsS1_high = calcreturns(PathS_high,0);

createfigure_returns(K1,ReturnsS1_low, ReturnsS1, ReturnsS1_high, titS, legend_low, legend_base, legend_high);

%% Changing eta
eta_low = 0.25;
eta_high = 0.75;

    rstream.State = rstreamstate;
    PathS_low = MC_NIGCIR(S,r,d,T,alpha,beta,delta,kappa,eta_low,lambda,NTime,NSim,NBatches);
    rstream.State = rstreamstate;
    PathS_high = MC_NIGCIR(S,r,d,T,alpha,beta,delta,kappa,eta_high,lambda,NTime,NSim,NBatches);

legend_low = 'Changing \eta low';
legend_high = 'Changing \eta high';

createfigure_path(K,PathS_low, PathS, PathS_high, titS, legend_low, legend_base, legend_high);

% calculate the returns
ReturnsS1_low = calcreturns(PathS_low,0);
ReturnsS1 = calcreturns(PathS,0);
ReturnsS1_high = calcreturns(PathS_high,0);

createfigure_returns(K1,ReturnsS1_low, ReturnsS1, ReturnsS1_high, titS, legend_low, legend_base, legend_high);

clear; clc;

author: Sable

repo: mcbench-benchmarks


text:
function disp(TC)

%DISP Display threecomp object
%   DISP(TC)

% Author: Michael West, Geophysical Institute, Univ. of Alaska Fairbanks
% $Date$
% $Revision$

% TEST FOR NON-EMPTY TRACE DATA

if numel(TC)>1
    [n,m] = size(TC); % char returns a cell array
    disp([num2str(n) ' x ' num2str(m) ' threecomp object']);
end

if numel(TC)==1
    if any(isempty(TC.traces))
        disp('**Empty waveforms. Use VERIFY function');
    else
        net = get(TC.traces(1),'NETWORK');
        sta = get(TC.traces(1),'STATION');
        chan1 = get(TC.traces(1),'CHANNEL');
        chan2 = get(TC.traces(2),'CHANNEL');
        chan3 = get(TC.traces(3),'CHANNEL');
        chan = [chan1(1:end-1) '[' chan1(end) chan2(end) chan3(end) ']'];
        loc = get(TC.traces(1),'LOCATION');
        disp(['    net_sta_chan_loc:    ' net '_' sta '_' chan '_' loc]);

        disp(['    duration:            ' get(TC.traces(1),'DURATION_STR') ]);

        disp(['    sample rate:         ' num2str(get(TC.traces(1),'FREQ')) ' Hz']);

        disp(['    type:                ' char(get(TC,'TYPE')) ]);

        disp(['    trigger:             ' datestr(get(TC,'TRIGGER'),'yyyy/mm/dd HH:MM:SS.FFF') ]);

        if isempty(TC.backAzimuth)
            disp(['    backAzimuth:         ' 'property not set' ]);
        else
            disp(['    backAzimuth:         ' num2str(TC.backAzimuth) ]);
        end

        if isempty(TC.orientation)
            disp(['    orientation:         ' 'property not set' ]);
        else
            disp(['    orientation(' chan1(3) '):      ' num2str(TC.orientation(1)) '(h) '  num2str(TC.orientation(2)) '(v)' ]);
            disp(['    orientation(' chan2(3) '):      ' num2str(TC.orientation(3)) '(h) '  num2str(TC.orientation(4)) '(v)' ]);
            disp(['    orientation(' chan3(3) '):      ' num2str(TC.orientation(5)) '(h) '  num2str(TC.orientation(6)) '(v)' ]);

        end

        if isempty(TC.rectilinearity)
            disp(['    rectilinearity:      property not set' ]);
        else
            disp(['    rectilinearity:      ' num2str(get(TC.rectilinearity,'FREQ')) ' Hz, ' num2str(get(TC.rectilinearity,'THREECOMP_WINDOW')) ' sec window']);
        end

        if isempty(TC.planarity)
            disp(['    planarity:           property not set' ]);
        else
            disp(['    planarity:           ' num2str(get(TC.rectilinearity,'FREQ')) ' Hz, ' num2str(get(TC.rectilinearity,'THREECOMP_WINDOW')) ' sec window']);
        end

        if isempty(TC.energy)
            disp(['    energy:              property not set' ]);
        else
            disp(['    energy:              ' num2str(get(TC.rectilinearity,'FREQ')) ' Hz, ' num2str(get(TC.rectilinearity,'THREECOMP_WINDOW')) ' sec window']);
        end

        if isempty(TC.azimuth)
            disp(['    azimuth:             property not set' ]);
        else
            disp(['    azimuth:             ' num2str(get(TC.rectilinearity,'FREQ')) ' Hz, ' num2str(get(TC.rectilinearity,'THREECOMP_WINDOW')) ' sec window']);
        end

        if isempty(TC.inclination)
            disp(['    inclination:         property not set' ]);
        else
            disp(['    inclination:         ' num2str(get(TC.rectilinearity,'FREQ')) ' Hz, ' num2str(get(TC.rectilinearity,'THREECOMP_WINDOW')) ' sec window']);
        end
    end
end

author: geoscience-community-codes

repo: GISMO


text:
function s=mergestruct(s1,s2)
%
% s=mergestruct(s1,s2)
%
% merge two struct objects into one
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2012/12/22
%
% input:
%      s1,s2: a struct object, s1 and s2 can not be arrays
%
% output:
%      s: the merged struct object. fields in s1 and s2 will be combined in s.
%
% license:
%     BSD or GPL version 3, see LICENSE_{BSD,GPLv3}.txt files for details
%
% -- this function is part of jsonlab toolbox (http://iso2mesh.sf.net/cgi-bin/index.cgi?jsonlab)
%

if(~isstruct(s1) || ~isstruct(s2))
    error('input parameters contain non-struct');
end
if(length(s1)>1 || length(s2)>1)
    error('can not merge struct arrays');
end
fn=fieldnames(s2);
s=s1;
for i=1:length(fn)
    s=setfield(s,fn{i},getfield(s2,fn{i}));
end


text:
function [r_eb_e,v_eb_e,C_b_e] = NED_to_ECEF(L_b,lambda_b,h_b,v_eb_n,C_b_n)
%NED_to_ECEF - Converts curvilinear to Cartesian position, velocity
%resolving axes from NED to ECEF and attitude from NED- to ECEF-referenced
%
% Software for use with "Principles of GNSS, Inertial, and Multisensor
% Integrated Navigation Systems," Second Edition.
%
% This function created 2/4/2012 by Paul Groves
%
% Inputs:
%   L_b           latitude (rad)
%   lambda_b      longitude (rad)
%   h_b           height (m)
%   v_eb_n        velocity of body frame w.r.t. ECEF frame, resolved along
%                 north, east, and down (m/s)
%   C_b_n         body-to-NED coordinate transformation matrix
%
% Outputs:
%   r_eb_e        Cartesian position of body frame w.r.t. ECEF frame, resolved
%                 along ECEF-frame axes (m)
%   v_eb_e        velocity of body frame w.r.t. ECEF frame, resolved along
%                 ECEF-frame axes (m/s)
%   C_b_e         body-to-ECEF-frame coordinate transformation matrix

% Copyright 2012, Paul Groves
% License: BSD; see license.txt for details

% Parameters

R_0 = 6378137; %WGS84 Equatorial radius in meters
ecc2= 0.0818191908425^2; %WGS84 eccentricity

% Begins

% Calculate transverse radius of curvature using (2.105)
R_E = R_0 / sqrt(1 - ecc2*sin(L_b)^2);

% Convert position using (2.112)
cos_lat = cos(L_b);
sin_lat = sin(L_b);
cos_long = cos(lambda_b);
sin_long = sin(lambda_b);
r_eb_e = [(R_E + h_b) * cos_lat * cos_long;...
          (R_E + h_b) * cos_lat * sin_long;...
          ((1 - ecc2) * R_E + h_b) * sin_lat];

% Calculate ECEF to NED coordinate transformation matrix using (2.150)
C_e_n = [-sin_lat * cos_long, -sin_lat * sin_long,  cos_lat;...
                   -sin_long,            cos_long,        0;...
         -cos_lat * cos_long, -cos_lat * sin_long, -sin_lat];

% Transform velocity using (2.73)
v_eb_e = C_e_n' * v_eb_n;

% Transform attitude using (2.15)
C_b_e = C_e_n' * C_b_n;

% Ends

author: benzenemo

repo: TightlyCoupledINSGNSS


text:
function geometry_test20715 ( )

%*****************************************************************************80
%
%% TEST20715 tests TRIANGLE_POINT_DIST_SIGNED_2D;
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    04 December 2010
%
%  Author:
%
%    John Burkardt
%
  ntest = 7;

  ptest = [ ...
     0.25,   0.25; ...
     0.75,   0.25; ...
     1.00,   1.00; ...
    11.00,   0.50; ...
     0.00,   1.00; ...
     0.50, -10.00; ...
     0.60,   0.60 ]';
  t = [ ...
    0.0, 1.0; ...
    0.0, 0.0; ...
    1.0, 0.0 ]';

  fprintf ( 1, '\n' );
  fprintf ( 1, 'TEST20715\n' );
  fprintf ( 1, '  For a triangle in 2D,\n' );
  fprintf ( 1, '  TRIANGLE_POINT_DIST_SIGNED_2D computes signed\n' );
  fprintf ( 1, '    distance to a point;\n' );

  r8mat_transpose_print ( 2, 3, t, '  Triangle vertices:' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '       P       DIST_SIGNED\n' );
  fprintf ( 1, '\n' );

  for i = 1 : ntest

    p(1:2,1) = ptest(1:2,i);

    dist_signed = triangle_point_dist_signed_2d ( t, p );

    fprintf ( 1, '  %10f  %10f  %10f\n', p(1:2,1), dist_signed );

  end

  return
end


text:
% clear
savethis = 1;
if exist('peval','var')
    fpirntf('There is a variable called peval already. Saved in peval_bckp.')
    peval_bckp = peval;
    clear peval
end

ncomp = [10 20 30];

itervec=1; %number of evaluation of each dataset
peval.sript_name = mfilename;

% set here the path to the data (in this case data must be in mat format):
peval.data_path = '~/project/data/qdots/....';
peval.data_file = 'dpixc';

load([peval.data_path '/' peval.data_file])

% uncomment this for callibration of the data to photon counts:
% bgOffset=700; % this is from the background images
% photonFactor = .2612; %from EM ccd callibration: https://docs.google.com/spreadsheet/ccc?key=0AlBph96P6KPwdEtOcGJWampsaHpGOHBDYUtIZ19LS2c&hl=en_US#gid=0
% dpixc = photonFactor*(dpixc-bgOffset);
% dpixc=dpixc(:,:,1:300);

% bacground estimation is here:
peval.bg=100;

[peval.nx, peval.ny, peval.nt]=size(dpixc);
for nc = ncomp;
%     for iterindex=1:niter
    for iterindex=itervec
        if savethis
            [peval.logfile, peval.fid] = initlogfile;
        end
        if sum(dpixc(:)<=0)
            mfprintf(peval.fid,'Clipping negative values in the dpixc!\n')
            dpixc(dpixc<=0)=eps; % to avoid negative values and zeros...
        end

        params %reads the parameters
%         datasource = [peval.home '/' peval.data_path '/' peval.data_dir '/' peval.data_file];

%         readdata

        % Estimating / subtracting background:
        %         [dpixc, peval]=backgroundestimation(dpixc, peval, p.offset);

%         peval.bg=p.offset;
        %         dpixc=bgsubtractbyhand(dpixc,peval);
        peval.ncomp=nc;

        dvec=reshape(dpixc,peval.nx*peval.ny,peval.nt);

        for indexrestart=0:peval.nrestarts-1
            % Initialization of W:
            %             winit = init_wmap('rand',peval,double(array2im(dpixc_ind)));
            if indexrestart>0
                mfprintf(peval.fid, '\nRestart %g: h restarted and w reused\n',indexrestart);
                winit = init_w_general('res',peval,res.w);
                peval.fix_bg_h=0; mfprintf(peval.fid,'\nBackground component of h will be updated\n')

            else
                winit = init_w_general(peval.init_w_method,peval,[]);
            end
            hinit = init_h_general(peval.init_h_method,peval,[],dpixc);

            % Main computation:
            [res, peval]=peval.fun(peval, dvec,winit, hinit);
        end

        if savethis
            res.data_file = peval.data_path; % just to keep track where the filel is
            peval = createresname(peval,iterindex);
            if ~exist('p','var')
                p = [];
            end
            saveresults(res, peval, p, [peval.res_path peval.res_dir '/' peval.res_name])
            fclose(peval.fid(2));
        end
    end
    if savethis
        % Saving parametes and logfile into the directory with resuls
        saveparameters(peval,p)
    end
end
% plottingmulti
% plotscattehvsblinkmat

author: aludnam

repo: MATLAB

save_path: github-repos/MATLAB/aludnam-MATLAB


text:
Network torchvision.models.googlenet {
Layer Conv2d-1 {
Type: CONV
Stride { X: 2, Y: 2 }
Dimensions { K: 64, C: 3, R: 7, S: 7, Y: 224, X: 224 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-2 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 64, R: 1, S: 1, Y: 56, X: 56 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-3 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 192, C: 64, R: 3, S: 3, Y: 56, X: 56 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-4 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 192, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-5 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 96, C: 192, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-6 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 96, R: 3, S: 3, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-7 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 16, C: 192, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-8 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 32, C: 16, R: 3, S: 3, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-9 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 32, C: 192, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-10 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 256, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-11 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 256, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-12 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 192, C: 128, R: 3, S: 3, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-13 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 32, C: 256, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-14 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 96, C: 32, R: 3, S: 3, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-15 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 256, R: 1, S: 1, Y: 28, X: 28 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-16 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 192, C: 480, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-17 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 96, C: 480, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-18 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 208, C: 96, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-19 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 16, C: 480, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-20 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 48, C: 16, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-21 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 480, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-22 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 512, R: 1, S: 1, Y: 4, X: 4 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Linear-23 {
Type: CONV
Dimensions { K: 1024, C: 2048, R: 1, S: 1, Y: 1, X: 1 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Linear-24 {
Type: CONV
Dimensions { K: 1000, C: 1024, R: 1, S: 1, Y: 1, X: 1 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-25 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 160, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-26 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 112, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-27 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 224, C: 112, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-28 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 24, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-29 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 24, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-30 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-31 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-32 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-33 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 256, C: 128, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-34 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 24, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-35 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 24, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-36 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-37 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 112, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-38 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 144, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-39 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 288, C: 144, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-40 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 32, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-41 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 32, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-42 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 64, C: 512, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-43 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 528, R: 1, S: 1, Y: 4, X: 4 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Linear-44 {
Type: CONV
Dimensions { K: 1024, C: 2048, R: 1, S: 1, Y: 1, X: 1 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Linear-45 {
Type: CONV
Dimensions { K: 1000, C: 1024, R: 1, S: 1, Y: 1, X: 1 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-46 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 256, C: 528, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-47 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 160, C: 528, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-48 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 320, C: 160, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-49 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 32, C: 528, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-50 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 32, R: 3, S: 3, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-51 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 528, R: 1, S: 1, Y: 14, X: 14 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-52 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 256, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-53 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 160, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-54 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 320, C: 160, R: 3, S: 3, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-55 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 32, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-56 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 32, R: 3, S: 3, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-57 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-58 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 384, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-59 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 192, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-60 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 384, C: 192, R: 3, S: 3, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-61 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 48, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-62 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 48, R: 3, S: 3, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Conv2d-63 {
Type: CONV
Stride { X: 1, Y: 1 }
Dimensions { K: 128, C: 832, R: 1, S: 1, Y: 7, X: 7 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
Layer Linear-64 {
Type: CONV
Dimensions { K: 1000, C: 1024, R: 1, S: 1, Y: 1, X: 1 }
Dataflow {
        SpatialMap(1,1) K;
        TemporalMap(64,64) C;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        Cluster(64, P);
        SpatialMap(1,1) C;
        TemporalMap(Sz(R),1) Y;
        TemporalMap(Sz(S),1) X;
        TemporalMap(Sz(R),Sz(R)) R;
        TemporalMap(Sz(S),Sz(S)) S;
}
}
}

author: maestro-project

repo: maestro


text:
function g = linearOutputGradX(model, X)

% LINEAROUTPUTGRADX Evaluate derivatives of linear model outputs with respect to inputs.
% FORMAT
% DESC returns the derivatives of the outputs of an LINEAR model with
% respect to the inputs to the model.
% ARG model : the model for which the derivatives will be computed.
% ARG X : the locations at which the derivatives will be computed.
% RETURN g : the gradient of the output with respect to the inputs, in
%
% SEEALSO : linearOutputGrad, modelOutputGradX
%
% COPYRIGHT : Neil D. Lawrence, 2006

% MLTOOLS

g = repmat(shiftdim(model.W, -1), [size(X, 1) 1 1]);

author: SheffieldML

repo: GPmat

save_path: github-repos/MATLAB/SheffieldML-GPmat


text:
function g = p20_g ( n, x )

%*****************************************************************************80
%
%% P20_G evaluates the gradient for problem 20.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    20 March 2000
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the number of variables.
%
%    Input, real X(N), the values of the variables.
%
%    Output, real G(N), the gradient of the objective function.
%
  g = zeros ( n, 1 );

  for i = 1 : n

    if ( i == 1 )
      g(i) = x(i);
    else
      g(i) = 2.0 * x(i);
    end

    if ( 1 < i )
      g(i) = g(i) - x(i-1);
    end

    if ( i < n )
      g(i) = g(i) - x(i+1);
    end

  end

  g(1) = g(1) - 2.0;

  return
end


text:
function [nodeBel, edgeBel, L] = mrfMf(A, nodePot, edgePot, epoch)
% Mean field for MRF
% Assuming egdePot is symmetric
% Input:
%   A: n x n adjacent matrix of undirected graph, where value is edge index
%   nodePot: k x n node potential
%   edgePot: k x k x m edge potential
% Output:
%   nodeBel: k x n node belief
%   edgeBel: k x k x m edge belief
% Written by Mo Chen (sth4nth@gmail.com)
if nargin < 4
    epoch = 10;
end
L = -inf(1,epoch+1);
[nodeBel,lnZ] = softmax(nodePot,1);    % initialization
for iter = 1:epoch
    for i = 1:size(nodePot,2)
        [~,j,e] = find(A(i,:));             % neighbors
        [nodeBel(:,i),lnZ(i)] = softmax(nodePot(:,i)+reshape(edgePot(:,:,e),2,[])*reshape(nodeBel(:,j),[],1));
    end
%     E = dot(nodeBel,nodePot,1);
%     H = -dot(nodeBel,log(nodeBel),1);
%     L(iter+1) = sum(lnZ+E+H)/2;
    L(iter+1) = mrfGibbs(A,nodePot,edgePot,nodeBel);
%     if abs(L(iter+1)-L(iter))/abs(L(iter)) < tol; break; end
end
L = L(1,2:iter+1);

[s,t,e] = find(triu(A));
edgeBel = zeros(size(edgePot));
for l = 1:numel(e)
    edgeBel(:,:,e(l)) = nodeBel(:,s(l))*nodeBel(:,t(l))';
end

author: PRML

repo: PRMLT

save_path: github-repos/MATLAB/PRML-PRMLT


text:
function pass = test_sign(pref)

if ( nargin == 0 )
    pref = chebfunpref();
end

% Initialise random vector:
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
hvsde = @(x) .5*(sign(x) + 1);

%% Simple tests
pref.splitting = 0;
f = chebfun('x.^2', pref);
tol = eps*get(f, 'hscale');
f1 = sign(f);
pass(1,1) = all(feval(f1, x) == 1);

% Test if pointValues are dealt with correctly:
f = chebfun(@(x) cos(pi*x) + 2, sort(x)', pref);
f.pointValues = -pi*ones(length(f.ends), 1);
f1 = sign(f);
pass(1,2) = all(f1.pointValues == -1);

% Test also on longer intervals:
f = chebfun(@(x) x, [-1, 100], pref);
f1 = sign(f);
h = chebfun({-1, 1}, [-1, 0, 100]);
pass(1,3) = normest(h - f1) < tol;

% Test functions with breakpoints:
f = chebfun(@(x) x, [-1, 1e-10, 1], pref);
f1 = sign(f);
h = restrict(h,[-1, 1]);
pass(1,4) = normest(f1 - h) < tol;

% Real, imaginary and complex CHEBFUN objects:
f = chebfun({-1, 1, -1, 1, -1, 1}, -3:3);

%% Real CHEBFUN
gHandle1 = @(x) sin(pi*x);
g = chebfun(@(x) gHandle1(x), -3:3, pref);
g1 = sign(g);
pass(2,1) = length(g1.funs) == 6;
pass(2,2) = normest(f - g1) < tol;
pref.splitting = 1;
h1 = chebfun(@(x) sign(gHandle1(x)), -3:3, pref);
pass(2,3) = length(h1.funs) == 6;
pass(2,4) = normest(f - h1) < 100*tol;

%% Array-valued CHEBFUN
f1 = chebfun(@(x) feval(f, [x, x]) , -3:3, pref);
gHandle2 = @(x) cos(pi*(x-.5));
g = chebfun(@(x) [gHandle1(x), gHandle2(x)] , -3:3, pref);
g4 = sign(g);
pass(3,1) = length(g4.funs) == 6;
pass(3,2) = normest(f1 - g4) < 1e1*tol;

h4 = chebfun(@(x) sign([gHandle1(x), gHandle2(x)]), -3:3, pref);
pass(3,3) = length(h4.funs) == 6;
pass(3,4) = normest(f1 - h4) < tol;

%% A more complicated function:
f = chebfun(@(x) sin(1i*x).*(1i*x + exp(5i*x)));
g = chebfun(@(x) sign(sin(1i*x).*(1i*x + exp(5i*x))),[-1 0 1], ...
    'extrapolate', 'on');
h = sign(f);
pass(4,:) = normest(g - h) < 1e4*eps*length(h);

%% Test sign() for a complex-valued CHEBFUN.
f = chebfun(@(x) exp(2*pi*1i*x)./(1 + (x - 0.1).^2), [-1 1]);
h = sign(f);
h_exact = @(x) exp(2*pi*1i*x);
pass(5,:) = norm(feval(h, x) - h_exact(x), inf) < 1e2*vscale(h)*eps;

%% Test on singular function: a real case

% Set a domain:
dom = [-2 7];

% Generate a few random points to use as test values:
x = diff(dom) * rand(100, 1) + dom(1);

pow = -0.5;
op = @(x) (dom(2)-x).^pow.*( sin(10*x).^2 );
f = chebfun(op, dom, 'exps', [0 pow], 'splitting', 'on');
s = sign(f);
pass(6,:) = ( norm(feval(s-1, x), inf) < eps );

%% Test on singular function: a complex case

% Set a domain:
dom = [-1 1];

% Generate a few random points to use as test values:
x = diff(dom) * rand(100, 1) + dom(1);

pow = -0.5;
op = @(x) (dom(2)-x).^pow.*exp(2*pi*1i*x);
f = chebfun(op, dom, 'exps', [0 pow], 'splitting', 'on');
s = sign(f);
s_exact = @(x) exp(2*pi*1i*x);
vals_s = feval(s, x);
vals_exact = feval(s_exact, x);
err = vals_s - vals_exact;
pass(7,:) = ( norm(err, inf) < 1e1*eps*get(s, 'vscale') );

%% Functions on [-inf inf]:

% Set the domain:
dom = [-Inf Inf];
domCheck = [-1e2 1e2];

% Generate a few random points to use as test values:
x = diff(domCheck) * rand(100, 1) + domCheck(1);

op = @(x) (1-exp(-x.^2))./x;
f = chebfun(op, dom);
s = sign(f);
sVals = feval(s, x);
op = @(x) 2*hvsde(x) - 1;
sExact = op(x);
err = sVals - sExact;
pass(8,:) = all( ~norm(err, inf) );

end

author: chebfun

repo: chebfun

save_path: github-repos/MATLAB/chebfun-chebfun


text:
function [On,Wr] = reorder_mod(W,M)
%REORDER_MOD         Reorder connectivity matrix by modular structure
%
%   On = reorder_mod(W,M);
%   [On Wr] = reorder_mod(W,M);
%
%   This function reorders the connectivity matrix by modular structure and
%   may consequently be useful in visualization of modular structure.
%
%   Inputs:
%       W,      connectivity matrix (binary/weighted undirected/directed)
%       M,      module affiliation vector
%
%   Outputs:
%       On,     new node order
%       Wr,     reordered connectivity matrix
%
%
%   Used in: Rubinov and Sporns (2011) NeuroImage; Zingg et al. (2014) Cell.
%
%
%   2011, Mika Rubinov, UNSW/U Cambridge

%   Modification History:
%   Mar 2011: Original
%	Jan 2015: Improved behavior for directed networks

%#ok<*ASGLU>
%#ok<*AGROW>

W = W+eps;
[u,dum,M] = unique(M);                                      %make consecutive;
n = numel(M);                                               %number of nodes
m = numel(u);                                               %number of modules

Nm=zeros(1,m);                                              %number of nodes in modules
Knm_o=zeros(n,m);                                           %node-to-module out-degree
Knm_i=zeros(n,m);                                           %node-to-module in-degree
for i=1:m
    Nm(i)=nnz(M==i);
    Knm_o(:,i)=sum(W(:,M==i),2);
    Knm_i(:,i)=sum(W(M==i,:),1);
end
Knm=(Knm_o+Knm_i)/2;

Wm=zeros(m);
for u=1:m
    for v=1:m
        Wm(u,v)=sum(sum(W(M==u,M==v)));
    end
end
Bm=(Wm+Wm.')./(2*(Nm.'*Nm));
% Km_o=sum(Wm,2);
% Km_i=sum(Wm,1);
% Bm_oi=Wm-Km_o*Km_i/sum(sum(Wm));
% Bm=(Bm_oi+Bm_oi.')/2;

%1. Arrange densely connected modules together
[I,J,bv]=find(tril(Bm,-1));                             	%symmetrized intermodular connectivity values
[~,ord]=sort(bv,'descend');                                 %sort by greatest relative connectivity
I=I(ord);
J=J(ord);
Om=[I(1) J(1)];                                             %new module order

Si=true(size(I));
Sj=true(size(J));
Si(I==I(1) | I==J(1))=0;
Sj(J==I(1) | J==J(1))=0;

while length(Om)<m                                          %while not all modules ordered
    for u=1:numel(I)
        if Si(u)     && any(J(u)==Om([1 end]))
            old=J(u);
            new=I(u);
            break
        elseif Sj(u) && any(I(u)==Om([1 end]))
            old=I(u);
            new=J(u);
            break
        end
    end
    if old==Om(1)
        Om=[new Om];
    elseif old==Om(end)
        Om=[Om new];
    end
    Si(I==new)=false;
    Sj(J==new)=false;
end

%2. Reorder nodes within modules
On = zeros(n,1,'uint64');                                   %node order array
for i=1:m
    u = Om(i);
    ind = find(M==u);                                       %indices

    mod_imp=[Om; sign((1:m)-i); abs((1:m)-i); Bm(u,Om)].';
    mod_imp=sortrows(mod_imp,[3 -4]);
    mod_imp=prod(mod_imp(2:end,[1 2]),2);

    [dum,ord]=sortrows(Knm(ind,:),mod_imp);                 %sort nodes by number of links to close modules
    On(ind(ord))=1e6*i+(1:Nm(u));                           %assign node order (assumes <1e6 nodes in a module)
end

[dum,On]=sort(On);                                          %reorder nodes
Wr=W(On,On);                                                %reorder matrix

author: canlab

repo: CanlabCore

save_path: github-repos/MATLAB/canlab-CanlabCore


text:
classdef NamingManager < handle

    properties (Access = private)
        costFuncNames
        costWeights
        constraintNames
        convVarsNames
    end

    methods (Access = public)

        function obj = NamingManager(cParams)
            obj.costFuncNames   = cParams.costFuncNames;
            obj.costWeights     = cParams.costWeights;
            obj.constraintNames = cParams.constraintFuncs;
            obj.convVarsNames   = ConvergenceVarsDispatcher.dispatchNames(cParams.optimizerNames);
        end

        function name = getCostFuncFigureTitle(obj,i)
            name = obj.costFuncNames{i};
            weight = obj.costWeights(i);

            if isempty(weight)
                weightDesc = '(wt. 1.0)';
            else
                weightDesc = sprintf('(wt. %.2f)',weight);
            end

            name = [obj.setCase(name) ' ' weightDesc];
        end

        function name = getConstraintFigureTitle(obj,i)
            name = obj.constraintNames{i};
            name = ['Cstr ' num2str(i) ': ' obj.setCase(name)];
        end

        function name = getLambdaFigureTitle(obj,i)
            name = obj.constraintNames{i};
            name = ['\lambda' obj.subindex(obj.setCase(name))];
        end

        function name = getConvVarFigureTitle(obj,i)
            name = obj.convVarsNames{i};
            name = ['Conv Criteria ' num2str(i) ': ' name];
        end

        function n = getNumberOfConvergenceVariables(obj)
            n = numel(obj.convVarsNames);
        end

        function name = getConvVarNames(obj,i)
            name = obj.convVarsNames{i};
        end

    end

    methods (Access = public, Static)

        function name = getFrameTitle(iStep,nStep,it)
            name = sprintf('Monitoring - Inc. Step: %.0f/%.0f Iteration: %.0f',iStep,nStep,it);
        end

    end

    methods (Access = private,Static)

        function str = setCase(str)
            str = [upper(str(1)) str(2:end)];
        end

        function str = subindex(str_)
            str = [];
            for i = 1:length(str_)
                str(end+1:end+2) = ['_' str_(i)];
            end
        end
    end

end

author: SwanLab

repo: Swan

save_path: github-repos/MATLAB/SwanLab-Swan


text:
function [iQ] = VBA_inv(Q,indIn,flag,v)
% overloaded sparse matrix pseudo-inverse
% function [iQ] = VBA_inv(Q,indIn,flag,v)
% IN:
%   - Q: the nxn matrix to be inverted
%   - indIn: a vector of indices that specifies the submatrix of Q that has
%   to be inverted. The rest of the matrix is padded with zeros. If empty,
%   the routine looks for infinite or below precision (close to zero)
%   entries in the the diagonal of Q.
%   - flag: if flag='replace', the routine returns Q, having replaced its
%   elements not in 'indIn' with v (see below)
%   - v: a number by which to padd the elements of Q not in 'indIn' (only
%   for flag='replace')
% OUT:
%   - iQ: the nxn matrix that is either the inverse of Q or v-padded Q (for
%   flag='replace').

if nargin < 2 || isempty(indIn)
    dq = diag(Q);
    indIn = find(~isinf(dq)&dq~=0);
end
% use lazy evaluation if all matrix is used
isSub = ~all(numel(indIn) == size(Q));

if nargin < 3
    replace = 0;
else
    replace = isequal(flag,'replace');
end
if nargin < 4
    v = 0;
end
if isSub
    subQ = full(Q(indIn,indIn));
else
    subQ = full(Q);
end
if replace % v-padd
    iQ = v.*ones(size(Q));
    iQ(indIn,indIn) = subQ;
else % (p)invert Q
    if isequal(subQ,eye(length(indIn)))   % identity matrix
        subiQ = subQ;
    elseif isequal(subQ,diag(diag(subQ))) % diagonal matrix
        tol  = max(eps(norm(diag(subQ),'inf'))*length(indIn),exp(-32));
        subiQ = diag((diag(subQ)+tol).^-1);
    else % full matrix
        tol  = max(eps(norm(subQ,'inf'))*length(indIn),exp(-32));
        subiQ = inv(subQ + eye(length(indIn))*tol);
    end
    if isSub
        iQ = zeros(size(Q));
        iQ(indIn,indIn) = subiQ;
    else
        iQ = subiQ;
    end
end

author: MBB-team

repo: VBA-toolbox


text:
function fixed = p02_fixed_points ( m, fixed_num )

%*****************************************************************************80
%
%% P02_FIXED_POINTS returns the fixed points in problem 02.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    12 April 2009
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Per-Olof Persson and Gilbert Strang,
%    A Simple Mesh Generator in MATLAB,
%    SIAM Review,
%    Volume 46, Number 2, June 2004, pages 329-345.
%
%  Parameters:
%
%    Input, integer M, the spatial dimension.
%
%    Input, integer FIXED_NUM, the number of fixed points.
%
%    Output, real FIXED(M,FIXED_NUM), the fixed points.
%
  fixed = [];

  return
end

author: johannesgerer


% 0.02

totalNum = 1867290;

loopCompress(0.1, '/home/huyin/weightVector.txt', '/home/huyin/visMatrix/', 50, totalNum, 333, '/home/huyin/gurobi_compress_0.02/');

ratio = salientNumCnt( '/home/huyin/gurobi_compress_0.02/', totalNum ) / totalNum