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 | ishold.m | .m | freemat-master/FreeMat/toolbox/array/ishold.m | 148 | utf_8 | 9d340fb08d4d8ac539b2408845762214 | % DOCBLOCK handle_ishold
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function k = ishold
k = strcmp(get(gca,'nextplot'),'add');
|
github | aristofanio/freemat-master | squeeze.m | .m | freemat-master/FreeMat/toolbox/array/squeeze.m | 331 | utf_8 | fb00b4980ea392f47537f0edc895537a | % DOCBLOCK array_squeeze
% Copyright 2004-2005, 2006 Brian Yanoff, Dirk Beque
% Licensed under the GPL
function B = squeeze(A)
sz = size(A);
if (length(sz) == 2)
B = A;
return;
end
sz(find(sz==1)) = [];
if length(sz)==1
sz = [sz,1];
end
if length(sz)==0
sz = [1,1];
end
B = reshape(A,s... |
github | aristofanio/freemat-master | ind2sub.m | .m | freemat-master/FreeMat/toolbox/array/ind2sub.m | 1,228 | utf_8 | 006bcb11d4738fc8cd76a14b32548a36 | % DOCBLOCK elementary_ind2sub
% Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007 Paul Kienzle
% This file is part of Octave.
% Licensed under the GPL
function varargout = ind2sub (dims, ind)
if (nargin == 2)
if (isvector (dims) && all (round (dims) == dims))
if (isnumeric (ind) && all (round (ind) == ind)... |
github | aristofanio/freemat-master | isalpha.m | .m | freemat-master/FreeMat/toolbox/array/isalpha.m | 203 | utf_8 | 52ffd119969c0c8cc266b3b4b945c2cf | % DOCBLOCK string_isalpha
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function x = isalpha(s)
s = int32(string(s));
x = (((s >= 65 ) & (s <= 90)) | (s >= 97) & (s <= 122));
|
github | aristofanio/freemat-master | length.m | .m | freemat-master/FreeMat/toolbox/array/length.m | 179 | utf_8 | 28c0bc0fdf6061bc7bc9e2b5e3bbe12e | % DOCBLOCK inspection_length
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function len = length(x)
if (isempty(x))
len = 0;
else
len = max(size(x));
end
|
github | aristofanio/freemat-master | isspace.m | .m | freemat-master/FreeMat/toolbox/array/isspace.m | 183 | utf_8 | e0f54a6a7ce4d0baa7e09b34188cf2c7 | % DOCBLOCK string_isspace
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function x = isspace(s)
s = int32(string(s));
x = ((s >=9 ) & (s <= 13)) | (s == 32);
|
github | aristofanio/freemat-master | ismatrix.m | .m | freemat-master/FreeMat/toolbox/array/ismatrix.m | 147 | utf_8 | 5e7b2dc2e367a777d6ca68b91a170acc | % DOCBLOCK inspection_ismatrix
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = ismatrix(x)
y = (ndims(x)==2);
|
github | aristofanio/freemat-master | ndgrid.m | .m | freemat-master/FreeMat/toolbox/array/ndgrid.m | 997 | utf_8 | 6ebb885ec2bc66da47df821289de76bf | % DOCBLOCK array_ndgrid
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function varargout = ndgrid(varargin)
if (nargin == 0)
error('ndgrid requires at least one argument');
end
if (nargin == 1)
varargin = repmat(varargin,[1 max(nargout,2)]);
nargin = length(varargin);
end
if (nar... |
github | aristofanio/freemat-master | logspace.m | .m | freemat-master/FreeMat/toolbox/array/logspace.m | 350 | utf_8 | c33dea572261536c5803dcb04fd0af7a | % DOCBLOCK array_logspace
function y = logspace(a,b,count)
if (nargin < 2) | (nargout > 1)
error('wrong use (see help logspace)')
elseif (nargin < 3)
count = 50;
end
if (b == pi)
b = log10(b);
end
y = 10.^(a+(b-a)/(count-1)*(0:count-1));
if isinf(y(end))
warning('logspace: u... |
github | aristofanio/freemat-master | vertcat.m | .m | freemat-master/FreeMat/toolbox/array/vertcat.m | 239 | utf_8 | 76958fc5b76a4d6bc6b66f1d83a52c09 | % DOCBLOCK class_vertcat
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = vertcat(varargin)
if (nargin == 0)
y = [];
else
y = varargin{1};
for i=2:nargin
y = [y;varargin{i}];
end
end
|
github | aristofanio/freemat-master | flipdim.m | .m | freemat-master/FreeMat/toolbox/array/flipdim.m | 382 | utf_8 | f2d9b98a62f3672be0b56abc4e81233a | % DOCBLOCK array_flipdim
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function x = flipdim(y,n)
if (isempty(y)), x = y; return; end
szey = size(y);
ndim = prod(size(szey));
n = int32(n);
if (n<1 | n>ndim), x = y; return; end
d = {};
for k=1:ndim
if (k==n)
d{k} = szey(k):-1:1;
... |
github | aristofanio/freemat-master | cast.m | .m | freemat-master/FreeMat/toolbox/array/cast.m | 831 | utf_8 | 837a20c72be090ac0ca3f98dc87a5164 | % DOCBLOCK typecast_cast
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = cast(a,toclass)
switch(toclass)
case 'cell'
y = cell(a);
case 'struct'
y = struct(a);
case 'logical'
y = logical(a);
case 'uint8'
y = uint8(a);
case 'in... |
github | aristofanio/freemat-master | isinteger.m | .m | freemat-master/FreeMat/toolbox/array/isinteger.m | 214 | utf_8 | 258ee3b5fb70f87a13cb3772478100d0 | % DOCBLOCK array_isinteger
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function x = isinteger(y)
x = any(strcmp({'uint8','int8','uint16','int16','uint32','int32','uint64','int64'},class(y)));
|
github | aristofanio/freemat-master | subsref.m | .m | freemat-master/FreeMat/toolbox/array/subsref.m | 373 | utf_8 | 04fbf14691ce89ae4e23626a0e6cf0d2 | % DOCBLOCK array_subsref
% Copyright (c) 2007 Samit Basu
% Licensed under the GPL
function b = subsref(a,s)
for i=1:numel(s)
switch (s(i).type)
case '()'
a = a(s(i).subs{:});
case '{}'
a = a{s(i).subs{:}};
case '.'
a = a.(s(i).subs);
otherwise
error('illegal indexing struc... |
github | aristofanio/freemat-master | ndims.m | .m | freemat-master/FreeMat/toolbox/array/ndims.m | 135 | utf_8 | c0c39729271dd52f0e0106fcd6782c14 | % DOCBLOCK inspection_ndims
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function n = ndims(x)
n = length(size(x));
|
github | aristofanio/freemat-master | any.m | .m | freemat-master/FreeMat/toolbox/array/any.m | 592 | utf_8 | c2d536f095b36d47112041de0f8a322e | % DOCBLOCK elementary_any
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = any(A,dim)
if (nargin == 0)
error 'any function requires at least one argument'
end
A(isnan(A))=0;
if (nargin == 1)
if (isempty(A))
if (ndims(A) < 3)
y = false;
else
v = siz... |
github | aristofanio/freemat-master | getfield.m | .m | freemat-master/FreeMat/toolbox/array/getfield.m | 824 | utf_8 | d3fd9fe0440eb76e061456afed29a6f4 | % DOCBLOCK elementary_getfield
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = getfield(x,varargin)
if (isempty(varargin))
error('Need at least one additional input to getfield');
end
% Check for the simple case of a single field index
field = varargin{1};
if (length(varargin)==1 && isa(... |
github | aristofanio/freemat-master | isvector.m | .m | freemat-master/FreeMat/toolbox/array/isvector.m | 205 | utf_8 | 4f14a3f6a809171bfcf3a38fe36e84ad | % DOCBLOCK inspection_isvector
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = isvector(x)
s = size(x);
y = (prod(s) == (s(1)*s(2))) && ((s(1) == 1) || (s(2) == 1));
|
github | aristofanio/freemat-master | test.m | .m | freemat-master/FreeMat/toolbox/array/test.m | 128 | utf_8 | 688c09dafa0afc6c2ea0cc2a09178169 | % DOCBLOCK elementary_test
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = test(x)
y=all(x(:));
|
github | aristofanio/freemat-master | meshgrid.m | .m | freemat-master/FreeMat/toolbox/array/meshgrid.m | 555 | utf_8 | 35c62a435f1a75950344d1c59502fb49 | % DOCBLOCK array_meshgrid
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function [X,Y,Z] = meshgrid(x,y,z)
if (nargin == 0)
error('meshgrid requires at least one input argument');
end
if (nargin == 1)
X = repmat(x(:)',[numel(x),1]);
Y = X';
elseif (nargout == 2)
X = repmat(x(:)... |
github | aristofanio/freemat-master | isfield.m | .m | freemat-master/FreeMat/toolbox/array/isfield.m | 222 | utf_8 | a7aef355ce24752d4afb3f08084ed0ed | % DOCBLOCK inspection_isfield
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = isfield(x,field)
if (isa(x,'struct'))
y = any(strcmp(fieldnames(x),field));
else
y = logical(0);
end
|
github | aristofanio/freemat-master | iscell.m | .m | freemat-master/FreeMat/toolbox/array/iscell.m | 138 | utf_8 | d66b9ed08aa1cb6dab0f7af0dca4aaa6 | % DOCBLOCK inspection_iscell
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function x = iscell(y)
x = isa(y,'cell');
|
github | aristofanio/freemat-master | isinttype.m | .m | freemat-master/FreeMat/toolbox/array/isinttype.m | 78 | utf_8 | 9e3202f8f30efec0569be38504412e87 | % DOCBLOCK inspection_isinttype
function x = isinttype(y)
x = isinteger(y);
|
github | aristofanio/freemat-master | horzcat.m | .m | freemat-master/FreeMat/toolbox/array/horzcat.m | 141 | utf_8 | 5db1dc1afd9fc5a7c14b5eb35274debb | % DOCBLOCK class_horzcat
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = horzcat(varargin)
y = [varargin{:}];
|
github | aristofanio/freemat-master | linspace.m | .m | freemat-master/FreeMat/toolbox/array/linspace.m | 255 | utf_8 | 1fb75175fc500b22cfbc968d3cf5bae3 | % DOCBLOCK array_linspace
% Copyright (c) 2002, 2003 Samit Basu
% Licensed under the GPL
function y = linspace(a,b,len)
if (nargin < 3)
len = 100;
end
if (a == b)
y = a*ones(1,len);
else
y = a + ((0:(len-1))*(b-a)/(len-1));
end
|
github | aristofanio/freemat-master | ipermute.m | .m | freemat-master/FreeMat/toolbox/array/ipermute.m | 197 | utf_8 | 17ef0181c1655ef7e22c1d1f519d120d | % DOCBLOCK array_ipermute
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = ipermute(x,p)
iperm = zeros(1,length(p));
iperm(p) = 1:length(p);
y = permute(x,iperm);
|
github | aristofanio/freemat-master | maxdim.m | .m | freemat-master/FreeMat/toolbox/array/maxdim.m | 96 | utf_8 | b6339a4a7e813015a6db58e086ea0251 | % DOCBLOCK inspection_maxdim
function n = maxdim(x);
n = min(find(size(x) == max(size(x))));
|
github | aristofanio/freemat-master | nonzeros.m | .m | freemat-master/FreeMat/toolbox/array/nonzeros.m | 178 | utf_8 | a3c82b58ee085954843349687265102c | % DOCBLOCK array_nonzeros
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function x = nonzeros(y)
[i,j,x] = find(y);
x = cast(reshape(x,[numel(x),1]),class(y));
|
github | aristofanio/freemat-master | cat.m | .m | freemat-master/FreeMat/toolbox/array/cat.m | 2,127 | utf_8 | 7a765e566702be7942e956accea45ae6 | % DOCBLOCK class_cat
function ret = cat(varargin)
if nargin < 2
disp('Invalid use of cat. Correct usage is:')
help cat
retall
end
if nargin == 2
ret = varargin{2};
return
else
dim = varargin{1};
if ~isscalar(dim)
error('Dimension must... |
github | aristofanio/freemat-master | tjit26.m | .m | freemat-master/FreeMat/tests/jit/tjit26.m | 242 | utf_8 | 7d4b91b7e583f566e100408ce5a74d46 | function A = tjit26
A = zeros(1,10000);
for j=1:10
for i=1:10000;
A(i) = tjit_sum26(A(i),i);
A(i) = tjit_sum26(A(i),i);
end
end
function y = tjit_sum26(a,b)
y = a + tjit_double26(b);
function y = tjit_double26(a)
y = a*2;
|
github | aristofanio/freemat-master | test_typeof2.m | .m | freemat-master/FreeMat/tests/inspection/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_size1.m | .m | freemat-master/FreeMat/tests/inspection/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_exist1.m | .m | freemat-master/FreeMat/tests/inspection/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_typeof5.m | .m | freemat-master/FreeMat/tests/inspection/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_typeof3.m | .m | freemat-master/FreeMat/tests/inspection/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_size2.m | .m | freemat-master/FreeMat/tests/inspection/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_size4.m | .m | freemat-master/FreeMat/tests/inspection/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_empty.m | .m | freemat-master/FreeMat/tests/inspection/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/inspection/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_size3.m | .m | freemat-master/FreeMat/tests/inspection/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_typeof4.m | .m | freemat-master/FreeMat/tests/inspection/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_nargin1.m | .m | freemat-master/FreeMat/tests/functions/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_call4.m | .m | freemat-master/FreeMat/tests/functions/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_fcall1.m | .m | freemat-master/FreeMat/tests/functions/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_call1.m | .m | freemat-master/FreeMat/tests/functions/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_fptr1.m | .m | freemat-master/FreeMat/tests/functions/test_fptr1.m | 146 | utf_8 | 2b76529f757b0a631d6606b5900321ee | % Check function pointers that are members of structs (b3542238)
function test_val = test_fptr1
a.b = @cos;
test_val = issame(a.b(2.0),cos(2.0));
|
github | aristofanio/freemat-master | test_call3.m | .m | freemat-master/FreeMat/tests/functions/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_fcall2.m | .m | freemat-master/FreeMat/tests/functions/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_call2.m | .m | freemat-master/FreeMat/tests/functions/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_nargin2.m | .m | freemat-master/FreeMat/tests/functions/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 | euclidlength.m | .m | freemat-master/FreeMat/tests/functions/euclidlength.m | 106 | utf_8 | ad703cf022c82def9e4b422988b2c7bc | function y = foo(x,y)
square_me(x);
square_me(y);
y = sqrt(x+y);
function square_me(&t)
t = t^2;
|
github | aristofanio/freemat-master | bad3.m | .m | freemat-master/FreeMat/tests/parse/bad3.m | 48 | utf_8 | 6d2b66739da5db462d4466d80f330b87 | %
% check syntax error
%
function foo ( +
%
%
|
github | aristofanio/freemat-master | bad1.m | .m | freemat-master/FreeMat/tests/parse/bad1.m | 42 | utf_8 | 88b0fa5a461e240a7b1f99e15be4109e | %
% check syntax error
%
function +
%
%
|
github | aristofanio/freemat-master | bad4.m | .m | freemat-master/FreeMat/tests/parse/bad4.m | 52 | utf_8 | f9cbf5e1c8fc1ff5e1600735e651d605 | %
% check syntax error
%
function foo ( e ) +
%
%
|
github | aristofanio/freemat-master | bad8.m | .m | freemat-master/FreeMat/tests/parse/bad8.m | 56 | utf_8 | 6804bb4675d5c4e8a2cdb712490758b5 | %
% check syntax error
%
function [x] = a ( f ) +
%
%
|
github | aristofanio/freemat-master | bad6.m | .m | freemat-master/FreeMat/tests/parse/bad6.m | 50 | utf_8 | bb83a69941afdd92c0c8e4a32a3f32df | %
% check syntax error
%
function [x] = a +
%
%
|
github | aristofanio/freemat-master | bad2.m | .m | freemat-master/FreeMat/tests/parse/bad2.m | 46 | utf_8 | fdd63afe494c1a0bfb39900383b5a048 | %
% check syntax error
%
function foo +
%
%
|
github | aristofanio/freemat-master | bad5.m | .m | freemat-master/FreeMat/tests/parse/bad5.m | 46 | utf_8 | 18671f283de90356805a851c63f3667f | %
% check syntax error
%
function [x] +
%
%
|
github | aristofanio/freemat-master | bad7.m | .m | freemat-master/FreeMat/tests/parse/bad7.m | 54 | utf_8 | 295134402a01b069dd30dbada9b8bb85 | %
% check syntax error
%
function [x] = a ( for
%
%
|
github | aristofanio/freemat-master | test_switch5.m | .m | freemat-master/FreeMat/tests/flow/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_while3.m | .m | freemat-master/FreeMat/tests/flow/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_switch2.m | .m | freemat-master/FreeMat/tests/flow/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_if4.m | .m | freemat-master/FreeMat/tests/flow/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_while2.m | .m | freemat-master/FreeMat/tests/flow/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_for2.m | .m | freemat-master/FreeMat/tests/flow/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_for4.m | .m | freemat-master/FreeMat/tests/flow/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/flow/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_for1.m | .m | freemat-master/FreeMat/tests/flow/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_switch6.m | .m | freemat-master/FreeMat/tests/flow/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_switch4.m | .m | freemat-master/FreeMat/tests/flow/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_switch3.m | .m | freemat-master/FreeMat/tests/flow/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_switch1.m | .m | freemat-master/FreeMat/tests/flow/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_while1.m | .m | freemat-master/FreeMat/tests/flow/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_switch7.m | .m | freemat-master/FreeMat/tests/flow/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_if2.m | .m | freemat-master/FreeMat/tests/flow/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_if3.m | .m | freemat-master/FreeMat/tests/flow/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_if1.m | .m | freemat-master/FreeMat/tests/flow/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_for3.m | .m | freemat-master/FreeMat/tests/flow/test_for3.m | 180 | utf_8 | 20d4cc7d4c53cd9e47da21d1e13ba01c | % Test a simple 'for' statement with a continue clause
function test_val = test_for3
sum = 0;
for i = 1:10;
sum = sum + i;
if (i==5), break; end;
end
test_val = test(sum == 15);
|
github | aristofanio/freemat-master | test_switch8.m | .m | freemat-master/FreeMat/tests/flow/test_switch8.m | 181 | utf_8 | a973cdf47efaea6f648fcf66fc8425f2 | % Test the switch statement with a blank line after the switch clause
function test_val = test_switch8
v = '3';
switch(v)
case '3'
vv = 111;
end
test_val = 1;
|
github | aristofanio/freemat-master | test_assignin1.m | .m | freemat-master/FreeMat/tests/freemat/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_source.m | .m | freemat-master/FreeMat/tests/freemat/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_evalin1.m | .m | freemat-master/FreeMat/tests/freemat/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_builtin1.m | .m | freemat-master/FreeMat/tests/freemat/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_feval1.m | .m | freemat-master/FreeMat/tests/freemat/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 | jit_test024.m | .m | freemat-master/FreeMat/tests/freemat/jit_test024.m | 221 | utf_8 | f6f8950d1ce8ec65512c366a4341a6b0 | function A = jit_test024
A = zeros(1,10000);
for j=1:10
for i=1:10000;
A(i) = tjit_sum(A(i),i);
end;
end;
function y = tjit_sum(a,b)
y = a + tjit_double(b);
function y = tjit_double(a)
y = a*2;
|
github | aristofanio/freemat-master | test_subset13.m | .m | freemat-master/FreeMat/tests/variables/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_struct6.m | .m | freemat-master/FreeMat/tests/variables/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_struct7.m | .m | freemat-master/FreeMat/tests/variables/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/variables/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/variables/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_matcat5.m | .m | freemat-master/FreeMat/tests/variables/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_matcat6.m | .m | freemat-master/FreeMat/tests/variables/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_subset5.m | .m | freemat-master/FreeMat/tests/variables/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_subset7.m | .m | freemat-master/FreeMat/tests/variables/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_subset11.m | .m | freemat-master/FreeMat/tests/variables/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_subset6.m | .m | freemat-master/FreeMat/tests/variables/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/variables/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_matcat2.m | .m | freemat-master/FreeMat/tests/variables/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_struct9.m | .m | freemat-master/FreeMat/tests/variables/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_subset9.m | .m | freemat-master/FreeMat/tests/variables/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;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.