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
aristofanio/freemat-master
test_call1.m
.m
freemat-master/FreeMat/tests/suite/test_call1.m
283
utf_8
c49efd82a2a9f68f33b5e01c060a44b8
% test the multiple left-hand side call with a pre-existing cell-array function test_val = test_call1 d1 = {1,2}; d2 = {5}; d3 = {6}; [d1,d2,d3] = test_call1_assist; test_val = test(d1 == 1) & test(d2 == 4) & test(d3 == 3); function [a,b,c] = test_call1_assist a = 1; b = 4; c = 3;
github
aristofanio/freemat-master
test_switch3.m
.m
freemat-master/FreeMat/tests/suite/test_switch3.m
255
utf_8
139de441a3706a8bd1d7f788f66f7ee7
% Test the switch statement with a scalar argument function test_val = test_switch3 test_val = 0; x = 1.0f + i; z = 1.0 + i; switch x case 1 test_val = 0; case i test_val = 0; case z test_val = 1; case 'astring' test_val = 0; otherwise test_val = 0; end
github
aristofanio/freemat-master
test_svd2.m
.m
freemat-master/FreeMat/tests/suite/test_svd2.m
456
utf_8
db82457ef69b7740715ea688387c0702
% Test the svd with finite and infinite args (functional only) function test_val = test_svd2 a = double([1,3;4,2]); [u,s,v] = svd(a); res1 = 1; res2 = 0; res3 = 0; res4 = 0; try c = a; c(2,2) = inf; svd(c); catch res2 = 1; end try c = a; c(2,2) = -inf; svd(c); catch ...
github
aristofanio/freemat-master
test_range8.m
.m
freemat-master/FreeMat/tests/suite/test_range8.m
171
utf_8
20a03b1fc7e42dc87a904e7af2f7e529
% Check the range function with a negative step size function test_val = test_range8 range = 3f:-1f:-2f; range2 = [3f,2f,1f,0f,-1f,-2f]; test_val = test(range == range2);
github
aristofanio/freemat-master
test_struct9.m
.m
freemat-master/FreeMat/tests/suite/test_struct9.m
194
utf_8
db0e842f5f573b708ca3dc14c55ae7fb
% Test the ability to assign a single element in a structure array function test_val = test_struct9 d = struct('foo',3,'goo','hello','shoo',1:5); d(3).shoo = 3; test_val = test(d(3).shoo == 3);
github
aristofanio/freemat-master
test_assign3.m
.m
freemat-master/FreeMat/tests/suite/test_assign3.m
189
utf_8
07997e054ba178af8cdd6cef94625083
% Test the assignment of a value to a cell-array using content-based n-dim indexing function test_val = test_assign3 a = {1,2;4,5}; test_val = 0; try a{2,1:2} = -1; catch test_val = 1; end
github
aristofanio/freemat-master
test_assign1.m
.m
freemat-master/FreeMat/tests/suite/test_assign1.m
160
utf_8
812855ecbc2217803b2fdfeea6f51cdc
% Test the assignment of a value to a cell array as a vector-contents function test_val = test_assign1 a = {1,2,3,4,5}; a{5} = -1; test_val = test(a{5} == -1);
github
aristofanio/freemat-master
test_switch1.m
.m
freemat-master/FreeMat/tests/suite/test_switch1.m
241
utf_8
6d630c35eb780aa8503148a051ddc195
% Test the switch statement with a string argument function test_val = test_switch1 test_val = 0; x = 'astring'; switch x case 'bstring' test_val = 0; case 'astring'; test_val = 1; case 'cstring'; test_val = 0; otherwise test_val = 0; end
github
aristofanio/freemat-master
test_sparse60.m
.m
freemat-master/FreeMat/tests/suite/test_sparse60.m
706
utf_8
37bb776ca6e60462037f332a7b93c1a5
% Test dense-sparse matrix multiplication function x = test_sparse60 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); [yi2,zi2] = spa...
github
aristofanio/freemat-master
test_typeof5.m
.m
freemat-master/FreeMat/tests/suite/test_typeof5.m
138
utf_8
298b6941dc859a307a084ab17eb266bf
% Check the typeof function for dcomplex types function test_val = test_typeof5 a = 2.0 + i; test_val = test(strcmp(typeof(a),'double'));
github
aristofanio/freemat-master
test_image1.m
.m
freemat-master/FreeMat/tests/suite/test_image1.m
181
utf_8
9446caca41bea90fe5f63c079eb862d1
% test image of an empty argument function test_val = test_image1 a = []; try % If this causes a segfault, it won't be caught. image(a); catch end close all; test_val = 1;
github
aristofanio/freemat-master
test_assign6.m
.m
freemat-master/FreeMat/tests/suite/test_assign6.m
185
utf_8
93d74abf712139b0b81ce57f8c07c060
% Test the field assignment with a vector struct (should cause an error) function test_val = test_assign6 a = struct('foo',{5,7}); test_val = 0; try a.foo = -1; catch test_val = 1; end
github
aristofanio/freemat-master
test_file1.m
.m
freemat-master/FreeMat/tests/suite/test_file1.m
227
utf_8
9da8960330781c05845acb76335d7450
% Test reading and writing a scalar to a file function test_val = test_file1 fp = fopen('junk.dat','w'); p = uint32(4); fwrite(fp,p); fclose(fp); fp = fopen('junk.dat','r'); q = fread(fp,1,'uint32'); fclose(fp); return (p==q);
github
aristofanio/freemat-master
test_subset9.m
.m
freemat-master/FreeMat/tests/suite/test_subset9.m
235
utf_8
783b7847cbd7d88d8f200f93ab2efb50
% Test the cell vector subset with contents-based addressing function test_val = test_subset9 a = {5,8;10,3}; sm = test_subset9_assist(a{1:3}); test_val = test(sm == 23); function a = test_subset9_assist(b,c,d) a = b + c + d;
github
aristofanio/freemat-master
test_typeof3.m
.m
freemat-master/FreeMat/tests/suite/test_typeof3.m
132
utf_8
afbae34f93290b9cdfc10d437224c2ab
% Check the typeof function for float types function test_val = test_typeof3 a = 2.0f; test_val = test(strcmp(typeof(a),'single'));
github
aristofanio/freemat-master
test_fitfun1.m
.m
freemat-master/FreeMat/tests/suite/test_fitfun1.m
170
utf_8
449d5432ebd585c9496583cd88deb686
% Test the fitfun bug (bug 1514605) function test_val = test_fitfun1 O = 3/4*pi; y0 = cos(O); [x y] = fitfun('cos',3.5/4*pi,y0,1,0.0001); test_val = abs((x-O)/O*100)<.1;
github
aristofanio/freemat-master
test_while1.m
.m
freemat-master/FreeMat/tests/suite/test_while1.m
172
utf_8
94c7987afd2f91320c37980932bad4d4
% Test the while statement for normal operation function test_val = test_while1 sum = 0; i = 1; while (i<=10) sum = sum + i; i = i + 1; end test_val = test(sum == 55);
github
aristofanio/freemat-master
test_size2.m
.m
freemat-master/FreeMat/tests/suite/test_size2.m
198
utf_8
1fb7dcdf8698d454d38d98161c951538
% Check the size function with an n-dim argument & multiple outputs function test_val = test_size2 a = [1,2,3;4,5,6]; [c1,c2,c3] = size(a); test_val = test(c1 == 2) & test(c2 == 3) & test(c3 == 1);
github
aristofanio/freemat-master
test_source.m
.m
freemat-master/FreeMat/tests/suite/test_source.m
247
utf_8
7a928b09567bcca7eabe74ffe5ca2cea
% Check that the source function does not double-execute the last line of the script function test_val = test_source myloc = which('test_source'); [path,name,sfx] = fileparts(myloc); source([path '/source_test_script.m']) test_val = test(n == 2);
github
aristofanio/freemat-master
test_sparse78.m
.m
freemat-master/FreeMat/tests/suite/test_sparse78.m
670
utf_8
9f9320afab01a121615d77f3bf9f7d07
% Test sparse-sparse matrix array add function x = test_sparse78 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); [yi2,zi2] = sparse_...
github
aristofanio/freemat-master
test_size4.m
.m
freemat-master/FreeMat/tests/suite/test_size4.m
165
utf_8
b0465e51ad8bebb9d952e95cad9017fe
% Check the size function with two arguments and two outputs function test_val = test_size4 a = [1,2,3;4,5,6]; test_val = 0; [c,d] = size(a,2); test_val = (c == 3);
github
aristofanio/freemat-master
test_svd12.m
.m
freemat-master/FreeMat/tests/suite/test_svd12.m
1,085
utf_8
b5a6381ad561860349ec5e5c0eb774f1
% Test the compact version of the svd with dcomplex vectors function test_val = test_svd12 t1all = 1; p = []; for n=2:100 a = double(rand(n,2*n))+i*double(rand(n,2*n)); [u,s,v] = svd(a,0); emat = abs(a-u*s*v'); err = max(emat(:)); p(n) = err; bnd = 10*max(abs(diag(s)))*eps*n; t1 = (err...
github
aristofanio/freemat-master
test_sparse75.m
.m
freemat-master/FreeMat/tests/suite/test_sparse75.m
604
utf_8
14a600b7391bd3030669e6f5ffa8b15f
% Test sparse matrix array finite test function x = test_sparse75 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); x = 1; yi1(150,200...
github
aristofanio/freemat-master
test_qr6.m
.m
freemat-master/FreeMat/tests/suite/test_qr6.m
520
utf_8
2b348b5b62cdac5111522974fe6b960d
% Test the QR decomposition (without pivoting, float) function test_val = test_qr6 a = float([1,2,3;4,5,6;7,8,9;10,0,5]); % float precision [q,r] = qr(a); qorg = q'*q - diag(ones(1,4)); t1 = (max(abs(qorg(:)))<1e-6); t2 = ((size(q,1) == 4) & (size(q,2) == 4)); t3 = ((size(r,1) == 4) & (size(r,2) == 3)); aorg = q*r - a;...
github
aristofanio/freemat-master
test_lu1.m
.m
freemat-master/FreeMat/tests/suite/test_lu1.m
586
utf_8
a5651146c9ff7a9c29fe5e6f378e7587
% Test the LU decomposition with 2 argument return for full matrices function x = test_lu1 A = float(randn(20)); [L,U] = lu(A); x = testeq(100,L*U,A); A = double(randn(20)); [L,U] = lu(A); x = x & testeq(100,L*U,A); A = complex(randn(20)+i*randn(20)); [L,U] = lu(A); x = x & testeq(100,L*U,A); A = dcomplex(randn(20)+i*r...
github
aristofanio/freemat-master
test_qr7.m
.m
freemat-master/FreeMat/tests/suite/test_qr7.m
539
utf_8
5f5741a2fe9bbf13d86c96f4836c138a
% Test the QR decomposition (without pivoting, complex) function test_val = test_qr7 a = float([1,2,3;4,5,6;7,8,9;10,0,5]); a = a + i*(a-1); % float precision [q,r] = qr(a); qorg = q'*q - diag(ones(1,4)); t1 = (max(abs(qorg(:)))<1e-6); t2 = ((size(q,1) == 4) & (size(q,2) == 4)); t3 = ((size(r,1) == 4) & (size(r,2) == 3...
github
aristofanio/freemat-master
test_range5.m
.m
freemat-master/FreeMat/tests/suite/test_range5.m
153
utf_8
b61b8c93735b72826a8dca7939b99594
% Check the range function with negative integer function test_val = test_range5 range = -2:2; range2 = [-2,-1,0,1,2]; test_val = test(range == range2);
github
aristofanio/freemat-master
test_range2.m
.m
freemat-master/FreeMat/tests/suite/test_range2.m
197
utf_8
8746a698efa0753908ccdd10904ad9a3
% Check the range function for integer types positive with 3 args & horizontal concatenation function test_val = test_range2 range = (0:1:3)'; range2 = [0;1;2;3]; test_val = test(range == range2);
github
aristofanio/freemat-master
test_empty.m
.m
freemat-master/FreeMat/tests/suite/test_empty.m
647
utf_8
b3a81d440b5d5c0fdf6027753fd8f5eb
% Test the arithmetic operators with empty arguments function test_val = test_empty test_val = isempty([]+[]); test_val = test_val & isempty([]-[]); test_val = test_val & isempty(-[]); test_val = test_val & isempty([]*[]); test_val = test_val & isempty([]/[]); test_val = test_val & isempty([]\[]); test_val = test_val &...
github
aristofanio/freemat-master
test_typeof1.m
.m
freemat-master/FreeMat/tests/suite/test_typeof1.m
131
utf_8
5a4f283d01720e57ed1c88ce67cc172a
% Check the typeof function for integer types function test_val = test_typeof1 a = 2; test_val = test(strcmp(typeof(a),'double'));
github
aristofanio/freemat-master
test_diag5.m
.m
freemat-master/FreeMat/tests/suite/test_diag5.m
157
utf_8
0a16ada5668cbc1c4d5d2ea82bac1820
% Test the diagonal creation function with no arguments (bug 1620051) function test_val = test_diag5 test_val = 1; try b = diag; catch test_val = 1; end
github
aristofanio/freemat-master
test_assign7.m
.m
freemat-master/FreeMat/tests/suite/test_assign7.m
117
utf_8
69aab4d65246c104ebae2591b30bb621
% Test the empty assignment for the empty cell array function test_val = test_assign7 a = {}; test_val = isempty(a);
github
aristofanio/freemat-master
test_sparse68.m
.m
freemat-master/FreeMat/tests/suite/test_sparse68.m
926
utf_8
a9c826619cb6b233e54640a179a525b4
% Test sparse to IJV conversion function x = test_sparse68 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); [iyi1,jyi1,vyi1] = find(y...
github
aristofanio/freemat-master
test_qr9.m
.m
freemat-master/FreeMat/tests/suite/test_qr9.m
1,354
utf_8
69ba515dca8426b88eadfc8e572b7ce3
% Test the QR decomposition (full, without pivoting) function test_val = test_qr9 t1all = 1; for n=2:4:100 a = float(rand(n,2*n)); [q,r] = qr(a); err = abs(a-q*r); err = max(err(:)); bnd = 8*max(abs(diag(r)))*feps*(n^(0.5)); t1 = (err < bnd); if (~t1) printf('test failed: er = %e bnd = %...
github
aristofanio/freemat-master
test_range6.m
.m
freemat-master/FreeMat/tests/suite/test_range6.m
171
utf_8
6316486b5422a4da56529c071f39525f
% Check the range function with a negative float function test_val = test_range6 range = -2.f:3.f; range2 = [-2.f,-1.f,0.f,1.f,2.f,3.f]; test_val = test(range == range2);
github
aristofanio/freemat-master
test_svd6.m
.m
freemat-master/FreeMat/tests/suite/test_svd6.m
1,077
utf_8
9d70c4bb21be7af3759854121192ef57
% Test the full version of the svd with complex vectors function test_val = test_svd6 t1all = 1; p = []; for n=2:4:100 a = float(rand(n,2*n))+i*float(rand(n,2*n)); [u,s,v] = svd(a); emat = abs(a-u*s*v'); err = max(emat(:)); p(n) = err; bnd = 10*max(abs(diag(s)))*feps*n; t1 = (err < bnd...
github
aristofanio/freemat-master
test_switch7.m
.m
freemat-master/FreeMat/tests/suite/test_switch7.m
269
utf_8
8eb3cf78298bf12e021a81cba9728393
% Test the switch statement with a numerical argument and a cell array function test_val = test_switch7 test_val = 0; x = 5; switch x case 'bstring' test_val = 0; case {'dstring',5.0,'astring'}; test_val = 1; case 'cstring'; test_val = 0; otherwise test_val = 0; end
github
aristofanio/freemat-master
test_imwrite_imread.m
.m
freemat-master/FreeMat/tests/suite/test_imwrite_imread.m
218
utf_8
9491bd847d9fc51e0e2da1db2890abbe
% Test the imwrite and imread capability with random grayscale image function test_val = test_imwrite_imread a = uint8(255*rand(64)); imwrite(a, 'test.bmp') b = imread('test.bmp'); test_val = issame(a,b);
github
aristofanio/freemat-master
test_sparse64.m
.m
freemat-master/FreeMat/tests/suite/test_sparse64.m
1,500
utf_8
d1fe613bb4fc6cd22d4263b4290325a3
% Test sparse matrix array ndim-subset extraction function x = test_sparse64 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); row_ndx...
github
aristofanio/freemat-master
test_sparse58.m
.m
freemat-master/FreeMat/tests/suite/test_sparse58.m
1,486
utf_8
fef3ed911f11ff7b5357fdf6c3631372
% Test type conversion functions function x = test_sparse58 [yi,zi] = sparse_test_mat('int32',400); [yf,zf] = sparse_test_mat('float',400); [yd,zd] = sparse_test_mat('double',400); [yc,zc] = sparse_test_mat('complex',400); [yz,zz] = sparse_test_mat('dcomplex',400); xi = testeq(int32(yi),sparse(int32(zi))) & ... te...
github
aristofanio/freemat-master
test_eig2.m
.m
freemat-master/FreeMat/tests/suite/test_eig2.m
1,986
utf_8
86914557fdcff2075bb8def0f36a3d41
% Test eigenvalue function - symmetric matrices function t = test_eig2 % First the float version t1all = 1; for i=2:4:100 a = float(randn(i)); a = a + a'; [v,d] = eig(a); emat = a*v - v*d; er = max(abs(emat(:))); bnd = 10*max(diag(abs(d)))*feps*i; t1 = (er < bnd); if (~t1) printf('test failed: er = %e bnd...
github
aristofanio/freemat-master
test_assign15.m
.m
freemat-master/FreeMat/tests/suite/test_assign15.m
195
utf_8
318d1a636d92b7a2bccc700e8c019060
% Test for error on illegal (incomplete) assign to empty variables function test_val = test_assign15 a = [2,3;4,5]; test_val = 0; try c(2,:) = a; catch test_val = 1; end
github
aristofanio/freemat-master
test_test3.m
.m
freemat-master/FreeMat/tests/suite/test_test3.m
125
utf_8
f01e10f4bd3e12f966d5713183f16ea8
% Check that test function works properly for a vector of 1 function test_val = test_test3 test_val = test([1,1,1,1]) == 1;
github
aristofanio/freemat-master
test_call3.m
.m
freemat-master/FreeMat/tests/suite/test_call3.m
163
utf_8
fc90586ebef879c93741274aaa6e2f39
% test calls with pass-by-reference function test_val = test_call3 d1 = 3; test_call3_assist(d1); test_val = test(d1 == 1); function test_call3_assist(&x) x = 1;
github
aristofanio/freemat-master
test_subset18.m
.m
freemat-master/FreeMat/tests/suite/test_subset18.m
175
utf_8
d5af649eb438783ce8cfb6daa842b2ba
% Test the subset assign with an empty variable function test_val = test_subset18 a = []; b = 1:4; a(:) = b; test_val = (a(1) == 1) & (a(2) == 2) & (a(3) == 3) & (a(4) == 4);
github
aristofanio/freemat-master
test_svd8.m
.m
freemat-master/FreeMat/tests/suite/test_svd8.m
1,081
utf_8
384baa88ede59efc875544068f068b45
% Test the full version of the svd with dcomplex vectors function test_val = test_svd8 t1all = 1; p = []; for n=2:4:100 a = double(rand(n,2*n))+i*double(rand(n,2*n)); [u,s,v] = svd(a); emat = abs(a-u*s*v'); err = max(emat(:)); p(n) = err; bnd = 10*max(abs(diag(s)))*eps*n; t1 = (err < b...
github
aristofanio/freemat-master
test_subset3.m
.m
freemat-master/FreeMat/tests/suite/test_subset3.m
164
utf_8
aabf60f9d621e7590a0af545a61df5a9
% Test the vector subset with a cell array function test_val = test_subset3 a = {1,2,3,4;5,6,7,8}; b = [3;4]; c = a(b); test_val = test((c{1} == 2) & (c{2} == 6));
github
aristofanio/freemat-master
test_evalin1.m
.m
freemat-master/FreeMat/tests/suite/test_evalin1.m
219
utf_8
5ffc2c1089c8fca7b41c7d761330ed99
function test_val = test_evalin1 test_val = false; do_test_evalin1_subfunc; end function do_test_evalin1_subfunc evalin('caller','test_val = true'); evalin('caller','test_val = true','test_val=false'); end
github
aristofanio/freemat-master
test_if2.m
.m
freemat-master/FreeMat/tests/suite/test_if2.m
132
utf_8
0664ae2bed422703bc2dd4a923cd6fd6
% Test the if-else statement function test_val = test_if2 a = 1; test_val = 0; if (a == 0) test_val = 0; else test_val = 1; end
github
aristofanio/freemat-master
test_svd9.m
.m
freemat-master/FreeMat/tests/suite/test_svd9.m
1,023
utf_8
4869dbbf440ef765b54638fd17fb3282
% Test the compact version of the svd with float vectors function test_val = test_svd9 t1all = 1; p = []; for n=2:4:100 a = float(rand(n,2*n)); [u,s,v] = svd(a,0); emat = abs(a-u*s*v'); err = max(emat(:)); p(n) = err; bnd = 10*max(abs(diag(s)))*feps*n; t1 = (err < bnd); if (~t1) pr...
github
aristofanio/freemat-master
test_qr5.m
.m
freemat-master/FreeMat/tests/suite/test_qr5.m
517
utf_8
f06106208eb923b8a22ea52e1f79c386
% Test the QR decomposition (without pivoting, double) function test_val = test_qr5 a = [1,2,3;4,5,6;7,8,9;10,0,5]; % double precision [q,r] = qr(a); qorg = q'*q - diag(ones(1,4)); t1 = (max(abs(qorg(:)))<1e-15); t2 = ((size(q,1) == 4) & (size(q,2) == 4)); t3 = ((size(r,1) == 4) & (size(r,2) == 3)); aorg = q*r - a; t4 ...
github
aristofanio/freemat-master
test_eig1.m
.m
freemat-master/FreeMat/tests/suite/test_eig1.m
1,977
utf_8
7adab29fe784ee2b5b19d341327bef50
% Test eigenvalue function - general matrices function t = test_eig1 % First the float version t1all = 1; for i=2:4:100 a = float(randn(i)); [v,d] = eig(a); emat = a*v - v*d; er = max(abs(emat(:))); bnd = 100*max(diag(abs(d)))*feps*i; t1 = (er < bnd); if (~t1) printf('test failed: er = %e bnd = %e (num %...
github
aristofanio/freemat-master
test_matcat4.m
.m
freemat-master/FreeMat/tests/suite/test_matcat4.m
154
utf_8
80ea38cb14e845751750400ee756c692
% Check the type promotion for the matrix cat function function test_val = test_matcat4 a = [1,2;3.0f,4f+i]; test_val = test(strcmp(typeof(a),'single'));
github
aristofanio/freemat-master
test_strcmp1.m
.m
freemat-master/FreeMat/tests/suite/test_strcmp1.m
123
utf_8
254dfb0cf212f92a454054380723a292
% Check the strcmp function for a match function test_val = test_strcmp1 test_val = test(strcmp('complex','complex'));
github
aristofanio/freemat-master
test_builtin1.m
.m
freemat-master/FreeMat/tests/suite/test_builtin1.m
129
utf_8
9ce7e6516fd97e18b6b2f047588438d7
function test_val = test_builtin1 a = -1; b = builtin('abs',a); test_val = (b == 1); end function y = abs(x) y = x; end
github
aristofanio/freemat-master
test_save1.m
.m
freemat-master/FreeMat/tests/suite/test_save1.m
222
utf_8
e7834e3cd430d14706176927d08cfc88
% Test the save and load capability with cell arrays (bug 1581481) function test_val = test_save1 a{1} = 'bert'; a{2} = pi; a{3} = 12; a{4} = 4+5i; save tmp.mat a b = a; load tmp.mat test_val = issame(a,b);
github
aristofanio/freemat-master
test_size3.m
.m
freemat-master/FreeMat/tests/suite/test_size3.m
150
utf_8
a477184164b118bb8d8532b9239fb053
% Check the size function with two arguments and one output function test_val = test_size3 a = [1,2,3;4,5,6]; n = size(a,2); test_val = test(n == 3);
github
aristofanio/freemat-master
test_assign13.m
.m
freemat-master/FreeMat/tests/suite/test_assign13.m
131
utf_8
d03c63cb697eec755acc509190cca021
% Test for assignment of empties to an empty function test_val = test_assign13 A = []; A([],[],[]) = []; test_val = 1;
github
aristofanio/freemat-master
test_sparse69.m
.m
freemat-master/FreeMat/tests/suite/test_sparse69.m
433
utf_8
b4ce15112b9a18d0126cb0afeb2a0fdd
% Test the zeros function function x = test_sparse69 xi = int32(sparse(100,200)); yi = int32(zeros(100,200)); xf = float(sparse(100,200)); yf = float(zeros(100,200)); xd = double(sparse(100,200)); yd = double(zeros(100,200)); xc = complex(sparse(100,200)); yc = complex(zeros(100,200)); xz = dcomplex(sparse(100,200)); y...
github
aristofanio/freemat-master
test_fcall2.m
.m
freemat-master/FreeMat/tests/suite/test_fcall2.m
219
utf_8
36dd4c6241e1f05831bdc68ee4a5647c
% Check function declaration with two return args function test_val = test_fcall2 try [a,b] = fc2fuc(1,3,2); test_val = test(a == 4); catch test_val = 0; end function [a b] = fc2fuc(w,x,y) a = w+x; b = y;
github
aristofanio/freemat-master
test_diag2.m
.m
freemat-master/FreeMat/tests/suite/test_diag2.m
177
utf_8
729c659b6f91940f98b4b0dcdc564c0c
% Test the diagonal extraction function with a non-zero diagonal function test_val = test_diag2 a = [1,2,3,4;5,6,7,8;9,10,11,12]; b = diag(a,1); test_val = test(b == [2;7;12]);
github
aristofanio/freemat-master
test_fitfun2.m
.m
freemat-master/FreeMat/tests/suite/test_fitfun2.m
263
utf_8
c754a6c5f19b650059b922a145d9482e
% Test the nested fitfun bug (bug 1741350) function test_val = test_fitfun2 a = 2; b = 0; init = [a,b]; y = [1:100]; weights = y*0+1; tol = 1.e-08; junk = rand(100); [xopt,yopt] = fitfun('fitfunc_func1',init,y,weights,tol,junk); test_val = abs(xopt(1)-1) < 1e-6;
github
aristofanio/freemat-master
test_subset8.m
.m
freemat-master/FreeMat/tests/suite/test_subset8.m
247
utf_8
e5aa6f60b0896d9f4dfd40add0c65fe8
% Test the ndim subset with a cell-array vector function test_val = test_subset8 a = {1,2,3;4,5,6;7,8,9}; c = struct('foo',a); b = c(2,2:3); test_val = test(strcmp(typeof(b),'struct')) & ... test((b(1).foo == 5) & (b(2).foo == 6));
github
aristofanio/freemat-master
test_subset12.m
.m
freemat-master/FreeMat/tests/suite/test_subset12.m
145
utf_8
be14a68a18b661676cc24dd7b89a8dcc
% Test the ndim subset assign function function test_val = test_subset12 a = [1,2,3;4,5,6]; a(:,2) = [8,9]; test_val = test(a == [1,8,3;4,9,6]);
github
aristofanio/freemat-master
test_struct2.m
.m
freemat-master/FreeMat/tests/suite/test_struct2.m
216
utf_8
bd3f0c3dc082666952c3d339e103905c
% Test the ability to combine structues with different fields - when valid function test_val = test_struct2 a.foo = 1; a.goo = 2; b.goo = 5; c = [a,b]; test_val = (c(1).foo == 1) & (c(1).goo == 2) & (c(2).goo == 5);
github
aristofanio/freemat-master
test_subset16.m
.m
freemat-master/FreeMat/tests/suite/test_subset16.m
283
utf_8
153706c2a749c7ffffa89197e4086fd9
% Test the ndim contents-based assign for multiple values - with % too many outputs function test_val = test_subset16 a = {0,0;0,0}; test_val = 0; try [a{1:2,1:2}] = test_subset16_assist catch test_val = 1; end function [a,b,c] = test_subset16_assist a = 1; b = 2; c = 3;
github
aristofanio/freemat-master
test_subset17.m
.m
freemat-master/FreeMat/tests/suite/test_subset17.m
115
utf_8
a4908988b41dd3036a589af9670ff89a
% Test the subset assign with an empty variable function test_val = test_subset17 a = []; a(:) = []; test_val = 1;
github
aristofanio/freemat-master
test_matcat3.m
.m
freemat-master/FreeMat/tests/suite/test_matcat3.m
269
utf_8
e1e408880d7ff0718f5ee5fcf3414882
% Check the matcat function with n-dimensional arrays function test_val = test_matcat3 a = 1; a(1,1,1,1,1) = 1; a(1,2,1,1,1) = 2; a(1,1,1,1,2) = 5; a(1,2,1,1,2) = 6; c = [a;a]; c1 = c(:,:,1,1,1); c2 = c(:,:,1,1,2); test_val = test(c1==[1,2;1,2]) & test(c2==[5,6;5,6]);
github
aristofanio/freemat-master
test_assign16.m
.m
freemat-master/FreeMat/tests/suite/test_assign16.m
405
utf_8
2a62134e40d8e2a3e3377c0e852322ff
% Test for bug 1808557 - incorrect subset assignment with complex arrays function test_val = test_assign16 x = rand(4,2)+i*rand(4,2); y = rand(2,2)+i*rand(2,2); x(2:2:4,:)=y; z = x; for i=1:2; for j=1:2; z(2+(i-1)*2,j) = y(i,j); end end q = x; q(:,1) = y(:); p = [x,x]; p(1,:) ...
github
aristofanio/freemat-master
test_matcat7.m
.m
freemat-master/FreeMat/tests/suite/test_matcat7.m
225
utf_8
5722894102eb138e7af94c360185e765
% Check that matrix cat works properly with spaces before the continuation function test_val = test_matcat7 a = [1;2;... 3;4; ... 5;6]; b = [1, 2, 3, ... 4, 5, 6 ]; c=[1, 2, ... 3]; test_val = 1;
github
aristofanio/freemat-master
test_diag3.m
.m
freemat-master/FreeMat/tests/suite/test_diag3.m
126
utf_8
a279479a9e99d3c948ef57ab203eca66
% Test the diagonal creation function function test_val = test_diag3 a = [2,3]; b = diag(a); test_val = test(b == [2,0;0,3]);
github
aristofanio/freemat-master
test_vec1.m
.m
freemat-master/FreeMat/tests/suite/test_vec1.m
123
utf_8
283bd26b20e9ccfb119070eacbaeca46
% Check the case of continuation with vectors function test_val = test_vec1 a = [1 2 3 4... 5 6 7 8]; test_val = 1;
github
aristofanio/freemat-master
test_subset14.m
.m
freemat-master/FreeMat/tests/suite/test_subset14.m
328
utf_8
b5078933442a1a70c6e4607eade16526
% Test the vector contents-based assign for multiple values function test_val = test_subset14 a = {0,0,0,0}; [a{1:4}] = test_subset14_assist; test_val = test(strcmp(typeof(a),'cell')) & ... (a{1} == 1) & (a{2} == 2) & (a{3} == 3) & (a{4} == 4); function [a,b,c,d] = test_subset14_assist a = 1; b = 2; c = 3; ...
github
aristofanio/freemat-master
test_sparse62.m
.m
freemat-master/FreeMat/tests/suite/test_sparse62.m
1,323
utf_8
a587db394b80100c2f7e4fa79dacb378
% Test sparse matrix array constructor function x = test_sparse62 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); [yi2,zi2] = sparse...
github
aristofanio/freemat-master
test_call2.m
.m
freemat-master/FreeMat/tests/suite/test_call2.m
259
utf_8
982e17ad63e09c980ebea1a384ac977c
% test the multiple left-hand side call with a pre-existing cell-array function test_val = test_call2 [d1{1:3}] = test_call2_assist; test_val = test(d1{1} == 1) & test(d1{2} == 4) & test(d1{3} == 3); function [a,b,c] = test_call2_assist a = 1; b = 4; c = 3;
github
aristofanio/freemat-master
test_det1.m
.m
freemat-master/FreeMat/tests/suite/test_det1.m
127
utf_8
c642060d6dfee6f8769f62ab53002c9d
% Test the determinant calculation (bug 1584651) function test_val = test_det1 A = [1 2 3 4]; test_val = (det(A) == -2)
github
aristofanio/freemat-master
test_sparse56.m
.m
freemat-master/FreeMat/tests/suite/test_sparse56.m
361
utf_8
23598d7930bdc3b5e08445004baa02da
% Test DeleteSparseMatrix function function x = test_sparse56 xi = sparse_test_mat('int32',100); xf = sparse_test_mat('float',100); xd = sparse_test_mat('double',100); xc = sparse_test_mat('complex',100); xz = sparse_test_mat('dcomplex',100); xi = []; xf = []; xd = []; xc = []; xz = []; x = isempty(xi) & isempty(xf) & ...
github
aristofanio/freemat-master
test_test2.m
.m
freemat-master/FreeMat/tests/suite/test_test2.m
114
utf_8
d803cfec571d2d0334a46abee49d7cc9
% Check that test function works properly for a scalar 0 function test_val = test_test2 test_val = test(0) == 0;
github
aristofanio/freemat-master
test_sparse63.m
.m
freemat-master/FreeMat/tests/suite/test_sparse63.m
843
utf_8
27ff259ab36229288350e3c35b8fc78e
% Test sparse matrix array vector-subset extraction function x = test_sparse63 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); ndx =...
github
aristofanio/freemat-master
test_sparse59.m
.m
freemat-master/FreeMat/tests/suite/test_sparse59.m
706
utf_8
5edade90cf13f4d5beed3567bad21f46
% Test sparse-dense matrix multiplication function x = test_sparse59 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); [yi2,zi2] = spa...
github
aristofanio/freemat-master
test_struct5.m
.m
freemat-master/FreeMat/tests/suite/test_struct5.m
236
utf_8
327a51b23cdd83e32e6db98df52f7741
% Test the field dereference as an expression list function test_val = test_struct5 a = struct('foo',{5,8,10}); sm = test_struct5_assist(a.foo); test_val = test(sm == 23); function a = test_struct5_assist(b,c,d) a = b + c + d;
github
aristofanio/freemat-master
test_svd10.m
.m
freemat-master/FreeMat/tests/suite/test_svd10.m
1,087
utf_8
743dc8d72f12ef45c2cf4383f9dc39b4
% Test the compact version of the svd with complex vectors function test_val = test_svd10 t1all = 1; p = []; for n=2:4:100 a = float(rand(n,2*n))+i*float(rand(n,2*n)); [u,s,v] = svd(a,0); emat = abs(a-u*s*v'); err = max(emat(:)); p(n) = err; bnd = 10*max(abs(diag(s)))*feps*n; t1 = (err...
github
aristofanio/freemat-master
test_subset15.m
.m
freemat-master/FreeMat/tests/suite/test_subset15.m
330
utf_8
447b7de8e839920b61ab815ceb5f70c4
% Test the ndim contents-based assign for multiple values function test_val = test_subset15 a = {0,0;0,0}; [a{1:2,1:2}] = test_subset15_assist; test_val = test(strcmp(typeof(a),'cell')) & ... (a{1} == 1) & (a{2} == 2) & (a{3} == 3) & (a{4} == 4); function [a,b,c,d] = test_subset15_assist a = 1; b = 2; c = 3;...
github
aristofanio/freemat-master
test_qr10.m
.m
freemat-master/FreeMat/tests/suite/test_qr10.m
1,370
utf_8
178f2bf0abdf34925cc07d971f792749
% Test the QR decomposition (compact, without pivoting) function test_val = test_qr10 t1all = 1; for n=2:4:100 a = float(rand(2*n,n)); [q,r] = qr(a,0); err = abs(a-q*r); err = max(err(:)); bnd = 10*max(abs(diag(r)))*feps*(n^(0.5)); t1 = (err < bnd); if (~t1) printf('test failed: er = %e ...
github
aristofanio/freemat-master
test_matcat1.m
.m
freemat-master/FreeMat/tests/suite/test_matcat1.m
132
utf_8
07cee4fb3ac1e7d8fe61ba24ebb53842
% Check the matcat function function test_val = test_matcat1 a = [1;2]; b = 3; d = 4; c = [a,[b;d]]; test_val = test(c==[1,3;2,4]);
github
aristofanio/freemat-master
test_sparse73.m
.m
freemat-master/FreeMat/tests/suite/test_sparse73.m
606
utf_8
738bec8f512641306606a2e602b8b98a
% Test sparse matrix array vector deletion function x = test_sparse73 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); ndxr = randi(o...
github
aristofanio/freemat-master
test_svd1.m
.m
freemat-master/FreeMat/tests/suite/test_svd1.m
448
utf_8
9d34492e8a7021db6b23bf44753ec000
% Test the svd with finite and infinite args (functional only) function test_val = test_svd1 a = [1,3;4,2]; [u,s,v] = svd(a); res1 = 1; res2 = 0; res3 = 0; res4 = 0; try c = a; c(2,2) = inf; svd(c); catch res2 = 1; end try c = a; c(2,2) = -inf; svd(c); catch res3 =...
github
aristofanio/freemat-master
test_assign14.m
.m
freemat-master/FreeMat/tests/suite/test_assign14.m
227
utf_8
174f6d7f2bde87175e7aa4a10eb9e5ff
% Test for auto sizing of assignment to undefined variables function test_val = test_assign14 r = [2,3;3,4]; a(2,:,:) = r; b = zeros(2,2,2); b(2,:,:) = r; test_val = all(a(:) == b(:)) && all(size(a) == size(b));
github
aristofanio/freemat-master
test_sparse66.m
.m
freemat-master/FreeMat/tests/suite/test_sparse66.m
878
utf_8
2248a1092753a19750a8b2977afabd82
% Test sparse matrix array ndim-subset assignment function x = test_sparse66 [yi1,zi1] = sparse_test_mat('int32',300,400); [yf1,zf1] = sparse_test_mat('float',300,400); [yd1,zd1] = sparse_test_mat('double',300,400); [yc1,zc1] = sparse_test_mat('complex',300,400); [yz1,zz1] = sparse_test_mat('dcomplex',300,400); ndxr = ...
github
aristofanio/freemat-master
test_typeof4.m
.m
freemat-master/FreeMat/tests/suite/test_typeof4.m
138
utf_8
2a8c01693a1e33813cbd50251437a4ad
% Check the typeof function for complex types function test_val = test_typeof4 a = 2.0f + i; test_val = test(strcmp(typeof(a),'single'));
github
aristofanio/freemat-master
test_subset2.m
.m
freemat-master/FreeMat/tests/suite/test_subset2.m
169
utf_8
142b71dfd9ff184ae07bd246e1814baf
% Test the vector subset operator in an error condition function test_val = test_subset2 a = [1,2,3,4]; b = [4,5,6]; test_val = 0; try c = a(b); catch test_val = 1; end
github
aristofanio/freemat-master
test_struct3.m
.m
freemat-master/FreeMat/tests/suite/test_struct3.m
247
utf_8
79c142b302cca6a89491b1822ab139ae
% Test the ability to add a new field name to a structure function test_val = test_struct3 a.foo = 1; a.goo = 2; c(1) = a; c(2) = a; c(1).hoo = 6; test_val = (c(1).foo == 1) & (c(2).foo == 1) & (c(1).goo == 2) & (c(2).goo == 2) & (c(1).hoo == 6);
github
aristofanio/freemat-master
test_nargin2.m
.m
freemat-master/FreeMat/tests/suite/test_nargin2.m
181
utf_8
04b03d3b69dffffcc5a6093ee243371d
function test_val = test_nargin2 test_val = (sub_test_nargin2(3) == 1) && (sub_test_nargin2(3,'h',1.34,pi,e) == 5); end function x = sub_test_nargin2(varargin) x = nargin; end
github
aristofanio/freemat-master
test_struct4.m
.m
freemat-master/FreeMat/tests/suite/test_struct4.m
282
utf_8
25ff1162737dd495d5c27a62980df3d1
% Test the structure constructor function test_val = test_struct4 a = struct('foo',4,'goo',{5},'hoo',{'time',8}); test_val = test(a(1).foo == 4) & test(a(2).foo == 4) ... & test(a(1).goo == 5) & test(a(2).goo == 5) ... & test(strcmp(a(1).hoo,'time')) & test(a(2).hoo == 8);
github
aristofanio/freemat-master
test_subset1.m
.m
freemat-master/FreeMat/tests/suite/test_subset1.m
142
utf_8
e4e2b30821d5a27cb7bc29fde3d6f886
% Test the vector subset operator function test_val = test_subset1 a = [1,2,3,4;5,6,7,8]; b = [3;4;5]; c = a(b); test_val = test(c==[2;6;3]);
github
aristofanio/freemat-master
test_if3.m
.m
freemat-master/FreeMat/tests/suite/test_if3.m
205
utf_8
5dad156a93725b52f4bcc59e6a8a66e8
% Test the if-elseif-else statement function test_val = test_if3 a = 1; test_val = 0; if (a == 0) test_val = 0; elseif (a == 3); test_val = 0; elseif (a == 1); test_val = 1; else test_val = 0; end
github
aristofanio/freemat-master
test_subset19.m
.m
freemat-master/FreeMat/tests/suite/test_subset19.m
240
utf_8
2ebd5feb268df52ec75fe18ef07f694a
% Torture test for subset indexing function test_val = test_subset19 a1 = 5; A{3}(2).foo(2) = a1; test_val = test(strcmp(typeof(A),'cell')) & ... test(strcmp(typeof(A{3}),'struct')) & ... test(strcmp(typeof(A{3}(2).foo),'double'));
github
aristofanio/freemat-master
test_if1.m
.m
freemat-master/FreeMat/tests/suite/test_if1.m
106
utf_8
0934bb127b9f764815104f116348926a
% Test the if statement function test_val = test_if1 a = 1; test_val = 0; if (a == 1) test_val = 1; end
github
aristofanio/freemat-master
test_feval1.m
.m
freemat-master/FreeMat/tests/suite/test_feval1.m
132
utf_8
2c215ce58b684126120c172dc5cefa29
function test_val = test_feval1 y = 0; test_val = feval('test_feval1_local_func',y); function z = test_feval1_local_func(x) z = 1;
github
aristofanio/freemat-master
test_subset4.m
.m
freemat-master/FreeMat/tests/suite/test_subset4.m
171
utf_8
7a132b4703bd95e369836711c6ba7d05
% Test the vector subset with a struct array function test_val = test_subset4 a = struct('foo',4,'goo',{1,2,3,4}); c = a(3); test_val = test((c.foo == 4) & (c.goo == 3));