-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplitting.m
More file actions
67 lines (56 loc) · 2.19 KB
/
splitting.m
File metadata and controls
67 lines (56 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function varargout = splitting(on_off)
%SPLITTING CHEBFUN splitting option.
% SPLITTING('ON') allows the CHEBFUN constructor to split the interval by a
% process of automatic subdivision and edge detection. This option is
% recommended when working with functions with singularities or jumps.
%
% SPLITTING('OFF') disables this kind of automatic splitting, and is
% recommended for working with functions that are complicated but still
% smooth. Even with splitting off, breakpoints may still be introduced by the
% MAX, MIN, ABS, CEIL, FLOOR, and ROUND commands. One may switch freely back
% and forth between the two modes during a Chebfun computation.
%
% SPLITSTATE = SPLITTING(...) will return the current state splitting option
% (as a string), before any changes are applied.
%
% SPLITTING by itself, displays a string detailing the current splitting
% state. By default, this is OFF.
%
% See also CHEBFUNPREF.
% Copyright 2014 by The University of Oxford and The Chebfun Developers.
% See http://www.chebfun.org/ for Chebfun information.
if ( nargout > 0 && nargin == 0 )
% Return current splitting state:
splitState = chebfunpref().splitting;
elseif ( nargin == 0 )
% Display splitting state:
switch ( chebfunpref().splitting )
case 1
disp('SPLITTING is currently ON.')
case 0
disp('SPLITTING is currently OFF.')
end
else
% Throw a warning:
warning('CHEBFUN:splitting:deprecated', ...
['The syntax ''splitting on'' is deprecated.\n', ...
'Please see CHEBFUNPREF documentation for further details.']);
% But only throw it once:
warning('off', 'CHEBFUN:splitting:deprecated');
if ( nargout > 0 )
splitState = chebfunpref().splitting;
end
if ( strcmpi(on_off, 'on') )
chebfunpref.setDefaults('splitting', true);
elseif strcmpi(on_off, 'off')
chebfunpref.setDefaults('splitting', false);
else
error('CHEBFUN:splitting:UnknownOption',...
'Unknown splitting option: only ON and OFF are valid options.')
end
end
if ( nargout > 0 )
onOffStr = {'off', 'on'};
varargout{1} = onOffStr{splitState+1};
end
end