plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | foucart/Basc-master | test_changeMap.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/unbndfun/test_changeMap.m | 1,779 | utf_8 | eb1c9c370b0337388323d7257519340c | % Test file for unbndfun/changeMap.m.
function pass = test_changeMap(pref)
% Get preferences:
if ( nargin < 1 )
pref = chebfunpref();
end
singPref = pref;
singPref.blowup = true;
% Seed for random number:
seedRNG(6178);
%% Functions on [a inf]:
% Set the domain:
dom = [1 Inf];
domCheck = [1 1e2];
% Generate ... |
github | foucart/Basc-master | test_cumsum.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/unbndfun/test_cumsum.m | 2,731 | utf_8 | 48bdff0fd2f466982d2b3fc7679a8c46 | % Test file for unbndfun/cumsum.m.
function pass = test_cumsum(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
singPref = pref;
singPref.blowup = true;
% Seed for random number:
seedRNG(6178);
%% Functions on [-inf inf]:
% Set the domain:
dom = [-Inf Inf];
domCheck = [-1e2 1e2];
% Generate a few random poi... |
github | foucart/Basc-master | test_mldivide.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/unbndfun/test_mldivide.m | 711 | utf_8 | dea913d91e2154a0ccac5e61792bce38 | % Test file for unbndfun/mldivide.m
function pass = test_mldivide(pref)
% Get preferences.
if (nargin < 1)
pref = chebfunpref();
end
% Set the domain:
dom = [-Inf 3*pi];
domCheck = [-1e6 3*pi];
% Generate a few random points to use as test values:
x = diff(domCheck) * rand(100, 1) + domCheck(1);
% A*X = B, whe... |
github | foucart/Basc-master | test_sum.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/unbndfun/test_sum.m | 3,376 | utf_8 | 2eba1d69f603b90723070d9a982032cc | % Test file for unbndfun/sum.
function pass = test_sum(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
singPref = pref;
singPref.blowup = true;
% Seed for random number:
seedRNG(6178);
%% Functions on [-inf inf]:
% Set the domain:
dom = [-Inf Inf];
op = @(x) exp(-x.^2);
f = unbndfun(op, struct('domain', do... |
github | foucart/Basc-master | test_compose.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/unbndfun/test_compose.m | 1,355 | utf_8 | 06387c327139cfb6624efcd80b0ec592 | % Test file for unbndfun/compose.m
function pass = test_compose(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Set the domain:
dom = [0 Inf];
domCheck = [0 1e2];
% Generate a few random points to use as test values:
x = diff(domCheck) * rand(100, 1) + domCheck(1);
%%%%%%%%%%%%%%%% Compose an UNBNDFUN with... |
github | foucart/Basc-master | test_restrict.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/unbndfun/test_restrict.m | 5,313 | utf_8 | 4395c727e179bff1c18f0ec909989dcf | % Test file for unbndfun/restrict.m.
function pass = test_restrict(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
singPref = pref;
singPref.blowup = true;
% Seed for random number:
seedRNG(6178);
%% Functions on [-inf inf]:
% Set the domain:
dom = [-Inf Inf];
dom1 = [-1e2 -2];
dom2 = [-2 7];
dom3 = [7 1e2]... |
github | foucart/Basc-master | test_alias.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebtech2/test_alias.m | 1,662 | utf_8 | f5e0170442ac0222ded3a083a67b9000 | % Test file for chebtech2/alias.m
function pass = test_alias(varargin)
% Set a tolerance (pref.eps doesn't matter)
tol = 100*eps;
%%
% Testing a vector of coefficients.
c0 = (1:10)';
% Padding:
c1 = chebtech2.alias(c0, 11);
pass(1) = norm([0 ; c0] - c1, inf) == 0;
% Aliasing:
c2 = chebtech2.alias(c0, 9);
pass(2) =... |
github | foucart/Basc-master | test_extrapolate.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebtech2/test_extrapolate.m | 1,375 | utf_8 | 7157199e57a38d539969c7960d498dea | % Test file for chebtech2/extrapolate.m
function pass = test_extrapolate(pref)
% Obtain preferences
if ( nargin < 1 )
pref = chebtech.techPref();
end
% Set a tolerance:
tol = 100*pref.eps;
% Initialise:
s = 0;
n = 17;
x = chebtech2.chebpts(n);
f = chebtech2;
for k = 1:2
% Test once for a vector of coe... |
github | foucart/Basc-master | test_constructor.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebtech2/test_constructor.m | 3,618 | utf_8 | 2a8df01e7d32b430f84a5dc31bc3bf5f | % Test file for chebtech2 constructor.
function pass = test_constructor(pref)
% Get preferences:
if ( nargin < 1 )
pref = chebtech.techPref();
end
% Set the tolerance:
tol = 100*pref.eps;
%%
% Test on a scalar-valued function:
pref.extrapolate = 0;
pref.refinementFunction = 'nested';
f = @(x) sin(x);
g = populat... |
github | foucart/Basc-master | test_chebpts.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebtech2/test_chebpts.m | 1,276 | utf_8 | 126e14edf4b1eadbb5205b7f6f202dd4 | % Test file for chebtech2/chebpts.m
function pass = test_chebpts(varargin)
% Set a tolerance (pref.eps doesn't matter)
tol = 10*eps;
% Test that n = 0 returns empty results:
[x, w, v] = chebtech2.chebpts(0);
pass(1) = ( isempty(x) && isempty(w) && isempty(v) );
% Test n = 1:
[x, w, v] = chebtech2.chebpts(1);
pass(2... |
github | foucart/Basc-master | test_vals2coeffs.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebtech2/test_vals2coeffs.m | 950 | utf_8 | a255e61cdfb57c071691ef07fef09210 | % Test file for chebtech2/vals2coeffs.m
function pass = test_vals2coeffs(varargin)
% Set a tolerance (pref.eps doesn't matter)
tol = 100*eps;
%%
% Test that a single value is converted correctly
v = sqrt(2);
c = chebtech2.vals2coeffs(v);
pass(1) = (v == c);
%%
% Some simple data
v = (1:5).';
% Exact coefficients
c... |
github | foucart/Basc-master | test_coeffs2vals.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebtech2/test_coeffs2vals.m | 947 | utf_8 | c8daf804e9adc4d06255b8262a312fc0 | % Test file for chebtech2/coeffs2vals.m
function pass = test_coeffs2vals(varargin)
% Set a tolerance (pref.eps doesn't matter)
tol = 100*eps;
%%
% Test that a single coefficient is converted correctly
c = sqrt(2);
v = chebtech2.coeffs2vals(c);
pass(1) = (c == v);
%%
% Some simple data
c = (1:5).';
% Exact values
v... |
github | foucart/Basc-master | test_plotcoeffs.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebmatrix/test_plotcoeffs.m | 947 | utf_8 | e0aef956e2826d5e5fabd71374ff28df | function pass = test_plotcoeffs(pref)
% This test just ensures that CHEBMATRIX/PLOTCOEFFS() does not crash.
% Create an invisible figure to plot on:
hfig = figure('Visible', 'off');
%% Setup
d = [-2 2]; % function domain
x = chebfun(@(x) x, d);
%% Create a couple of CHEBMATRICES and try ... |
github | foucart/Basc-master | test_waterfall.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebmatrix/test_waterfall.m | 651 | utf_8 | 0c863231f5e952491239b32ea54b6434 | % Test file for @chebmatrix/waterfall.m.
function pass = test_waterfall(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
hfig = figure('Visible', 'off');
Q = chebmatrix({chebfun(@(x) sin(pi*x), pref), ...
chebfun(@(x) sin(pi*(x - 0.3)), pref), ...
chebfun(@(x) sin(pi*(x - 0.6)),... |
github | foucart/Basc-master | test_plot.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebmatrix/test_plot.m | 1,531 | utf_8 | 3cf124db0097e0ca2b7f66ee8eb1e454 | function pass = test_plot(pref)
% This test just ensures that chebmatrix plot() does not crash.
% HM, 30 Apr 2014
hfig = figure('Visible', 'off');
%%
% A has entries of all types: OPERATORBLOCK, FUNCTIONBLOCK, CHEBFUN and DOUBLE.
d = [-2 2]; % function domain
I = operatorBlock.eye(d); % ident... |
github | foucart/Basc-master | test_assignColumns.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_assignColumns.m | 3,842 | utf_8 | 23fca4cd9e64ded047488960fce31764 | % Test file for @chebfun/assignColumns.m.
function pass = test_assignColumns(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
funlist = {@chebfun, @quasimatrix};
for k = 1:2
myfun = funlist{k};
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(10, 1) - 1;
... |
github | foucart/Basc-master | test_polyval.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_polyval.m | 948 | utf_8 | 5d7b8060ec11b34da2df7b6ea05e5712 | % Test file for @chebfun/polyval.m.
function pass = test_polyval(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
seedRNG(666)
%% Test scalar problem:
c = rand(3,1);
x = chebfun('x', [0 pi], pref);
f = polyval(c, x);
err = norm(c(1)*x.^2 + c(2)*x + c(3) - f, inf);
tol = vscale(f).*epslevel(f);
pass(1) = err ... |
github | foucart/Basc-master | test_lt.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_lt.m | 2,747 | utf_8 | 65eab846729e5c5507666e7d787705d8 | % Test file for @chebfun/lt.m.
function pass = test_lt(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
hvsde = @(x) .5*(sign(x) + 1);
% Check the empty case.
f = chebfun(@(x) sin(x), [-1 -0.5 0 0.5 1], pref);
g = ch... |
github | foucart/Basc-master | test_minandmax.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_minandmax.m | 4,771 | utf_8 | ef2737b5dffd1f2bb24925ec8ea12d5a | % Test file for @chebfun/minandmax.m.
function pass = test_minandmax(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Check empty case.
[y, x] = minandmax(chebfun());
pass(1) = isempty(y) && isempty(x);
% Check operation without breakpoints.
f = chebfun(@(x) ((x - 0.2).^3 - (x - 0.2) + 1).*sec(x - 0.2), pre... |
github | foucart/Basc-master | test_and.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_and.m | 2,377 | utf_8 | 8d17936f72acb9c36cedad7f261eb100 | % Test file for @chebfun/and.m.
function pass = test_and(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check the empty case.
f = chebfun(@sin);
pass(1) = isempty(f & chebfun()) && isempty(chebfun() & f);
% Chec... |
github | foucart/Basc-master | test_minus.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_minus.m | 3,114 | utf_8 | aa7507879ddec03ecb1f75d418eec9ca | % Test file for @chebfun/minus.m.
function pass = test_minus(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% A random number to use as an arbitrary additive constant.
alpha = -0.194758928283640 ... |
github | foucart/Basc-master | test_find.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_find.m | 1,245 | utf_8 | 8f565e458ce5965584890bc53a6edecf | % Test file for @chebfun/find.m.
function pass = test_find(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Check the empty case:
pass(1) = isempty(find(chebfun()));
% Check a few simple examples:
f = chebfun(@sin, [0 2*pi], pref);
x = find(f == 1/2) / pi;
pass(2) = norm(x - [1/6 ; 5/6], inf) < 10*vscale(f)*... |
github | foucart/Basc-master | test_arclength.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_arclength.m | 1,743 | utf_8 | 77098ffe417c042ca408d9f1a106c202 | % Test file for @chebfun/arclength.m.
function pass = test_arclength(pref)
% Obtain preferences.
if ( nargin == 0 )
pref = chebfunpref();
end
% A simple example:
f = chebfun(@(x)sin(50*x));
l = arcLength(f);
% The exact result is obtained using method 'integral' of Matlab:
lExact = 63.549358387599270;
err = ab... |
github | foucart/Basc-master | test_join.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_join.m | 2,955 | utf_8 | 362134073ad5a106588803bc566d0798 | % Test file for @chebfun/join.m.
function pass = test_join(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Check scalar CHEBFUNs.
f_op = @sin;
f1 = chebfun(f_op, [-1 -0.5 0]);
f2 = chebfun(f_op, [0 0... |
github | foucart/Basc-master | test_feval.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_feval.m | 7,825 | utf_8 | 17031f5b532e2914c9c2a13a19cfc46d | % Test file for @chebfun/feval.m
function pass = test_feval(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Test empty input.
f = chebfun(@(x) x, pref);
fx = feval(f, zeros(0, 4));
p... |
github | foucart/Basc-master | test_deltaOps.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_deltaOps.m | 1,389 | utf_8 | 3253b5ae80fe50815f22e24d10c96ee0 | % Test some operations involving chebfuns with delta functions.
function pass = test_deltaOps(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
tol = pref.deltaPrefs.deltaTol;
% These tests used to live in the scripts in tests/deltafun, but since they
% create chebfuns, they are better placed here.
% Some test... |
github | foucart/Basc-master | test_comet.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_comet.m | 984 | utf_8 | 89b8cf1cb62c33dc72032b6e294aa000 | % Test for @chebfun/comet.m and @chebfun/comet3.m.
function pass = test_comet(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Real scalar functions.
fsr1 = chebfun(@sin, [-1 0 1], pref);
fsr2 = chebfun(@cos, [-1 0.5 1], pref);
fsr3 = chebfun(@exp, [-1 -0.5 1], pref);
% Real array-valued functions.
far1 = ch... |
github | foucart/Basc-master | test_get.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_get.m | 4,958 | utf_8 | af0f72ee84f03a0bac9831fa07f4ae21 | % Test for @chebfun/get.m.
function pass = test_get(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
fs1 = chebfun(@(x) sin(x), [-1 1]);
fs2 = chebfun(@(x) cos(x), [-1 0 1]);
fa1 = chebfun(@(x) [sin(x) cos(x)], [-1 1]);
fa2 = chebfun(@(x) [sin(x) cos(x)], [-1 0 1]);
fq1 = cheb2quasi(fa1);
fq2 = cheb2quasi(fa2... |
github | foucart/Basc-master | test_power.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_power.m | 10,059 | utf_8 | 99c09c2f47b9e812079c7de67597e4f8 | function pass = test_power(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% [TODO]: So far, POWER only supports easy cases (i.e., positive integers).
% Tests will have to expanded once this functionality is available.
%% Scalar-valued
f = chebfun(@(x) sin(x));
g = f.^0;
pass(1) = normest(g - 1) < 10*epslev... |
github | foucart/Basc-master | test_max.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_max.m | 6,110 | utf_8 | d6dacff26a1227ff55fa72fa23e47ce0 | % Test file for @chebfun/max.m.
function pass = test_max(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
xr = 2 * rand(100, 1) - 1;
% Check empty case.
[y, x] = max(chebfun());
pass(1) = isempty(y) && isempty(x);
% Check operation without ... |
github | foucart/Basc-master | test_besselj.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_besselj.m | 1,793 | utf_8 | 1df12530eaf540aba0ca1e0db9f37803 | function pass = test_besselj(pref)
% Grab some preferences
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
xr = 2 * rand(100, 1) - 1;
% Arbitrary value to use for nu in the tests.
% [TODO]: Use non-integer nu once fractional powers are implemente... |
github | foucart/Basc-master | test_cf.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_cf.m | 1,442 | utf_8 | b56935205d9ee65c8e5fb1f777278030 | % Test function for @chebfun/cf.m.
% Based on the Chebfun v4 test written by LNT & Joris Van Deun, Dec. 4, 2009.
function pass = test_cf(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
f = chebfun(@exp, pref);
[p, q, r, lam] = cf(f, 2);
pass(1) = abs(lam - 0.045017) < 1e-4;
f = chebfun(@(x) exp(... |
github | foucart/Basc-master | test_subsref.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_subsref.m | 2,571 | utf_8 | 24459aafdf738e85bf092ace3a57072b | % Test file for @chebfun/subsref.m.
function pass = test_subsref(pref)
% [TODO]: test calls of the form f(:,1) and f(1,:), etc.
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Test () syn... |
github | foucart/Basc-master | test_constructor_singfun.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_constructor_singfun.m | 8,176 | utf_8 | fb6a628f7fb3594a0f5e501d2a3fbdec | % Test file for chebfun constructor for singular function.
function pass = test_constructor_singfun(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
%% Specify the singularity by passing the exact exponents to preferences:
% No singularity detection involved:
% define the domain:
dom = [-2 7];
% Generate a ... |
github | foucart/Basc-master | test_compose_chebfuns.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_compose_chebfuns.m | 3,978 | utf_8 | e278e19be10cf5be881a2c3b4cc9cab7 | % Test file for @chebfun/compose.m (composition of chebfuns).
function pass = test_compose_chebfuns(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Create preference structure with splitting enabled.
pref_split = pref;
pref_split.splitting = 1;
% [TODO]: Once composeChebfuns() can handle... |
github | foucart/Basc-master | test_realsqrt.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_realsqrt.m | 908 | utf_8 | 33acc085ec0780ad64ffb146e92a9822 | % Test file for @chebfun/realsqrt.m.
function pass = test_realsqrt(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
%% These should fail:
x = chebfun('x', pref);
try
realsqrt(x);
pass(1) = false;
catch ME
pass(1) = strcmp(ME.identifier, 'CHEBFUN:CHEBFUN:realsqrt:complexRes');
end
try
realsqrt... |
github | foucart/Basc-master | test_cov.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_cov.m | 1,959 | utf_8 | 811efd9af3bd3331846d4ecbac69b5c5 | % Test file for @chebfun/cov.m.
function pass = test_cov(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Check empty case.
pass(1) = isnan(cov(chebfun()));
% Check cov() for a single chebfun argument.
f = chebfun({@(x) exp(4*pi*1i*x), @exp, @exp}, [-1 0 0.5 1], pref);
pass(2) = isequal(cov(f), var(f));
ft... |
github | foucart/Basc-master | test_isinf.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_isinf.m | 1,046 | utf_8 | ae235f29cf315c7bc782a5405f0c6fc4 | % Test file for @chebfun/isinf.m.
function pass = test_isinf(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Test finite scalar function.
f = chebfun(@(x) sin(x));
pass(1) = ~isinf(f);
% Test finite array-valued function.
f = chebfun(@(x) [sin(x) cos(x)]);
pass(2) = ~isinf(f);
% Test on ... |
github | foucart/Basc-master | test_ellipj.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_ellipj.m | 2,837 | utf_8 | 82c6fcb2f418ce67c121f6a884bb602d | % Test file for @chebfun/ellipj.m.
function pass = test_ellipj(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
xr = 2 * rand(100, 1) - 1;
% Real chebfun u, double m.
pass(1) = do_test_ellipj(@(x) exp(x), 0.6, xr, pref);
pass(2) = do_test_el... |
github | foucart/Basc-master | test_unwrap.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_unwrap.m | 981 | utf_8 | d8c61e5ee02489aec3e7c4c0e8ad72cd | % Test file for @chebfun/unwrap.m.
function pass = test_unwrap(pref)
if (nargin < 1)
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Test empty case.
pass(1) = isempty(unwrap(chebfun()));
% Check that chebfuns with only one fun aren't u... |
github | foucart/Basc-master | test_fix.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_fix.m | 1,870 | utf_8 | bd052196e8713af96fcca745073fdc40 | % Test file for @chebfun/fix.m
function pass = test_fix(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check empty case.
pass(1) = isempty(fix(chebfun()));
% Check "ordinary" cases.
f = chebfun(@(x) 2*sin(x), [-... |
github | foucart/Basc-master | test_log.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_log.m | 764 | utf_8 | 1288e191716922bedc54096f50448b44 | % Test file for chebfun log() and related functions.
function pass = test_log(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% List of functions to test.
logFunct... |
github | foucart/Basc-master | test_innerProduct.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_innerProduct.m | 2,087 | utf_8 | 58cf11713b46f48d845735d3948521ef | % Test file for chebfun/innerProduct.m
function pass = test_innerProduct(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Set a domain
dom = [-2 7];
%% Test for singular function: piecewise smooth chebfun - splitting on.
pow1 = -0.3;
pow2 = -0.5;
op1 = @(x) (x - dom(2)).^pow1.*sin(100*x);... |
github | foucart/Basc-master | test_norm.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_norm.m | 6,490 | utf_8 | a98499a3754b86e8bb2053fe3ab44952 | % Test file for @chebfun/norm.m.
function pass = test_norm(pref)
% Obtain preferences.
if ( nargin == 0 )
pref = chebfunpref();
end
% Check empty case.
pass(1) = norm(chebfun()) == 0;
% Check norms for scalar-valued chebfuns.
f = chebfun({@(x) exp(4*pi*1i*x), @exp, @exp}, [-1 0 0.5 1], pref);
normf_2 = sqrt(1 +... |
github | foucart/Basc-master | test_plotcoeffs.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_plotcoeffs.m | 1,076 | utf_8 | fb09824f14b49b27a4d0023f34c78347 | % Tests for @chebfun/plotcoeffs.m.
function pass = test_plotcoeffs(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
f = chebfun(@sin, pref);
g = chebfun({@sin, @exp}, [-1 0 1], pref);
F = chebfun(@(x) [sin(x) cos(x) exp(x)], pref);
G = chebfun(@(x) [sin(x) cos(x) exp(x)], [-1 0 1], pref);
Q = cheb2quasi(F);
% ... |
github | foucart/Basc-master | test_compose_binary.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_compose_binary.m | 4,348 | utf_8 | 37c476f2f0d15b0212ba7172a177289c | % Test file for @chebfun/compose.m (binary operators).
function pass = test_compose_binary(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Create preference structure with splitting enabled.
pref_split = pref;
pref_split.splitting = 1;
% Smooth operator with smooth functions.
pass(1) = te... |
github | foucart/Basc-master | test_min.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_min.m | 5,723 | utf_8 | 2e2a628fc107888a2bc176cc68c9a079 | % Test file for @chebfun/min.m.
function pass = test_min(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
xr = 2 * rand(100, 1) - 1;
% Check empty case.
[y, x] = min(chebfun());
pass(1) = isempty(y) && isempty(x);
% Check operation without ... |
github | foucart/Basc-master | test_exp.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_exp.m | 736 | utf_8 | d42a6c6780c73d7124e1aed3a0add96a | % Test file for chebfun exp() and related functions.
function pass = test_exp(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% List of functions to test.
expFunct... |
github | foucart/Basc-master | test_inv.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_inv.m | 2,395 | utf_8 | 4573f782e821e371694c43289a92b3c1 | function pass = test_inv(pref)
% This test constructs two CHEBFUN objects and uses INV() to invert them. It
% checks the inverse calculated is accurate.
% Taken from Chebfun v4 test, invtest.m, by Nick Hale 07/06/2009.
if ( nargin == 0 )
pref = chebfunpref();
end
algoList = {'roots', 'newton', 'bisection', 're... |
github | foucart/Basc-master | test_mtimes.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_mtimes.m | 5,010 | utf_8 | 641401014c65123c0cd1f49eaa1401cf | % Test file for @chebfun/mtimes.m.
function pass = test_mtimes(pref)
% TODO: Test Chebfun2 outerproducts!
% Get preferences.
if (nargin < 1)
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Random numbers to use as arbitrary multiplicati... |
github | foucart/Basc-master | test_orth.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_orth.m | 694 | utf_8 | 4ab6c65a75599e158a0b8176a811fe78 | % Test file for @chebfun/orth.m.
function pass = test_orth(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Check some simple examples.
f = chebfun(@(x) [sin(x) cos(x) exp(x)], [-1 0 1], pref);
Q = orth(f);
pass(1) = norm(Q'*Q - eye(3), 'fro') < 10*vscale(Q)*epslevel(Q);
pass(2) = normest(Q*(Q\f) - f) < 10*vs... |
github | foucart/Basc-master | test_ne.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_ne.m | 2,147 | utf_8 | a6a5e39e5ff6ab05bf7986022bbafc52 | % Test file for @chebfun/ne.m.
function pass = test_ne(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check the empty case.
f = chebfun(@(x) sin(x), [-1 -0.5 0 0.5 1], pref);
g = chebfun();
pass(1) = isempty(f ~=... |
github | foucart/Basc-master | test_plus.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_plus.m | 5,096 | utf_8 | 670b9a6ecdb6eb49c11d9fecb0aa56f7 | % Test file for @chebfun/plus.m.
function pass = test_plus(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% A random number to use as an arbitrary additive constant.
alpha = -0.194758928283640 + ... |
github | foucart/Basc-master | test_logical.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_logical.m | 1,980 | utf_8 | 27280326cef9d54ae76e23817050c1e6 | % Test file for @chebfun/logical.m.
function pass = test_logical(pref)
if (nargin < 1)
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check a few basic cases.
f = chebfun(@(x) sin(2*x), [-1 1], pref);
g = logical(f);
pass(1) = isequal(g... |
github | foucart/Basc-master | test_fliplr.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_fliplr.m | 2,431 | utf_8 | f61cc411caadd6aa6e015856e2ed89ae | % Test file for @chebfun/fliplr.m.
function pass = test_fliplr(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(50, 1) - 1;
% Check the empty input case.
pass(1) = isempty(fliplr... |
github | foucart/Basc-master | test_floor.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_floor.m | 1,908 | utf_8 | ea3f164785ef5434e2cf7ada236f3416 | % Test file for @chebfun/floor.m
function pass = test_floor(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check empty case.
pass(1) = isempty(floor(chebfun()));
% Check "ordinary" cases.
f = chebfun(@(x) sin(x)... |
github | foucart/Basc-master | test_getValuesAtBreakpoints.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_getValuesAtBreakpoints.m | 1,559 | utf_8 | b7e3e452caca4d8dec3362355abd5957 | % Test file for @chebfun/test_getValuesAtBreakpoints.m.
function pass = test_getValuesAtBreakpoints(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
f = chebfun(@(x) x, [-1 0 .5 1]);
tol = epslevel(f);
vals = chebfun.getValuesAtBreakpoints(f.funs, f.domain);
err = abs(vals - f.domain.');
pass(1) = all(err < to... |
github | foucart/Basc-master | test_isequal.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_isequal.m | 1,741 | utf_8 | 5746a56e068208841e635afe1af91f51 | % Test file for @chebfun/isequal.m.
function pass = test_isequal(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Check empty case.
f = chebfun();
pass(1) = isequal(f, f);
% Check self equality.
f = chebfun(@(x) sin(x).*abs(x - 0.1), [-1 1], pref);
pass(2) = isequal(f,... |
github | foucart/Basc-master | test_rdivide.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_rdivide.m | 4,253 | utf_8 | 6443f0456bc188a8f0e68ba583fce1d3 | % Test file for @chebfun/rdivide.m.
function pass = test_rdivide(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
%% SCALAR-VALUED
% Check the empty cases.
f = chebfun(@sin, pref);
g = chebfun();
pass(1) = isempty(f... |
github | foucart/Basc-master | test_circconv.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_circconv.m | 1,128 | utf_8 | 8a6cbdb58e3108d0abaef5a03d7bbde3 | % Test file for chebfun/circconv
function pass = test_circconv(pref)
% Grab some preferences.
if ( nargin == 0 )
pref = chebfunpref();
end
testclass = fourtech();
% Generate a random point to use as test values.
seedRNG(6178);
x = 2 * rand - 1;
% Check operation in the face of empty arguments.
f = chebfun();
g... |
github | foucart/Basc-master | test_imag.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_imag.m | 1,594 | utf_8 | acbe2069d7ca509870a5d7463d808062 | % Test file for @chebfun/real.m.
function pass = test_imag(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Run a few straightforward tests.
f = chebfun();
pass(1... |
github | foucart/Basc-master | test_subspace.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_subspace.m | 942 | utf_8 | b3458f2cc178efd6433f837b0e0db7fe | % Test file for @chebfun/subspace.m.
function pass = test_subspace(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Orthonormal array-valued chebfun:
A = chebfun(@(t) [1/sqrt(2)+0*t cos(t) sin(2*t) sin(3*t)]/sqrt(pi), ...
[0 1 2*pi], pref);
f = chebfun(@(t) sin(10*t)/sqrt(pi), [0 2 2*pi], pref);
alpha = ... |
github | foucart/Basc-master | test_constructor_splitting.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_constructor_splitting.m | 4,459 | utf_8 | 50aeba9e11dfbd1d1555f80ab8c06314 | % Test file for chebfun constructor (splitting).
function pass = test_constructor_splitting(pref)
% Grab some preferences:
if ( nargin == 0 )
pref = chebfunpref();
end
seedRNG(6178);
tol = 2000;
% Test SQRT(X) on [0 1]:
F1 = @sqrt;
f1 = chebfun(F1, [0, 1], pref, 'splitting', 'on', 'blowup', 'off');
xx1 = linspa... |
github | foucart/Basc-master | test_round.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_round.m | 1,463 | utf_8 | 785176dadee8d712f8095661bb89745c | % Test file for @chebfun/round.m
function pass = test_round(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check empty case.
pass(1) = isempty(round(chebfun()));
% Check "ordinary" cases.
f = chebfun(@(x) sin(x)... |
github | foucart/Basc-master | test_trig.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_trig.m | 1,391 | utf_8 | 6840ef9dc06fc77bfe8716abb44c7791 | % Test file for chebfun trigonometric and related functions.
function pass = test_trig(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% List of trigonometric func... |
github | foucart/Basc-master | test_real.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_real.m | 1,583 | utf_8 | 076c85020834be3bde65b93c8b8640d4 | % Test file for @chebfun/real.m.
function pass = test_real(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Run a few straightforward tests.
f = chebfun();
pass(1... |
github | foucart/Basc-master | test_polyfit.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_polyfit.m | 1,563 | utf_8 | fbab11b072e1b4e9845a94e4ff6417b2 | % Test file for POLYFIT.
function pass = test_polyfit(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
seedRNG(7681);
%% Test CONTINUOUSPOLYFIT on [-1 1]:
% Check the 'nothing to do' case:
F = chebfun(@(x) x.^2 + 3*x.^4, [-1 1]);
p = polyfit(F, 5);
err = norm(p - F);
pass(1) = err < 10*epslevel(p)*vscale(p)... |
github | foucart/Basc-master | test_chebcoeffs.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_chebcoeffs.m | 1,661 | utf_8 | 1026c2115bc95d394bf9270c55f3f772 | % Test file for @chebfun/chebcoeffs.m.
function pass = test_chebcoeffs(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Test on a smooth chebfun.
f = chebfun(@(x) cos(x));
n = 5;
c = chebcoeffs(f, n);
c_exact = [besselj(0, 1) ;
0 ;
-2*besselj(2, 1) ;
0 ;
2*(-23*be... |
github | foucart/Basc-master | test_diff.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_diff.m | 3,806 | utf_8 | 309d7b09c1fbb73fbecc20217c712c70 | % Test file for @chebfun/diff.m.
function pass = test_diff(pref)
% Obtain preferences.
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Check empty casee.
pass(1) = isempty(diff(chebfun()));
% Check an exam... |
github | foucart/Basc-master | test_erfX.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_erfX.m | 946 | utf_8 | 5401149924fe34e45a78d7c1aff0c56f | % Test file for all the functions related to the error function ERF().
function pass = test_erfX(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
F = {@erf, @erfinv, @erfc, @erfcx, @(x) erfcinv(x+1)};
pass = false(5, 2);
for k = 1:numel(F)
f = chebfun(@sin, pref);
g = feval(F{k}, f);
h = chebfu... |
github | foucart/Basc-master | test_mat2cell.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_mat2cell.m | 4,105 | utf_8 | cc92c382d66c05c5b0b72d568f1681c5 | % Test file for @chebfun/mat2cell.m.
function pass = test_mat2cell(pref)
% Obtain preferences.
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Check empty case.
C = mat2cell(chebfun());
pass(1,1) = isequal(... |
github | foucart/Basc-master | test_ellipke.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_ellipke.m | 1,083 | utf_8 | 3bee463ce247b3762f94db5d0547e6d9 | function pass = test_ellipke(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
%% 1 output:
% Linear scalar:
m = chebfun('m', [0 .99], pref);
K1 = ellipke(m);
K2 = chebfun(@(m) ellipke(m), [0 .99], pref);
pass(1) = normest(K1 - K2) < 10*epslevel(K1)*vscale(K1);
% Array-valued composition:
f = chebfun(@(x) .05+a... |
github | foucart/Basc-master | test_waterfall.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_waterfall.m | 710 | utf_8 | 64107e60e7a58d5a45bbc3a1988759b5 | % Test file for @chebfun/waterfall.m.
function pass = test_waterfall(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
hfig = figure('Visible', 'off');
Q = chebfun(@(x) [sin(pi*x) sin(pi*(x - 0.3)) sin(pi*(x - 0.6))], pref);
pass(1) = doesNotCrash(@() waterfall(Q));
pass(2) = doesNotCrash(@() waterfall(chebfun(... |
github | foucart/Basc-master | test_merge.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_merge.m | 2,425 | utf_8 | 3ef8d97cff2dee2ba300516358fb8c44 | % Test file for @chebfun/merge.m.
function pass = test_merge(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
seedRNG(6178);
% Test something easy (the example from docs):
pref2 = pref;
pref2.splitting = 1;
f = chebfun(@(x) x.^2, [-1 0 1], pref2);
g = merge(f);
pass(1) = all(size(g.funs) == 1);
xx = linspace(... |
github | foucart/Basc-master | test_besselyk.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_besselyk.m | 2,103 | utf_8 | 9aacb3caba0facf99628941a59c505ed | % Test file for @chebfun/bessely.m and @chebfun/besselk.m.
function pass = test_besselyk(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
xr = 2 * rand(100, 1) - 1;
% Arbitrary value to use for nu in the tests.
nu = 1.663;
for (n = 1:2)
... |
github | foucart/Basc-master | test_le.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_le.m | 2,758 | utf_8 | 6b16d220119478b39b8326e1ffb4c3e2 | % Test file for @chebfun/le.m.
function pass = test_le(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
hvsde = @(x) .5*(sign(x) + 1);
% Check the empty case.
f = chebfun(@(x) sin(x), [-1 -0.5 0 0.5 1], pref);
g = ch... |
github | foucart/Basc-master | test_tweakDomain.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_tweakDomain.m | 1,318 | utf_8 | 121a5a56d14d5b28bf13aef800a1bf1c | function pass = test_tweakDomain(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Tweak left endpoint:
[df, dg, j, k] = test([-1+eps, 1], [-1, 1], pref);
pass(1) = all(df == dg) && j == 1 && k == 1;
% Tweak right endpoint:
[df, dg, j, k] = test([-1, 1], [-1, 1+eps], pref);
pass(2) = all(df == dg) && j == 2 &... |
github | foucart/Basc-master | test_or.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_or.m | 2,587 | utf_8 | 2728de8034f3151589de74ef4171d0c8 | % Test file for @chebfun/or.m.
function pass = test_or(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check the empty case.
f = chebfun(@sin);
pass(1) = isempty(f | chebfun()) && isempty(chebfun() | f);
% Check ... |
github | foucart/Basc-master | test_complex.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_complex.m | 3,022 | utf_8 | 88cbaee3c35d4456bdbef9aa195c3ec7 | % Test file for @chebfun/complex.m.
function pass = test_complex(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
pref.splitting = 1;
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Check empty cases.
f = chebfun(@sin, [-1 1], pre... |
github | foucart/Basc-master | test_cumsum.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_cumsum.m | 6,462 | utf_8 | 7dd99a9734133dc9af429e513e4a27ef | % Test file for @chebfun/cumsum.m.
function pass = test_cumsum(pref)
% Obtain preferences.
if ( nargin == 0 )
pref = chebfunpref();
end
%%
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
% Check empty case.
pass(1) = isempty(cumsum(chebfun()));
%%
% Ch... |
github | foucart/Basc-master | test_eq.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_eq.m | 1,843 | utf_8 | f1167c2859a33014974252dcb8086409 | % Test file for @chebfun/eq.m.
function pass = test_eq(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Check the empty case.
f = chebfun(@(x) sin(x), [-1 -0.5 0 0.5 1], pref);
g = chebfun();
pass(1) = isempty(f ==... |
github | foucart/Basc-master | test_chebpade.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_chebpade.m | 1,382 | utf_8 | 0dc690f75168b731779c0a361f8cdf54 | % Test for @chebfun/chebpade.m.
% Based on the Chebfun v4 test written by Ricardo Pachon, Feb. 09, 2009.
function pass = test_chebpade(pref)
% Turn off warnings and save the warning state.
warnState = warning('off');
% An example which doesn't require degree-reduction.
dom = [-1, 3];
P = chebfun([ 0.5045; -1.3813; ... |
github | foucart/Basc-master | test_compose_unary.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_compose_unary.m | 4,253 | utf_8 | 6d4ae3f25944c170a8055dcff5460d34 | % Test file for @chebfun/compose.m (unary operators.
function pass = test_compose_unary(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Create preference structure with splitting enabled.
pref_split = pref;
pref_split.splitting = 1;
% Test empty input.
f = chebfun();
g = compose(f, @sin, ... |
github | foucart/Basc-master | test_sum.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_sum.m | 7,103 | utf_8 | e09c7775b007d077476e8037162d9b81 | % Test file for @chebfun/sum.m.
function pass = test_sum(pref)
% Obtain preferences.
if ( nargin == 0 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
%% SCALAR-VALUED
% Check the empty case.
pass(1) = sum(chebfun()) == 0;
%... |
github | foucart/Basc-master | test_isnan.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_isnan.m | 1,238 | utf_8 | a3f637b1d31fb0ad9c158a22f4dea0cb | % Test file for @chebfun/isnan.m.
function pass = test_isnan(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Check empty case.
pass(1) = ~isnan(chebfun());
% Check clearly non-NaN cases.
f = chebfun(@(x) sin(x), [-1 -0.5 0 0.5 1], pref);
pass(2) = ~isnan(f);
g = chebfun(@(x) [sin(x) cos(x... |
github | foucart/Basc-master | test_end.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_end.m | 2,198 | utf_8 | 55b7a0f3db7c9c8e6e8dbcd551ffc46f | function pass = test_end(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
%% test end in infinite dimension:
% Scalar:
f = chebfun(@(x) sin(pi*x));
out = f(end);
pass(1) = isnumeric(out) && length(out) == 1 && abs(out) < epslevel(f);
% Array:
f = chebfun(@(x) [sin(pi*x), cos(pi*x), x]);
out = f(end);
pass(2) =... |
github | foucart/Basc-master | test_constructor_basic.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_constructor_basic.m | 1,333 | utf_8 | c5ad5f5ffb790fc65cb77b53cc5dba38 | % Test file for chebfun constructor (basic).
function pass = test_constructor_basic(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
% Some basic test functions:
FF = {@sin, @(x) [sin(x), cos(x)], @(x) [sin(x), cos(x), exp(-x)]};
for j = 1:numel(FF);
% Initialise k:
k = 0;
% Pick the test functio... |
github | foucart/Basc-master | test_range.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_range.m | 1,655 | utf_8 | 229a6d95f320e43887537f90fd93f890 | % Test file for @chebfun/range.m.
function pass = test_range(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Empty input.
pass(1) = isempty(range(chebfun()));
% Scalar row and column input.
f = chebfun(@(x) x, [-... |
github | foucart/Basc-master | test_constructor_unbndfun.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_constructor_unbndfun.m | 3,327 | utf_8 | 70295fd235296e34500674b66b5d30bb | % Test file for chebfun constructor for functions defined in unbounded domain.
function pass = test_constructor_unbndfun(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
%% Functions on [-inf inf]:
% Set the domain:
dom = [-Inf Inf];
domCheck = [-1e2 1e2];
% Generate a few random points to use as test values... |
github | foucart/Basc-master | test_plot_xylim.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_plot_xylim.m | 3,051 | utf_8 | 2326c2637ba9965f4dfea6ca98eaa2ad | % Tests for chebfun plotting functions.
function pass = test_plot_xylim(pref)
tol = 1e-4;
% Create a figure, and make it invisible. Need to do this a number of time
% throughout the test.
hfig = figure;
set(hfig,'visible','off')
%% Finite functions on unbounded domains
dom1 = [0 pi];
pass1 = [];
x = chebfun(@(x) x, d... |
github | foucart/Basc-master | test_overlap.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_overlap.m | 3,550 | utf_8 | c585729970f9310c94e4c559d8398de6 | % Test file for @chebfun/overlap.m.
function pass = test_overlap(pref)
% Grab some preferences:
if ( nargin == 0 )
pref = chebfunpref();
end
% TODO: Test for array-valued CHEBFUNS and quasimatrices.
% Test empty input.
f = chebfun();
g = chebfun();
[f2, g2] = overlap(f, g);
pass(1) = isempty(f2) && isempty(g2);... |
github | foucart/Basc-master | test_times.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_times.m | 4,828 | utf_8 | e8ec32e1a8fa1a8590ec7445de80b1d4 | % Test file for @chebfun/times.m.
function pass = test_times(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
% Random numbers to use as arbitrary multiplicative constants.
alpha = -0.1947589282836... |
github | foucart/Basc-master | test_splitting_abs.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_splitting_abs.m | 1,663 | utf_8 | 810688b5570849b70ff41a03d7dc6c2e | % Test file for 'splitting on' functionality with functions involving abs().
function pass = test_splitting_abs(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
seedRNG(6178);
pref.splitting = true;
% Some basic test functions:
FF = {@abs, @(x) abs(x).^5, @(x) abs(sin(10*x)), @(x) abs(sin(30*x))};
for j = 1:... |
github | foucart/Basc-master | test_any.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_any.m | 2,563 | utf_8 | 83e7719f83b4c499637444e647c03de3 | % Test file for @chebfun/any.m.
function pass = test_any(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Enable breakpoint detection.
pref.splitting = 1;
% Generate a few random points to use as test values.
seedRNG(6178);
x = 2 * rand(100, 1) - 1;
hvsde = @(x) .5*(sign(x) + 1);
% Check empty case.
pass(1... |
github | foucart/Basc-master | test_repmat.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_repmat.m | 787 | utf_8 | 5677f71a21eac65b685b94e511c15b75 | % Test file for @chebfun/repmat.m.
function pass = test_repmat(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as test values.
seedRNG(7681);
xr = 2 * rand(1000, 1) - 1;
f = chebfun(@sin, [-1 0 1]);
Q = repmat(f, 1, 3);
Q_exact = @(x) [sin(x) sin(x) sin(x)];
er... |
github | foucart/Basc-master | test_constructor_basic_periodic.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_constructor_basic_periodic.m | 1,213 | utf_8 | f8054ffcbaa4707a001b4df1896aeae9 | % Test file for chebfun constructor (periodic).
function pass = test_constructor_basic_periodic(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
%% Test construction of some basic functions:
% Some basic test functions:
FF = {@(x) exp(sin(pi*x)), @(x) exp([sin(pi*x), cos(pi*x)]), @(x) exp([sin(pi*x), cos(pi*x... |
github | foucart/Basc-master | test_svd.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_svd.m | 949 | utf_8 | cc35803affe4d28224a4efc7806bd3d5 | % Test file for @chebfun/svd.m.
function pass = test_svd()
if ( nargin < 1 )
pref = chebfunpref();
end
% Check a simple example.
f = chebfun(@(x) [sin(x) cos(x) exp(x)], [-1 -0.5 0 0.5 1]);
[U, S, V] = svd(f);
g = U*S*V';
pass(1) = ~U.isTransposed && (normest(f - g) < ...
10*max(vscale(f)*epslevel(f), vscale... |
github | foucart/Basc-master | test_restrict.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_restrict.m | 5,166 | utf_8 | 5a843f532a0fdbe6561933f4643df78f | % Test file for @chebfun/restrict.m
% [TODO]: Once we're finally handling higher-order impulses, add a test which
% tries restricting a function that has them.
function pass = test_restrict(pref)
% Get preferences.
if ( nargin < 1 )
pref = chebfunpref();
end
% Generate a few random points in [-1 1] to use as t... |
github | foucart/Basc-master | test_plot.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_plot.m | 4,559 | utf_8 | cc697e0e03eb4b1f3a3eb52d2a552df7 | % Tests for chebfun plotting functions.
function pass = test_plot(pref)
if ( nargin < 1 )
pref = chebfunpref();
end
% Real scalar functions.
fsr1 = chebfun(@sin, [-1 0 1], pref);
fsr2 = chebfun(@cos, [-1 0.5 1], pref);
fsr3 = chebfun(@exp, [-1 -0.5 1], pref);
% Real array-valued functions.
far1 = chebfun(@(x) [... |
github | foucart/Basc-master | test_mean.m | .m | Basc-master/basc_v1.0/chebfun-master/tests/chebfun/test_mean.m | 2,305 | utf_8 | b9ebe029322aae92dbcb04dce1d11ce6 | function pass = test_mean(pref)
if ( nargin == 0 )
pref = chebfunpref();
end
%% Two arguments:
f = chebfun(@sin, pref);
g = chebfun(@cos, pref);
h = chebfun(@(x) .5*(sin(x) + cos(x)), pref);
pass(1) = normest(mean(f, g) - h) < 10*epslevel(h);
f = chebfun(@(x) [sin(x), cos(x)], pref);
g = chebfun(@(x) [cos(x), 1i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.