Skip to content

Commit

Permalink
clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
heatherw3521 committed Jul 17, 2019
1 parent 8fa626d commit 2f1de98
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 40 deletions.
6 changes: 6 additions & 0 deletions @chebfun2v/coeffs2.m
Expand Up @@ -11,6 +11,12 @@
% Copyright 2019 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.


if isempty(f)
varargout = {};
return
end

F1 = f.components{1};
F2 = f.components{2};
if isempty(varargin)
Expand Down
2 changes: 1 addition & 1 deletion @chebfun2v/coeffs2vals.m
Expand Up @@ -2,7 +2,7 @@
% COEFFS2VALS componentwise conversion of matrix of bivariate Chebyshev
% coefficients to values.
%
% X,Y = COEFFS2VALS( U, V ) converts matrices U and V of bivariate
% X,Y = COEFFS2VALS(U, V) converts matrices U and V of bivariate
% Chebyshev coefficients to matrices of samples X and Y corresponding
% to values sampled on a 2D tensor Chebyshev grid.
%
Expand Down
10 changes: 3 additions & 7 deletions @chebfun2v/vals2coeffs.m
@@ -1,4 +1,4 @@
function [X, Y] = vals2coeffs(U,V)
function [U, V] = vals2coeffs(X,Y)
% VALS2COEFFS componentwise conversion of matrices of values to
% matrices of bivariate Chebyshev coefficients.
%
Expand All @@ -12,12 +12,8 @@
% Copyright 2019 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

%%
% Empty check:


X = chebfun2.vals2coeffs(U);
Y = chebfun2.vals2coeffs(V);
U = chebfun2.vals2coeffs(X);
V = chebfun2.vals2coeffs(Y);
end


Expand Down
8 changes: 8 additions & 0 deletions @diskfun/coeffs2.m
Expand Up @@ -15,6 +15,14 @@
% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.



%empty check
if isempty(f)
varargout = {};
return
end

% Calculate the CDR decomposition:
[C, D, R] = cdr( f );

Expand Down
2 changes: 1 addition & 1 deletion @diskfun/coeffs2diskfun.m
Expand Up @@ -2,7 +2,7 @@
%COEFFS2DISKFUN Convert a matrix of Chebyshev-Fourier coefficients to a
% diskfun.
%
% F = coeffs2diskfun(X) returns a diskfun object F that has a
% F = coeffs2diskfun( X ) returns a diskfun object F that has a
% Chebyshev-Fourier matrix of coefficients X. This is useful for
% computing quantities on the disk with the function F.
%
Expand Down
1 change: 0 additions & 1 deletion @diskfun/coeffs2vals.m
Expand Up @@ -11,7 +11,6 @@
% low rank form. Here, C*D*R.' is a 2D coeff matrix.
%

%
% See also VALS2COEFFS.

% Copyright 2019 by The University of Oxford and The Chebfun Developers.
Expand Down
6 changes: 3 additions & 3 deletions @diskfun/vals2coeffs.m
@@ -1,7 +1,7 @@
function varargout = vals2coeffs( U, varargin)
function varargout = vals2coeffs( U, varargin )
%VALS2COEFFS Convert matrix of values to Chebyshev-Fourier coefficients.
%
% V = VALS2COEFFS( C ) converts a matrix C of values representing
% V = VALS2COEFFS( U ) converts a matrix U of values representing
% samples of a function from a tensor Chebyshev-Fourier grid
% to a matrix V of Chebyshev-Fourier coefficients for the corresponding
% interpolant.
Expand All @@ -24,7 +24,7 @@
V = varargin{2};
U = chebtech2.vals2coeffs( U );
V = trigtech.vals2coeffs( V );
varargout = {U S V};
varargout = { U S V };
else
error('CHEBFUN:DISKFUN:vals2coeffs:inputs', ...
'The number of input arguments should be one or two.');
Expand Down
7 changes: 7 additions & 0 deletions @diskfunv/coeffs2.m
Expand Up @@ -13,6 +13,13 @@
% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.


%empty check
if isempty(f)
varargout = {};
return
end

F1 = f.components{1};
F2 = f.components{2};
if isempty(varargin)
Expand Down
4 changes: 2 additions & 2 deletions @diskfunv/coeffs2diskfunv.m
@@ -1,8 +1,8 @@
function F = coeffs2diskfunv(X, Y)
function F = coeffs2diskfunv( X, Y )
%COEFFS2DISKFUNV Convert componentwise matrices of Chebyshev-Fourier
% coefficients to a diskfunv.
%
% F = coeffs2diskfunv(X, Y) returns a diskfunv object F that has a
% F = coeffs2diskfunv( X, Y ) returns a diskfunv object F that has a
% Chebyshev-Fourier matrices of coefficients X, Y, for each component.
% This is useful for computing quantities on the disk with the function F.
%
Expand Down
9 changes: 3 additions & 6 deletions @diskfunv/vals2coeffs.m
@@ -1,21 +1,18 @@
function [X, Y] = vals2coeffs(U,V)
function [ X, Y ] = vals2coeffs( U,V )
% VALS2COEFFS componentwise conversion of matrices of values to
% matrices of Chebyshev-Fourier coefficients.
%
% U, V = VALS2COEFFS(X, Y) converts matrices X, Y of values representing
% U, V = VALS2COEFFS( X, Y ) converts matrices X, Y of values representing
% samples of a function from a tensor Chebyshev-Fourier grid
% to matrices U, V of Chebyshev-Fourier coefficients for the corresponding
% interpolants.
%
%
% See also COEFFS2VALS

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

%%
% Empty check:


