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_subset18.m
.m
freemat-master/FreeMat/tests/variables/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_subset3.m
.m
freemat-master/FreeMat/tests/variables/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_matcat4.m
.m
freemat-master/FreeMat/tests/variables/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_subset8.m
.m
freemat-master/FreeMat/tests/variables/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/variables/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/variables/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/variables/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/variables/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/variables/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_matcat7.m
.m
freemat-master/FreeMat/tests/variables/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_vec1.m
.m
freemat-master/FreeMat/tests/variables/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/variables/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_struct5.m
.m
freemat-master/FreeMat/tests/variables/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_subset15.m
.m
freemat-master/FreeMat/tests/variables/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_matcat1.m
.m
freemat-master/FreeMat/tests/variables/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_subset2.m
.m
freemat-master/FreeMat/tests/variables/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/variables/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_struct4.m
.m
freemat-master/FreeMat/tests/variables/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/variables/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_subset19.m
.m
freemat-master/FreeMat/tests/variables/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_subset4.m
.m
freemat-master/FreeMat/tests/variables/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));
github
aristofanio/freemat-master
test_matcat8.m
.m
freemat-master/FreeMat/tests/variables/test_matcat8.m
92
utf_8
7a8a29e63204a61a9622793b9b2d8160
% Check that [1:0] is sane function test_val = test_matcat8 test_val = isa([1:0],'double');
github
aristofanio/freemat-master
test_subset10.m
.m
freemat-master/FreeMat/tests/variables/test_subset10.m
234
utf_8
f3eb737309699afdf82f38fbcd07c4ac
% Test the cell vector subset with contents-based addressing function test_val = test_subset10 a = {5,8;10,3}; sm = test_subset10_assist(a{2,1:2}); test_val = test(sm == 13); function a = test_subset10_assist(b,c) a = b + c;
github
aristofanio/freemat-master
test_struct8.m
.m
freemat-master/FreeMat/tests/variables/test_struct8.m
345
utf_8
75efd6e40d0feca1c1522794550bc6ba
% Test the structure field-based multiple assign in a function call function test_val = test_struct8 a = struct('foo',{0,0,0,0}); [a.foo] = test_struct8_assist; test_val = test(a(1).foo == 1) & test(a(2).foo == 2) & ... test(a(3).foo == 3) & test(a(4).foo == 4); function [a,b,c,d] = test_struct8_assist a = 1; ...
github
aristofanio/freemat-master
test_foo_1.m
.m
freemat-master/FreeMat/tests/class/test_foo_1.m
184
utf_8
9022f414d40134f54d5b900dc6582e9a
% Test the foo class -- it replicates bug 2949163 -- helpgen broken function testval = test_foo_1 testval = false; try a = foo; hop(a); testval = true; catch end
github
aristofanio/freemat-master
test_file1.m
.m
freemat-master/FreeMat/tests/io/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_imwrite_imread.m
.m
freemat-master/FreeMat/tests/io/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_save1.m
.m
freemat-master/FreeMat/tests/io/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_typeof2.m
.m
freemat-master/FreeMat/tests/suite/test_typeof2.m
132
utf_8
292b37f2828db1f115c2e4a253bd03d9
% Check the typeof function for double types function test_val = test_typeof2 a = 2.0; test_val = test(strcmp(typeof(a),'double'));
github
aristofanio/freemat-master
test_assign4.m
.m
freemat-master/FreeMat/tests/suite/test_assign4.m
164
utf_8
76cc9a2d4625395155f4755b5c68e657
% Test the assignment of a value to a cell array as an n-dim indexing function test_val = test_assign4 a = {1,2,3;4,5,6}; a{2,3} = -1; test_val = test(a{6} == -1);
github
aristofanio/freemat-master
test_sparse61.m
.m
freemat-master/FreeMat/tests/suite/test_sparse61.m
707
utf_8
b3079db9834ab66f7cb1cd09ce7e65c6
% Test sparse-sparse matrix multiplication function x = test_sparse61 [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] = sp...
github
aristofanio/freemat-master
test_switch5.m
.m
freemat-master/FreeMat/tests/suite/test_switch5.m
245
utf_8
e6210a9612f77bef5cf5430b466326f7
% Test the switch statement with a numerical argument function test_val = test_switch5 x = 1.2f; test_val = 0; switch x case 1 test_val = 0; case 1.1f test_val = 0; case 1.2+i; test_val = 0; case 1.2; test_val = 0; case 1.2f; test_val = 1; end
github
aristofanio/freemat-master
test_size1.m
.m
freemat-master/FreeMat/tests/suite/test_size1.m
194
utf_8
f6cb1a92f343d2dd8307302b93ea587a
% Check the size function with an n-dim argument & one output function test_val = test_size1 a = []; a(3,7,2) = 1.0; c = size(a); test_val = test(c(1) == 3) & test(c(2) == 7) & test(c(3) == 2);
github
aristofanio/freemat-master
test_while3.m
.m
freemat-master/FreeMat/tests/suite/test_while3.m
206
utf_8
82de1f668b864b269d4f0c0b8dc2b8cd
% Test a simple 'while' statement with a continue clause function test_val = test_while3 sum = 0; i = 1; while (i < 10) sum = sum + i; if (i==5), break; end i = i + 1; end test_val = test(sum == 15);
github
aristofanio/freemat-master
test_assign8.m
.m
freemat-master/FreeMat/tests/suite/test_assign8.m
112
utf_8
e6f16057d818e10aa694efc9d530aa73
% Test the empty assignment for the empty array function test_val = test_assign8 a = []; test_val = isempty(a);
github
aristofanio/freemat-master
test_nargin1.m
.m
freemat-master/FreeMat/tests/suite/test_nargin1.m
187
utf_8
3fa02cd3e38a462223da5dc2359a12bf
function test_val = test_nargin1 test_val = (sub_test_nargin1(3) == 1) && (sub_test_nargin1(3,'h',1.34,pi,e) == 5); end function x = sub_test_nargin1(a1,a2,a3,a4,a5) x = nargin; end
github
aristofanio/freemat-master
test_test5.m
.m
freemat-master/FreeMat/tests/suite/test_test5.m
155
utf_8
a09138a349b48194acc624690c02cf38
% Check that test function throws an error when not given an argument function test_val = test_test5 test_val = 0; try test; catch test_val = 1; end
github
aristofanio/freemat-master
test_svd3.m
.m
freemat-master/FreeMat/tests/suite/test_svd3.m
457
utf_8
5dff97a850d539307f06706c938650fd
% Test the svd with finite and infinite args (functional only) function test_val = test_svd3 a = complex([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_qr4.m
.m
freemat-master/FreeMat/tests/suite/test_qr4.m
530
utf_8
60c8c4aa3bf5f68ac5c77ac65cab233a
% Test the QR decomposition (without pivoting, minimal decomposition, dcomplex) function test_val = test_qr4 a = double([1,2,3;4,5,6;7,8,9;10,0,5]); a = a + i*(a-1); % float precision [q,r] = qr(a,0); qorg = q'*q - diag(ones(1,3)); t1 = (max(abs(qorg(:)))<1e-15); t2 = ((size(q,1) == 4) & (size(q,2) == 3)); t3 = ((size(...
github
aristofanio/freemat-master
test_test1.m
.m
freemat-master/FreeMat/tests/suite/test_test1.m
113
utf_8
6b96d87c03dc71835bec874a69d02900
% Check that test function works properly for a scalar 1 function test_val = test_test1 test_val = test(1) == 1;
github
aristofanio/freemat-master
test_qr12.m
.m
freemat-master/FreeMat/tests/suite/test_qr12.m
1,359
utf_8
5a6e3d85d8d10b36458ebbdd7226f6c8
% Test the QR decomposition (full, pivoting) function test_val = test_qr12 t1all = 1; for n=2:4:100 a = float(rand(n,n)); [q,r,e] = qr(a); err = abs(a-q*r*e'); err = max(err(:)); bnd = 10*max(abs(diag(r)))*feps*(n^(0.5)); t1 = (err < bnd); if (~t1) printf('test failed: er = %e bnd = %e (...
github
aristofanio/freemat-master
test_strcmp2.m
.m
freemat-master/FreeMat/tests/suite/test_strcmp2.m
124
utf_8
18224d937b17e9564a7af8453a0a1d57
% Check the strcmp function for a match function test_val = test_strcmp2 test_val = test(~strcmp('dasdfas','complex'));
github
aristofanio/freemat-master
test_assign2.m
.m
freemat-master/FreeMat/tests/suite/test_assign2.m
176
utf_8
f5e22edb86a634c945918fbd77f3e1cf
% Test the assignment of a value to a cell array as a vector-contents. function test_val = test_assign2 a = {1,2,3,4,5}; test_val = 0; try a{5:6} = -1; catch test_val = 1; end
github
aristofanio/freemat-master
test_subset13.m
.m
freemat-master/FreeMat/tests/suite/test_subset13.m
160
utf_8
354d4a0ebb0f4c7d3a17278ae247af9d
% Test the ndim subset contents-based assign function function test_val = test_subset13 a = {1,2,3;4,5,6}; a{4} = 'goo'; test_val = test(strcmp(a{2,2},'goo'));
github
aristofanio/freemat-master
test_switch2.m
.m
freemat-master/FreeMat/tests/suite/test_switch2.m
305
utf_8
261ee1f2e5bbfd5eddf9b06c00fb1221
% Test the switch statement with a string argument and one integer case % The type mismatch should not present a problem. function test_val = test_switch2 test_val = 0; x = 'astring'; switch x case 30 test_val = 0; case 'astring'; test_val = 1; case 'cstring'; test_val = 0; otherwise test_val = 0; end
github
aristofanio/freemat-master
test_test4.m
.m
freemat-master/FreeMat/tests/suite/test_test4.m
134
utf_8
73bde63ba68f68a76a9f5fd31b4bc7b8
% Check that test function works properly for a vector with one zero function test_val = test_test4 test_val = test([1,0,1,1]) == 0;
github
aristofanio/freemat-master
test_range4.m
.m
freemat-master/FreeMat/tests/suite/test_range4.m
198
utf_8
4d3ec0a36c2518ba708b23ee4df356cf
% Check the range function for double types with 3 args & vertical concatenation function test_val = test_range4 range = 0.45:3.45; range2 = [0.45,1.45,2.45,3.45]; test_val = test(range == range2);
github
aristofanio/freemat-master
test_struct6.m
.m
freemat-master/FreeMat/tests/suite/test_struct6.m
185
utf_8
4500af9d260b78685190004adb6bdf96
% Test the field set function with a scalar argument function test_val = test_struct6 a = struct('foo',5,'color','blue'); a.color = 'red'; test_val = test(strcmp(a.color,'red'));
github
aristofanio/freemat-master
test_sparse79.m
.m
freemat-master/FreeMat/tests/suite/test_sparse79.m
675
utf_8
94e3b9595032563462c5ef2c5fe60bb9
% Test sparse-sparse matrix array subtract function x = test_sparse79 [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] = sp...
github
aristofanio/freemat-master
test_lu2.m
.m
freemat-master/FreeMat/tests/suite/test_lu2.m
602
utf_8
8d9b1b1419ac3054c6e0dbb33d726577
% Test the LU decomposition with 3 argument return for full matrices function x = test_lu2 A = float(randn(20)); [L,U,P] = lu(A); x = testeq(100,L*U,P*A); A = double(randn(20)); [L,U,P] = lu(A); x = x & testeq(100,L*U,P*A); A = complex(randn(20)+i*randn(20)); [L,U,P] = lu(A); x = x & testeq(100,L*U,P*A); A = dcomplex(r...
github
aristofanio/freemat-master
test_struct7.m
.m
freemat-master/FreeMat/tests/suite/test_struct7.m
199
utf_8
ba42240ad856f64a962d8c4fbe3d2d6a
% Test the field set function with a vector argument function test_val = test_struct7 a = struct('foo',{6,5,3},'color','blue'); test_val = 0; try a.foo = 7; catch test_val = 1; end
github
aristofanio/freemat-master
test_global1.m
.m
freemat-master/FreeMat/tests/suite/test_global1.m
293
utf_8
28013db887196f0369226f47b068a7f7
function test_val = test_global1 accum = 0; for (i=1:10) accum = accum + test_global1_assist; end test_val = test(accum == 55); function tick = test_global1_assist global count_test_global1_assist count_test_global1_assist = count_test_global1_assist + 1; tick = count_test_global1_assist;
github
aristofanio/freemat-master
test_persistent1.m
.m
freemat-master/FreeMat/tests/suite/test_persistent1.m
273
utf_8
ee2a29b15211b52120bfb8dac8c716b2
% Test the persistent variable declaration function test_val = test_persistent1 accum = 0; for (i=1:10) accum = accum + test_persistent1_assist; end test_val = test(accum == 55); function tick = test_persistent1_assist persistent count; count = count + 1; tick = count;
github
aristofanio/freemat-master
test_eig4.m
.m
freemat-master/FreeMat/tests/suite/test_eig4.m
2,131
utf_8
7f583d6b400f4735ab8bbc8d4a385b82
% Test generalized eigenvalue function - general matrices function t = test_eig4 % First the float version t1all = 1; for i=2:4:100 a = float(randn(i)); b = float(randn(i)); [v,d] = eig(a,b); emat = a*v - b*v*d; er = max(abs(emat(:))); bnd = 8*max(diag(abs(d)))*feps*i; t1 = (er < bnd); if (~t1) print...
github
aristofanio/freemat-master
test_qr2.m
.m
freemat-master/FreeMat/tests/suite/test_qr2.m
507
utf_8
252cbbd681b6b21562c45ae0e7dd9a68
% Test the QR decomposition (without pivoting, minimal decomposition, float) function test_val = test_qr2 a = float([1,2,3;4,5,6;7,8,9;10,0,5]); % float precision [q,r] = qr(a,0); qorg = q'*q - diag(ones(1,3)); t1 = (max(abs(qorg(:)))<1e-6); t2 = ((size(q,1) == 4) & (size(q,2) == 3)); t3 = ((size(r,1) == 3) & (size(r,2...
github
aristofanio/freemat-master
test_eig3.m
.m
freemat-master/FreeMat/tests/suite/test_eig3.m
244
utf_8
1f4589a38b15782b607849f6d04ab65a
% Test the 'nobalance' option for eig function t = test_eig3 B = [3,-2,-.9,2*eps;-2,4,1,-eps;-eps/4,eps/2,-1,0;-.5,-.5,.1,1]; [VN,DN] = eig(B,'nobalance'); er = B*VN - VN*DN; er = max(abs(er(:))); bnd = 1.2*max(diag(DN))*eps*8; t = (er < bnd);
github
aristofanio/freemat-master
test_sparse76.m
.m
freemat-master/FreeMat/tests/suite/test_sparse76.m
404
utf_8
40afab1d1b5ecf6b2f27c91d35ae0fff
% Test sparse matrix array hermitian function x = test_sparse76 [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 = testeq(yi1',zi1...
github
aristofanio/freemat-master
test_matcat5.m
.m
freemat-master/FreeMat/tests/suite/test_matcat5.m
154
utf_8
adddb516d47b506362c20e3bfe878c56
% Check the type promotion for the matrix cat function function test_val = test_matcat5 a = [1,2;3.0,4.0+i]; test_val = test(strcmp(typeof(a),'double'));
github
aristofanio/freemat-master
test_sparse57.m
.m
freemat-master/FreeMat/tests/suite/test_sparse57.m
377
utf_8
e063289125df11b10df4cd6d14da06ff
% Test makeDenseArray function function x = test_sparse57 [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); x = testeq(full(yi),zi) & testeq(full(yf),zf) & testeq(f...
github
aristofanio/freemat-master
test_eig5.m
.m
freemat-master/FreeMat/tests/suite/test_eig5.m
2,251
utf_8
c50701251fa43e825c36515ef73c44ad
% Test generalized eigenvalue function - symmetric matrices function t = test_eig5 % First the float version t1all = 1; for i=2:4:100 a = float(randn(i)); a = a + a'; b = float(randn(i)); b = b*b'; [v,d] = eig(a,b); emat = a*v - b*v*d; er = max(abs(emat(:))); bnd = 10*max(abs(eig(b)))*max(diag(abs(d)))*fep...
github
aristofanio/freemat-master
test_svd11.m
.m
freemat-master/FreeMat/tests/suite/test_svd11.m
1,019
utf_8
9d16fc3f96cc0fdf784505747fa2d7f3
% Test the compact version of the svd with double vectors function test_val = test_svd11 t1all = 1; p = []; for n=2:100 a = 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 < bnd); if (~t1) pr...
github
aristofanio/freemat-master
test_qr3.m
.m
freemat-master/FreeMat/tests/suite/test_qr3.m
526
utf_8
ffe907ff85397e78a0bff4a98c6f256e
% Test the QR decomposition (without pivoting, minimal decomposition, complex) function test_val = test_qr3 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,0); qorg = q'*q - diag(ones(1,3)); t1 = (max(abs(qorg(:)))<1e-6); t2 = ((size(q,1) == 4) & (size(q,2) == 3)); t3 = ((size(r,1...
github
aristofanio/freemat-master
test_if4.m
.m
freemat-master/FreeMat/tests/suite/test_if4.m
116
utf_8
742d81b5b6734b62252b771b7f709f12
% test the partially true args function test_val = test_if4 if ([0,1,1,0]) test_val = 0; else test_val = 1; end
github
aristofanio/freemat-master
test_assign12.m
.m
freemat-master/FreeMat/tests/suite/test_assign12.m
226
utf_8
f347a92cc43af449a5c7a7e4fd9c9a6a
% Test for column assignment bug with complex arrays function test_val = test_assign12 A = [1+i 3-i 5+3i 7-i 8+9i 6+i 9 8-i 5i]; B = A; A(:,2) = 0; B(1:3,2) = 0; test_val = all(A==B);
github
aristofanio/freemat-master
test_sparse71.m
.m
freemat-master/FreeMat/tests/suite/test_sparse71.m
622
utf_8
c0eeee28b40b070235d08e7e8381d1a9
% Test sparse matrix array column deletion function x = test_sparse71 [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); ndxc = randi(o...
github
aristofanio/freemat-master
test_matcat6.m
.m
freemat-master/FreeMat/tests/suite/test_matcat6.m
156
utf_8
fbb675c2cd02b016892f9e4ea03958f3
% Check the type promotion for the matrix cat function function test_val = test_matcat6 a = [1,2;3.0f,4.0f+i]; test_val = test(strcmp(typeof(a),'single'));
github
aristofanio/freemat-master
test_range7.m
.m
freemat-master/FreeMat/tests/suite/test_range7.m
162
utf_8
0065baeb78c79cc797ceee7053900df3
% Check the range function with a negative step size function test_val = test_range7 range = 3:-1:-2; range2 = [3,2,1,0,-1,-2]; test_val = test(range == range2);
github
aristofanio/freemat-master
test_range9.m
.m
freemat-master/FreeMat/tests/suite/test_range9.m
119
utf_8
eedf572c8b063125d94fbb8621ee7075
% Check the range function with an empty range function test_val = test_range9 range = 3:2; test_val = isempty(range);
github
aristofanio/freemat-master
test_sparse77.m
.m
freemat-master/FreeMat/tests/suite/test_sparse77.m
413
utf_8
bef70f0b7e3ad0aa56aa8aab3a2fc05f
% Test sparse matrix array transpose function x = test_sparse77 [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 = testeq(yi1.',zi1...
github
aristofanio/freemat-master
test_assignin1.m
.m
freemat-master/FreeMat/tests/suite/test_assignin1.m
166
utf_8
c0981131fab0725e3f6f10378045897a
function test_val = test_assignin1 test_val = false; do_test_assignin1_subfunc; end function do_test_assignin1_subfunc assignin('caller','test_val',true); end
github
aristofanio/freemat-master
test_call4.m
.m
freemat-master/FreeMat/tests/suite/test_call4.m
175
utf_8
6a5803df711f5117d4f14ca876c014fa
% test calls with pass-by-reference function test_val = test_call4 d1.foo = 3; test_call4_assist(d1.foo); test_val = test(d1.foo == 1); function test_call4_assist(&x) x = 1;
github
aristofanio/freemat-master
test_while2.m
.m
freemat-master/FreeMat/tests/suite/test_while2.m
226
utf_8
88b8aaa82630c01cf83c6b1ad050b934
% Test a simple 'while' statement with a continue clause function test_val = test_while2 sum = 0; i = 0; while (i < 10) i = i + 1; sum = sum + i; if (i==5), continue; end sum = sum - 1; end test_val = test(sum == 46);
github
aristofanio/freemat-master
test_subset5.m
.m
freemat-master/FreeMat/tests/suite/test_subset5.m
202
utf_8
cd500dbf9fd31d8a90c1770a6922b00c
% Test the vector subset with cell array without contents-based addressing function test_val = test_subset5 a = {1,2,3,4;5,6,7,8}; b = a(2); test_val = test(strcmp(typeof(b),'cell')) & test(b{1} == 5);
github
aristofanio/freemat-master
test_range3.m
.m
freemat-master/FreeMat/tests/suite/test_range3.m
194
utf_8
9c584f590e07e3cc7ed2c28a76724cea
% Check the range function for float types with 2 args & horizontal concatenation function test_val = test_range3 range = 0.2f:2.2f; range2 = [0.2f,1.2f,2.2f]; test_val = test(range == range2);
github
aristofanio/freemat-master
test_for2.m
.m
freemat-master/FreeMat/tests/suite/test_for2.m
198
utf_8
04e186bea600b0f1f350b74d45654ad7
% Test a simple 'for' statement with a continue clause function test_val = test_for2 sum = 0; for i = 1:10; sum = sum + i; if (i==5), continue; end sum = sum - 1; end test_val = test(sum == 46);
github
aristofanio/freemat-master
test_assign5.m
.m
freemat-master/FreeMat/tests/suite/test_assign5.m
145
utf_8
2b47aa64285210b4ef17924689bc540c
% Test the field assignment with a scalar struct function test_val = test_assign5 a = struct('foo',5); a.foo = -1; test_val = test(a.foo == -1);
github
aristofanio/freemat-master
test_for4.m
.m
freemat-master/FreeMat/tests/suite/test_for4.m
238
utf_8
37a7114f8853271b8b61e7124ff46906
% Test a simple 'for' statement with a return clause function test_val = test_for4 tval = test_for4_assist; test_val = test(tval == 15); function sum = test_for4_assist sum = 0; for i = 1:10; sum = sum + i; if (i==5), return; end; end
github
aristofanio/freemat-master
test_continue1.m
.m
freemat-master/FreeMat/tests/suite/test_continue1.m
193
utf_8
5d47709e9aff9db51e028001486821ff
% Test the continuation character with white space after it (bug 1642992) function test_val = test_continue1 test_val = ... % This should be ignored ... % So should this 1;
github
aristofanio/freemat-master
test_subset7.m
.m
freemat-master/FreeMat/tests/suite/test_subset7.m
197
utf_8
2a33351072d3e0e77baa5bdb7e26268a
% Test the ndim subset with a cell-array vector function test_val = test_subset7 a = {1,2,3;4,5,6;7,8,9}; b = a(2,2:3); test_val = test(strcmp(typeof(b),'cell')) & test((b{1} == 5) & (b{2} == 6));
github
aristofanio/freemat-master
test_exist1.m
.m
freemat-master/FreeMat/tests/suite/test_exist1.m
171
utf_8
06f2816c6456e508232bad8e2a9514c2
function x = test_exist1 x = test_exist1_assist; x = test_exist1_assist; function y = test_exist1_assist persistent x if (exist('x')) y = 1; else y = 0; x = 1; end
github
aristofanio/freemat-master
test_fcall1.m
.m
freemat-master/FreeMat/tests/suite/test_fcall1.m
230
utf_8
048dc11472459830b7164b5dd673115d
% Check to RHS function calls with multiple return values (b989865) function test_val = test_fcall1 try b = 1:10; B = addthem(min(b),max(b)); test_val = test(B == 11); catch test_val = 0; end function c = addthem(a,b) c = a + b;
github
aristofanio/freemat-master
test_subset11.m
.m
freemat-master/FreeMat/tests/suite/test_subset11.m
147
utf_8
8249b4a7aff4c521ccc6d18e1dead23e
% Test the vector subset assign function function test_val = test_subset11 a = [1,2,3;4,5,6]; a(3:4) = [8,9]; test_val = test(a == [1,8,3;4,9,6]);
github
aristofanio/freemat-master
test_fitfun3.m
.m
freemat-master/FreeMat/tests/suite/test_fitfun3.m
212
utf_8
6ad0e59f4ebf397c9eacb927c350c94b
% Test the fitfun with a local function function test_val = test_fitfun3 O = 3/4*pi; y0 = cos(O); [x y] = fitfun(@locos,3.5/4*pi,y0,1,0.0001); test_val = abs((x-O)/O*100)<.1; function y = locos(x) y = cos(x);
github
aristofanio/freemat-master
test_assign9.m
.m
freemat-master/FreeMat/tests/suite/test_assign9.m
109
utf_8
796c02db3a0415888dd2413567aff76f
% Test for reassign bug in repmat function t = test_assign9 a = {1,2,3}; b = repmat(a,2); b = 'good'; t = 1;
github
aristofanio/freemat-master
test_sparse67.m
.m
freemat-master/FreeMat/tests/suite/test_sparse67.m
496
utf_8
6ee0f22e1b3d70da81bae79d7c229a5b
% Test sparse matrix individual element retrieval function x = test_sparse67 [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 = tes...
github
aristofanio/freemat-master
test_for1.m
.m
freemat-master/FreeMat/tests/suite/test_for1.m
133
utf_8
c5c4f14f7d1dd74528a89fd837c7a4a3
% Test a simple 'for' statement function test_val = test_for1 sum = 0; for i = 1:10; sum = sum + i; end test_val = test(sum == 55);
github
aristofanio/freemat-master
test_qr11.m
.m
freemat-master/FreeMat/tests/suite/test_qr11.m
1,678
utf_8
b1801b7ef9dbaed4624ffc53dba883af
% Test the QR decomposition (compact, pivoting) function test_val = test_qr11 t1all = 1; for n=2:4:100 a = float(rand(2*n,n)); [q,r,ec] = qr(a,0); e = zeros(n,n); p = 0:(n-1); mdx = ec + p*n; e(mdx) = 1; err = abs(a-q*r*e'); err = max(err(:)); bnd = 10*max(abs(diag(r)))*feps*(n^(...
github
aristofanio/freemat-master
test_subset6.m
.m
freemat-master/FreeMat/tests/suite/test_subset6.m
159
utf_8
5c50f8e33a92d845f973bd5316a11b59
% Test the ndim subset with a regular vector function test_val = test_subset6 a = [1,2,3;4,5,6;7,8,9]; b = a(1:2,2:3); c = [2,3;5,6]; test_val = test(b == c);
github
aristofanio/freemat-master
test_struct1.m
.m
freemat-master/FreeMat/tests/suite/test_struct1.m
254
utf_8
65396fee2d186d6f48aaaabeb3aeb8ae
% Test the ability to combine structures with different ordering in their elements. function test_val = test_struct1 a.foo = 1; a.goo = 2; b.goo = 5; b.foo = 4; c = [a,b]; test_val = (c(1).foo == 1) & (c(2).foo == 4) & (c(1).goo == 2) & (c(2).foo == 4);
github
aristofanio/freemat-master
test_assign11.m
.m
freemat-master/FreeMat/tests/suite/test_assign11.m
151
utf_8
1ff8ebbcdd52670d0d4ca62089a4d4ea
% Test for multiple assign with arrays function test_val = test_assign11 a = zeros(3,4); [b(1), b(2)] = size(a); test_val = (b(1) == 3) & (b(2) == 4);
github
aristofanio/freemat-master
test_diag1.m
.m
freemat-master/FreeMat/tests/suite/test_diag1.m
150
utf_8
867d403ed4ff55ffea2d44582aec9d45
% Test the diagonal extraction function function test_val = test_diag1 a = [1,2,3,4;5,6,7,8;9,10,11,12]; b = diag(a); test_val = test(b == [1;6;11]);
github
aristofanio/freemat-master
test_sparse82.m
.m
freemat-master/FreeMat/tests/suite/test_sparse82.m
407
utf_8
266a74fc2c56a9f5f6300d17f4a43781
% Test sparse-sparse matrix array solution function x = test_sparse82 [yd1,zd1] = sparse_test_mat('double',100,100); [yz1,zz1] = sparse_test_mat('dcomplex',100,100); [yd2,zd2] = sparse_test_mat('double',100,60); [yz2,zz2] = sparse_test_mat('dcomplex',100,60); x = testeq3(yd1\yd2,zd1\zd2) & testeq3(yz1\yz2,zz1\zz2); fu...
github
aristofanio/freemat-master
test_switch6.m
.m
freemat-master/FreeMat/tests/suite/test_switch6.m
272
utf_8
0e396e3632bdb175752dca6d9f3b61b8
% Test the switch statement with a string argument and a cell array function test_val = test_switch6 test_val = 0; x = 'astring'; switch x case 'bstring' test_val = 0; case {'dstring',5,'astring'}; test_val = 1; case 'cstring'; test_val = 0; otherwise test_val = 0; end
github
aristofanio/freemat-master
test_svd4.m
.m
freemat-master/FreeMat/tests/suite/test_svd4.m
458
utf_8
5e771f140208bbdc63bca5b765a90f76
% Test the svd with finite and infinite args (functional only) function test_val = test_svd4 a = dcomplex([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_matcat2.m
.m
freemat-master/FreeMat/tests/suite/test_matcat2.m
245
utf_8
0293e650b286443ded2a229ed51576ac
% Check the matcat function with n-dimensional arrays function test_val = test_matcat2 a = 1; a(1,1,1) = 1; a(1,2,1) = 2; a(1,1,2) = 5; a(1,2,2) = 6; c = [a;a]; c1 = c(:,:,1); c2 = c(:,:,2); test_val = test(c1==[1,2;1,2]) & test(c2==[5,6;5,6]);
github
aristofanio/freemat-master
test_diag4.m
.m
freemat-master/FreeMat/tests/suite/test_diag4.m
164
utf_8
2dd01d89b9c4a2fed6021f46f27427aa
% Test the diagonal creation function with a non-zero diagonal function test_val = test_diag4 a = [2,3]; b = diag(a,-1); test_val = test(b == [0,0,0;2,0,0;0,3,0]);
github
aristofanio/freemat-master
test_sparse65.m
.m
freemat-master/FreeMat/tests/suite/test_sparse65.m
1,097
utf_8
d1e723bddc0a07a8d48249584c1c5498
% Test sparse matrix array vector-subset assignment function x = test_sparse65 [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_sparse70.m
.m
freemat-master/FreeMat/tests/suite/test_sparse70.m
671
utf_8
127483fd74ed5f9acd5246277bf9d4e6
% Test sparse to IJV to sparse conversion function x = test_sparse70 [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...
github
aristofanio/freemat-master
test_switch4.m
.m
freemat-master/FreeMat/tests/suite/test_switch4.m
217
utf_8
a21ef161fad9396d156e00cd3f9d300d
% Test the switch statement with a vector argument (should be an error) function test_val = test_switch4 x = [1 1]; test_val = 0; try switch x case 1 test_val = 0; otherwise test_val = 0; end catch test_val = 1; end
github
aristofanio/freemat-master
test_assign10.m
.m
freemat-master/FreeMat/tests/suite/test_assign10.m
150
utf_8
3a8ee2812eba66ef09b1c1ebe470798c
% Test for multiple assign with structures function test_val = test_assign10 a = zeros(3,4); [m.x m.y] = size(a); test_val = (m.x == 3) & (m.y == 4);