X = diskfun.vals2coeffs(U);
Y = diskfun.vals2coeffs(V);
Expand Down
11 changes: 8 additions & 3 deletions @spherefun/coeffs2.m
@@ -1,10 +1,10 @@
function varargout = coeffs2(f, m, n)
function varargout = coeffs2( f, m, n )
%COEFFS2 Double Fourier coefficients of a SPHEREFUN.
%
% X = COEFFS2(F) returns the 2D Fourier modes of the spherefun, viewed
% X = COEFFS2( F ) returns the 2D Fourier modes of the spherefun, viewed
% as a doubly periodic function.
%
% [C, D, R] = COEFFS2(F) returns a low rank approximation to the 2D
% [C, D, R] = COEFFS2( F ) returns a low rank approximation to the 2D
% Fourier modes.
%
% X = COEFFS2(F, M, N) returns bivariate coefficients with N Fourier
Expand All @@ -13,6 +13,11 @@
% Copyright 2017 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.

% empty check
if isempty(f)
varargout = {};
return
end

% Calculate the CDR decomposition:
[C, D, R] = cdr(f);
Expand Down
2 changes: 1 addition & 1 deletion @spherefun/coeffs2spherefun.m
@@ -1,4 +1,4 @@
function F = coeffs2spherefun(X)
function F = coeffs2spherefun( X )
%COEFFS2SPHEREFUN Make a SPHEREFUN object from a matrix of Fourier
% coefficients.
%
Expand Down
11 changes: 6 additions & 5 deletions @spherefun/vals2coeffs.m
@@ -1,13 +1,14 @@
function varargout = vals2coeffs( U, varargin)
function varargout = vals2coeffs( U, varargin )
%VALS2COEFFS Convert matrix of values to Fourier-Fourier coefficients.
%
% V = VALS2COEFFS( C ) converts a matrix C of values representing
% V = VALS2COEFFS( U ) converts a matrix U of values representing
% samples of a function from a tensor double Fourier sphere grid
% and converts them to a matrix V of Fourier-Fourier coefficients
% for the corresponding interpolant.
% to a matrix V of 2D Fourier coefficients for the corresponding
% interpolant.
%
% [U, S, V] = VALS2COEFFS( U, S, V ) the same as above but keeps
% everything in low rank form.
% everything in low rank form. Here, U*S*V.' is a sample of
% values on the double Fourier sphere grid.
%
% See also COEFFS2VALS

Expand Down
14 changes: 11 additions & 3 deletions @spherefunv/coeffs2.m
@@ -1,11 +1,11 @@
function varargout = coeffs2( f, varargin)
function varargout = coeffs2( f, varargin )
%COEFFS2 componentwise double Fourier coefficients of a SPHEREFUNV.
%
% [X, Y, Z] = COEFFS2( F ) returns the 2D Fourier modes for each component
% of the SPHEREFUNV F, where each component is a doubly-periodic
% function.
% function on the double Fourier sphere.
%
% [X, Y] = COEFFS2(F, M, N) returns bivariate coefficients with N Fourier
% [X, Y] = COEFFS2( F, M, N ) returns bivariate coefficients with N Fourier
% modes in the latitude direction and M Fourier modes in the
% longitude direction.
%
Expand All @@ -14,6 +14,14 @@
% Copyright 2019 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.



%empty check
if isempty(f)
varargout = {};
return
end

F1 = f.components{1};
F2 = f.components{2};
F3 = f.components{3};
Expand Down
4 changes: 2 additions & 2 deletions @spherefunv/coeffs2spherefunv.m
@@ -1,8 +1,8 @@
function F = coeffs2spherefunv(X, Y, Z)
function F = coeffs2spherefunv( X, Y, Z )
%COEFFS2SPHEREFUNV Convert componentwise matrices of 2D Fourier
% coefficients to a spherefunv.
%
% F = coeffs2spherefunv(X, Y, Z) returns a spherefunv object F that has
% F = coeffs2spherefunv( X, Y, Z ) returns a spherefunv object F that has
% matrices of 2D Fourier coefficients X, Y, and Z for each component.
%
% See also SPHEREFUN/COEFFS2SPHEREFUN
Expand Down
2 changes: 1 addition & 1 deletion @spherefunv/coeffs2vals.m
@@ -1,4 +1,4 @@
function [X,Y,Z] = coeffs2vals(U,V,W)
function [ X,Y,Z ] = coeffs2vals( U,V,W )
% COEFFS2VALS componentwise conversion of 2D Fourier coefficient matrices
% to values.
%
Expand Down
8 changes: 4 additions & 4 deletions @spherefunv/vals2coeffs.m
@@ -1,10 +1,10 @@
function [U, V, W] = vals2coeffs(X,Y,Z)
function [ U, V, W ] = vals2coeffs( X,Y,Z )
% VALS2COEFFS componentwise conversion of matrices of values to
% matrices of 2D Fourier coefficients.
%
% U, V, W = VALS2COEFFS(X,Y, Z) converts matrices X, Y and Z of values sampled
% from doubly periodic functions on equally-spaced tensor grids of the
% latitude-longitude domain [-pi, pi) x [-pi, pi) to matrices U, V and W,
% U, V, W = VALS2COEFFS( X,Y, Z ) converts matrices X, Y and Z of values
% sampled from doubly periodic functions on equally-spaced tensor grids of
% the domain [-pi, pi) x [-pi, pi) to matrices U, V and W,
% containing 2D Fourier coefficients for the corresponding interpolants.
%
%
Expand Down

0 comments on commit 2f1de98

Please sign in to comment.