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 | cross.m | .m | freemat-master/FreeMat/toolbox/geom/cross.m | 217 | utf_8 | 87424c1ef4ca0def66292c9698f8d246 | % DOCBLOCK mathfunctions_cross
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function C = cross(A,B)
C(1) = A(2)*B(3) - A(3)*B(2);
C(2) = - A(1)*B(3) + A(3)*B(1);
C(3) = A(1)*B(2) - A(2)*B(1);
|
github | aristofanio/freemat-master | wbgentests.m | .m | freemat-master/FreeMat/toolbox/util/wbgentests.m | 1,254 | utf_8 | 17a5992c26f61deff7ef581c975eef82 | % update a testmatrix with a fieldname
function wbgentests(fname,fieldname,funcname)
% Load the test inputs
fprintf('loading %s..\n',fname);
load(fname)
fprintf('done\n');
if (exist('funcname'))
func_only = true;
else
func_only = false;
end
for ndx=1:size(recs,1)
if (rem(ndx,1000)==0)
fprintf('Processing test... |
github | aristofanio/freemat-master | threadcall.m | .m | freemat-master/FreeMat/toolbox/util/threadcall.m | 362 | utf_8 | 296d24da09dfb526f069af03bda38e5a | % DOCBLOCK thread_threadcall
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function varargout = threadcall(id,timeout,funcname,varargin)
threadstart(id,funcname,nargout,varargin{:});
if (~threadwait(id,timeout))
error(sprintf('Timeout on call to %s',funcname));
end
varargout = cell(1,nargo... |
github | aristofanio/freemat-master | fullfile.m | .m | freemat-master/FreeMat/toolbox/util/fullfile.m | 291 | utf_8 | a724453fb1d769cae0f70954d95dc762 | % DOCBLOCK os_fullfile
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function x = fullfile(varargin)
if (nargin == 0)
x = [];
return;
end
x = [];
for i=1:(nargin-1)
x = [x,varargin{i},dirsep];
end
x = [x,varargin{end}];
|
github | aristofanio/freemat-master | pathsep.m | .m | freemat-master/FreeMat/toolbox/util/pathsep.m | 173 | utf_8 | d9422ba4d4b1cabc121881f32874b89d | % DOCBLOCK freemat_pathsep
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function x = pathsep
if (strcmp(computer,'PCWIN'))
x = ';';
else
x = ':';
end
|
github | aristofanio/freemat-master | ctypecast.m | .m | freemat-master/FreeMat/toolbox/util/ctypecast.m | 256 | utf_8 | 3217e567ea2c4ed472cac9473b3875e2 | % DOCBLOCK external_ctypecast
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function s = ctypecast(s,typename)
if (nargin ~= 2) error('ctypecast requires a struct and a typename'); end
s = ctypethaw(ctypefreeze(s,typename),typename);
|
github | aristofanio/freemat-master | path.m | .m | freemat-master/FreeMat/toolbox/util/path.m | 659 | utf_8 | e4a8f7b5011f57917f78bca365653f42 | % DOCBLOCK freemat_path
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function x = path(a,b)
if (strcmp(computer,'PCWIN'))
pathdiv = ';';
else
pathdiv = ':';
end
if ((nargout == 0) && (nargin == 0))
a = getpath;
b = strfind(a,pathsep);
n = 1;
for i=1:numel(b)
printf('%s\n',... |
github | aristofanio/freemat-master | rescan.m | .m | freemat-master/FreeMat/toolbox/util/rescan.m | 117 | utf_8 | 8979a81fe275b6b3f8d9ec1690dd51e1 | % DOCBLOCK freemat_rescan
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function rescan
cd(pwd);
|
github | aristofanio/freemat-master | rehash.m | .m | freemat-master/FreeMat/toolbox/util/rehash.m | 117 | utf_8 | 005482204527476ac5d11c3554648f92 | % DOCBLOCK freemat_rehash
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function rehash
cd(pwd);
|
github | aristofanio/freemat-master | ctypenew.m | .m | freemat-master/FreeMat/toolbox/util/ctypenew.m | 324 | utf_8 | 559bdf8f7b826dbd5a272c08756be779 | % DOCBLOCK external_ctypenew
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function a = ctypenew(typename,count)
if (nargin == 1)
count = 1;
end
if (nargin == 0)
error('ctypenew requires a typename argument');
end
a = ctypethaw(zeros(1,ctypesize(typename,count),'uint8'),typename,coun... |
github | aristofanio/freemat-master | ctypewrite.m | .m | freemat-master/FreeMat/toolbox/util/ctypewrite.m | 265 | utf_8 | f6d5d436daa5d1ca3ec77a20c2404c17 | % DOCBLOCK external_ctypewrite
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function ctypewrite(fid,a,typename)
if (nargin < 3), error('ctypewrite requires 3 args, the fid, variable, and typename'); end;
fwrite(fid,ctypefreeze(a,typename));
|
github | aristofanio/freemat-master | filesep.m | .m | freemat-master/FreeMat/toolbox/util/filesep.m | 173 | utf_8 | 908c47b11e2080b1486ded820d45491a | % DOCBLOCK freemat_filesep
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function x = filesep
if (strcmp(computer,'PCWIN'))
x = '\';
else
x = '/';
end
|
github | aristofanio/freemat-master | inline_evaluate.m | .m | freemat-master/FreeMat/toolbox/util/inline_evaluate.m | 211 | utf_8 | 797df53bb0828adbefbeccae5748cb69 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function inline_res = inline_evaluate(expr,assignexpr,args)
eval(assignexpr);
inline_res = eval(expr,'error evaluating inline expression');
|
github | aristofanio/freemat-master | addpath.m | .m | freemat-master/FreeMat/toolbox/util/addpath.m | 665 | utf_8 | c6b5cf12cc16cff09b0102745d5b0d1d | % DOCBLOCK freemat_addpath
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function addpath(varargin)
if (nargin == 0) return; end
atbegin = 1;
if (any(strcmp(varargin{end},{'-0','-begin'})))
varargin(end) = [];
elseif (any(strcmp(varargin{end},{'-1','-end'})))
atbegin = ... |
github | aristofanio/freemat-master | wbtestcompare.m | .m | freemat-master/FreeMat/toolbox/util/wbtestcompare.m | 2,775 | utf_8 | f9269b4a8f245e2072253887e6b7afdd | function wbtestcompare(fname_input,fieldname_base,fieldname_test)
diary wbtest.txt
load(fname_input);
for ndx=1:size(recs,1)
if (~recs{ndx}.(fieldname_base).success && recs{ndx}.(fieldname_test).success)
inputs = recs{ndx}.inputs;
printf('Failed: %d expr %s\n',ndx,recs{ndx}.expr);
elseif (~re... |
github | aristofanio/freemat-master | ctyperead.m | .m | freemat-master/FreeMat/toolbox/util/ctyperead.m | 352 | utf_8 | 4f46416f067c832560e7a216cc1bc93d | % DOCBLOCK external_ctyperead
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function a = ctyperead(fid,typename,count)
if (nargin < 3), count = 1; end;
if (nargin < 2), error('ctyperead requries at least a file id and a typename'); end;
p = fread(fid,[1,ctypesize(typename,count)],'*uint8');
a ... |
github | aristofanio/freemat-master | asec.m | .m | freemat-master/FreeMat/toolbox/trig/asec.m | 139 | utf_8 | ccd25acced0c86211f7aaba61da4e92c | % DOCBLOCK mathfunctions_asec
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = asec(x)
y = acos(1 ./ x);
|
github | aristofanio/freemat-master | asind.m | .m | freemat-master/FreeMat/toolbox/trig/asind.m | 141 | utf_8 | a70dbaf9f513d75c5fb58bcdc2b1aa09 | % DOCBLOCK mathfunctions_asind
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = asind(x)
y = rad2deg(asin(x));
|
github | aristofanio/freemat-master | acsc.m | .m | freemat-master/FreeMat/toolbox/trig/acsc.m | 139 | utf_8 | 29291a382de4466ff9150aca106badd3 | % DOCBLOCK mathfunctions_acsc
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = acsc(x)
y = asin(1 ./ x);
|
github | aristofanio/freemat-master | acot.m | .m | freemat-master/FreeMat/toolbox/trig/acot.m | 77 | utf_8 | bc608bd29f575afa5865365e940a2b95 | % DOCBLOCK mathfunctions_acot
function y = acot(x)
y = atan(1.0 ./ x);
|
github | aristofanio/freemat-master | acotd.m | .m | freemat-master/FreeMat/toolbox/trig/acotd.m | 84 | utf_8 | baac6f85e1c90988b422227a1bbb65af | % DOCBLOCK mathfunctions_acotd
function y = acotd(x)
y = rad2deg(acot(x));
|
github | aristofanio/freemat-master | rad2deg.m | .m | freemat-master/FreeMat/toolbox/trig/rad2deg.m | 137 | utf_8 | a061903248587e70cdfe2524f02a2b55 | % DOCBLOCK mathfunctions_rad2deg
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = rad2deg(x)
y = x*180/pi;
|
github | aristofanio/freemat-master | deg2rad.m | .m | freemat-master/FreeMat/toolbox/trig/deg2rad.m | 141 | utf_8 | 69890c9a0cca1963b27ea537f76413e1 | % DOCBLOCK mathfunctions_deg2rad
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = deg2rad(x)
y = x*pi/180;
|
github | aristofanio/freemat-master | acscd.m | .m | freemat-master/FreeMat/toolbox/trig/acscd.m | 141 | utf_8 | 0191b41ae66eba05d4ab1aa375e8056b | % DOCBLOCK mathfunctions_acscd
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = acscd(x)
y = rad2deg(acsc(x));
|
github | aristofanio/freemat-master | angle.m | .m | freemat-master/FreeMat/toolbox/trig/angle.m | 148 | utf_8 | 5126cc440134afd5a37102dfb82e8796 | % DOCBLOCK mathfunctions_angle
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function p = angle(c)
p = atan2(imag(c), real(c));
|
github | aristofanio/freemat-master | acsch.m | .m | freemat-master/FreeMat/toolbox/trig/acsch.m | 141 | utf_8 | 7573c2c038e7955fc640151c2f1db148 | % DOCBLOCK mathfunctions_acsch
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = acsch(x)
y = asinh(1 ./ x);
|
github | aristofanio/freemat-master | coth.m | .m | freemat-master/FreeMat/toolbox/trig/coth.m | 140 | utf_8 | a0b5320b80636fecf2b1d1b5cc2f2b35 | % DOCBLOCK mathfunctions_coth
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = coth(x)
y = 1.0 ./ tanh(x);
|
github | aristofanio/freemat-master | cotd.m | .m | freemat-master/FreeMat/toolbox/trig/cotd.m | 138 | utf_8 | 69eb42c714b906c0df5b4cb3846ccccc | % DOCBLOCK mathfunctions_cotd
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = cotd(x)
y = cot(deg2rad(x));
|
github | aristofanio/freemat-master | atand.m | .m | freemat-master/FreeMat/toolbox/trig/atand.m | 141 | utf_8 | e4e1f0b0091c330519f2dd6828cced0b | % DOCBLOCK mathfunctions_atand
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = atand(x)
y = rad2deg(atan(x));
|
github | aristofanio/freemat-master | acosd.m | .m | freemat-master/FreeMat/toolbox/trig/acosd.m | 209 | utf_8 | 8600aef57a140cb63906e2fe887c966d | % DOCBLOCK mathfunctions_acosd
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = acosd(x)
y = rad2deg(acos(x));
y(x == inf) = complex(0,inf);
y(x == -inf) = complex(180,-inf);
|
github | aristofanio/freemat-master | asecd.m | .m | freemat-master/FreeMat/toolbox/trig/asecd.m | 171 | utf_8 | d285b2a99e0bbdaf3568d4b1ed877eab | % DOCBLOCK mathfunctions_asecd
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = asecd(x)
y = rad2deg(asec(x));
y(x == 0) = complex(0,inf);
|
github | aristofanio/freemat-master | acoth.m | .m | freemat-master/FreeMat/toolbox/trig/acoth.m | 142 | utf_8 | 823111111732fef6927eee5accf1eaf5 | % DOCBLOCK mathfunctions_acoth
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = acoth(x)
y = atanh(1 ./ x);
|
github | aristofanio/freemat-master | sech.m | .m | freemat-master/FreeMat/toolbox/trig/sech.m | 139 | utf_8 | 0546e8b61efc5de97402a3c3bbdfef89 | % DOCBLOCK mathfunctions_sech
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = sech(x)
y = 1.0 ./cosh(x);
|
github | aristofanio/freemat-master | csch.m | .m | freemat-master/FreeMat/toolbox/trig/csch.m | 140 | utf_8 | 8fe13f556083ee7850b12c3a8edafea6 | % DOCBLOCK mathfunctions_csch
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = csch(x)
y = 1.0 ./ sinh(x);
|
github | aristofanio/freemat-master | wavwrite.m | .m | freemat-master/FreeMat/toolbox/io/wavwrite.m | 1,883 | utf_8 | 760145c99ca9e1fc190048fb2c998c65 | % DOCBLOCK io_wavwrite
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function wavwrite(varargin)
SampleRate = 8000;
NBits = 16;
if (nargin == 2)
y = varargin{1};
filename = varargin{2};
elseif (nargin == 3)
y = varargin{1};
SampleRate = varargin{2};
filename = varargin{3};
... |
github | aristofanio/freemat-master | type.m | .m | freemat-master/FreeMat/toolbox/io/type.m | 276 | utf_8 | fc794afd1544de4bd3e0b3994b5e4d70 | % DOCBLOCK io_type
function type(filename)
fp = fopen(filename,'r');
if (fp == -1)
f = which(filename);
if (isempty(f)), return; end
filename = f;
fp = fopen(filename,'r');
end
if (fp == -1), return; end
while (~feof(fp))
printf('%s',fgetline(fp));
end
fclose(fp);
|
github | aristofanio/freemat-master | wavread.m | .m | freemat-master/FreeMat/toolbox/io/wavread.m | 4,748 | utf_8 | ae9e7c1473680ad4ac5b604d5f28aa7a | % DOCBLOCK io_wavread
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function varargout = wavread(varargin);
% Originally based on :
% http://ccrma.stanford.edu/workshops/dsp2006/xjs/software/octave/wavread.m
% which was public domain
% with some significant changes to make it work with FreeMat, and t... |
github | aristofanio/freemat-master | csvread.m | .m | freemat-master/FreeMat/toolbox/io/csvread.m | 351 | utf_8 | f4987680af6a34f33d1e010ba9f7e096 | % DOCBLOCK io_csvread
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function x = csvread(filename,firstrow,firstcol,range)
if (nargin == 1)
x = dlmread(filename,',');
elseif (nargin == 3)
x = dlmread(filename,',',firstrow,firstcol);
elseif (nargin == 4)
x = dlmread(filenam... |
github | aristofanio/freemat-master | csvwrite.m | .m | freemat-master/FreeMat/toolbox/io/csvwrite.m | 1,814 | utf_8 | 398be1214343b76a38541a231d64f5ce | % DOCBLOCK io_csvwrite
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function csvwrite(filename,x,firstrow,firstcol)
if (nargin == 2)
firstrow = 0;
firstcol = 0;
elseif (nargin == 3)
firstcol = 0;
elseif (nargin < 2)
error('csvwrite expects a matrix to write... |
github | aristofanio/freemat-master | input.m | .m | freemat-master/FreeMat/toolbox/io/input.m | 622 | utf_8 | f2d06f5cc177054c3e11a9cbf3c32ced | % DOCBLOCK io_input
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = input(prompt,stringflag)
if (isset('stringflag') && ischar(stringflag) && (strcmp(stringflag,'s') | strcmp(stringflag,'S')))
y = getline(prompt);
y(end) = [];
elseif isset('stringflag')
error 'second argumen... |
github | aristofanio/freemat-master | rawwrite.m | .m | freemat-master/FreeMat/toolbox/io/rawwrite.m | 355 | utf_8 | 2d5b6cdf41719cb81b17997edb0c3af3 | % DOCBLOCK io_rawwrite
% Contributed by Bruno DeMan
% Licensed under the GPL
function rawwrite(fname,x,byteorder)
try
if (isset('byteorder'))
fp = fopen(fname,'wb',byteorder);
else
fp = fopen(fname,'wb');
end
fwrite(fp,x);
fclose(fp);
catch
error(['Unable to write file ' fname... |
github | aristofanio/freemat-master | rawread.m | .m | freemat-master/FreeMat/toolbox/io/rawread.m | 392 | utf_8 | 9275075e747769d3ac0ef0c7f3dec84f | % DOCBLOCK io_rawread
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function x = rawread(fname,size,precision,byteorder)
try
if (isset('byteorder'))
fp = fopen(fname,'rb',byteorder);
else
fp = fopen(fname,'rb');
end
x = fread(fp,size,precision);
fclose(fp);
catch
... |
github | aristofanio/freemat-master | randperm.m | .m | freemat-master/FreeMat/toolbox/random/randperm.m | 404 | utf_8 | 400c6723bdb6f6de88441fdb7a965a9b | % DOCBLOCK random_randperm
% Copyright (c) 2008 Samit Basu
% Licensed under the GPL
function result = randperm(n)
% % Slow version
% m = floor(n);
% result = 1:m;
% for ii = 1:m
% jj = round(rand(1,1)*(m-1))+1;
% temp = result(ii);
% result(ii) = result(jj);
% result(jj... |
github | aristofanio/freemat-master | run_tests.m | .m | freemat-master/FreeMat/toolbox/tests/run_tests.m | 2,166 | utf_8 | 75c95d9cf3e82825be123724ab552a68 | %
% Function run_tests
%
% Runs the complete set of tests for FreeMat
% This file is autogenerated by helpgen (the help compiler)
% Any changes will be lost!
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function run_tests
run_path = pwd;
myloc = which('run_tests');
[pth,name,sfx] = filepa... |
github | aristofanio/freemat-master | log10.m | .m | freemat-master/FreeMat/toolbox/numerical/log10.m | 142 | utf_8 | ab19728f5c58833dfad2e73e8b355eac | % DOCBLOCK mathfunctions_log10
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = log10(x)
y = log(x)/log(10.0);
|
github | aristofanio/freemat-master | log2.m | .m | freemat-master/FreeMat/toolbox/numerical/log2.m | 139 | utf_8 | 25988d6ef98cbc4517cf49496f258cf5 | % DOCBLOCK mathfunctions_log2
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = log2(x)
y = log(x)/log(2.0);
|
github | aristofanio/freemat-master | power.m | .m | freemat-master/FreeMat/toolbox/numerical/power.m | 70 | utf_8 | 0f9aa3c81d0e45f3d7ea220b5f6dc44c | % DOCBLOCK mathfunctions_power
function y = power(a,b)
y = a.^b;
|
github | aristofanio/freemat-master | mpower.m | .m | freemat-master/FreeMat/toolbox/numerical/mpower.m | 71 | utf_8 | 2c293c5e008e8eac8550c6241da08b88 | % DOCBLOCK mathfunctions_mpower
function y = mpower(a,b)
y = a^b;
|
github | aristofanio/freemat-master | teps.m | .m | freemat-master/FreeMat/toolbox/numerical/teps.m | 326 | utf_8 | e456e00498cca4c38d419f35b3ca58e7 | % DOCBLOCK constants_teps
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = teps(x)
switch(typeof(x))
case {'single'}
y = feps;
case {'double','int8','uint8','int16','uint16','int32','uint32','int64','uint64'}
y = eps;
otherwise
error('teps only applies to numerical arrays')... |
github | aristofanio/freemat-master | mod.m | .m | freemat-master/FreeMat/toolbox/numerical/mod.m | 273 | utf_8 | 780e0a237790d015a1f43d9e2d0899e3 | % DOCBLOCK mathfunctions_mod
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = mod(x,n)
if (isscalar(x))
x = repmat(x,size(n));
end
if (isscalar(n))
n = repmat(n,size(x));
end
m = floor(x./n);
y = x - m.*n;
y(n==0) = x(n==0);
|
github | aristofanio/freemat-master | rem.m | .m | freemat-master/FreeMat/toolbox/numerical/rem.m | 252 | utf_8 | 6665f2af1f90d0e121e25aa895b94e08 | % DOCBLOCK mathfunctions_rem
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = rem(x,n)
if (isscalar(x))
x = repmat(x,size(n));
end
if (isscalar(n))
n = repmat(n,size(x));
end
m = fix(x./n);
y = x - m.*n;
|
github | aristofanio/freemat-master | idiv.m | .m | freemat-master/FreeMat/toolbox/numerical/idiv.m | 127 | utf_8 | 73f231a6e69eb70ec4414232ac2797bc | % DOCBLOCK mathfunctions_idiv
% Copyright (c) 2005 Samit Basu
% Licensed under the GPL
function y = idiv(a,b)
y = fix(a./b);
|
github | aristofanio/freemat-master | cov.m | .m | freemat-master/FreeMat/toolbox/stat/cov.m | 659 | utf_8 | 9d3afd036b0a72623fc6c09ba1fde629 | % DOCBLOCK elementary_cov
function y = cov(x,z,d)
if (nargin == 1) && isvector(x)
y = var(x);
elseif (nargin == 1)
y = cov_matrix(x,size(x,1));
elseif (nargin == 2 && all(size(x)==size(z)))
y = cov([x(:),z(:)]);
elseif (nargin == 2 && (isscalar(z)))
if (z == 1)
y = cov_matrix(x,size(x,1));... |
github | aristofanio/freemat-master | std.m | .m | freemat-master/FreeMat/toolbox/stat/std.m | 147 | utf_8 | 89c95579acbfe159991ef9ac24cc64f2 | % DOCBLOCK elementary_std
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = std(varargin)
y = sqrt(var(varargin{:}));
|
github | aristofanio/freemat-master | dec2bin.m | .m | freemat-master/FreeMat/toolbox/binary/dec2bin.m | 456 | utf_8 | d6e35e34e631f645149efdf29eb25406 | % DOCBLOCK typecast_dec2bin
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function t = dec2bin(x,n)
x = x(:);
if (size(x) == [0,0])
t = string([]);
return;
end
if (~exist('n') && max(x) > 0)
n = ceil(log2(max(x)+1e-10));
elseif (~exist('n'))
t = string(zeros(size(x))+'0');... |
github | aristofanio/freemat-master | bin2dec.m | .m | freemat-master/FreeMat/toolbox/binary/bin2dec.m | 141 | utf_8 | 9b1ce5e087e12af292e25dd1e8be6db6 | % DOCBLOCK typecast_bin2dec
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function t = bin2dec(x)
t = bin2int(x == '1');
|
github | aristofanio/freemat-master | bind.m | .m | freemat-master/FreeMat/toolbox/deprecated/bind.m | 2,601 | utf_8 | d63196c5ea6dbd4377efdf28f0e56786 | %
%@Module BIND Bind Standalone Executable
%@@Section FREEMAT
%@@Usage
%The @|bind| function allows you to build a stand alone
%executable on Linux. The syntax for its use is
%@[
% bind(output,mainexe,startcommand,varargin)
%@]
%where @|output| is the name of the output binary,
%@|mainexe| is the location of the Fr... |
github | aristofanio/freemat-master | spy.m | .m | freemat-master/FreeMat/toolbox/sparse/spy.m | 254 | utf_8 | fc0e9cecc30ebd814706e9b40e05ba10 | % DOCBLOCK sparse_spy
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function spy(A,colspec)
if (nargin==1)
colspec = 'r.';
end
[i,j] = find(A);
plot(i,j,colspec)
xlabel(sprintf('nz = %d',int32(nnz(A))));
set(gca,'ydir','reverse');
|
github | aristofanio/freemat-master | sprandn.m | .m | freemat-master/FreeMat/toolbox/sparse/sprandn.m | 551 | utf_8 | 36505b278f721760f4dc34ff05b930fa | % DOCBLOCK sparse_sprandn
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = sprandn(x,n,density)
if (nargin == 1)
[i,j] = find(x);
s = randn(size(i));
y = sparse(i,j,s);
else
m = round(x(1));
n = round(n(1));
density = max(0.0,min(1.0,density(1)));
cnt = int32(density*m*n);
if... |
github | aristofanio/freemat-master | sprand.m | .m | freemat-master/FreeMat/toolbox/sparse/sprand.m | 547 | utf_8 | f1e0bc7bb36c11d1ee23d273480d587a | % DOCBLOCK sparse_sprand
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function y = sprand(x,n,density)
if (nargin == 1)
[i,j] = find(x);
s = rand(size(i));
y = sparse(i,j,s);
else
m = round(x(1));
n = round(n(1));
density = max(0.0,min(1.0,density(1)));
cnt = round(density*m*n);
if (c... |
github | aristofanio/freemat-master | speye.m | .m | freemat-master/FreeMat/toolbox/sparse/speye.m | 265 | utf_8 | 853be90930369e7ad8bb9106ef2e861c | % DOCBLOCK sparse_speye
% Copyright (c) 2002-2006 Samit Basu
% Licensed under the GPL
function a = speye(n,m)
if (nargin == 1)
m = n;
end
if ((m <= 0) | (n <= 0))
error('size arguments to speye function must be positive integers');
end
a = sparse(1:m,1:n,1);
|
github | aristofanio/freemat-master | triu.m | .m | freemat-master/FreeMat/toolbox/matrix/triu.m | 959 | utf_8 | b7d731b6b6d68232238644a3aac70583 | % DOCBLOCK array_triu
% Copyright (c) 2008 Samit Basu
% Licensed under the GPL
function ret = triu(x,n)
[m n] = size(x);
if m ~= n
error('Matrix must be square!\n');
end
if nargin == 1
t1 = zeros(size(x));
for i = 1:size(x,1)
for j = i:size(x,2)
t1(i,j)... |
github | aristofanio/freemat-master | rank.m | .m | freemat-master/FreeMat/toolbox/matrix/rank.m | 230 | utf_8 | 77478f309f8c492d7a54677a213057d9 | % DOCBLOCK array_rank
% Copyright (c) 2005 Samit Basu
% Licensed under the GPL
function y = rank(A,tol)
if (isempty(A))
y = 0;
return;
end
s = svd(A);
if (~isset('tol'))
tol = max(size(A))*s(1)*teps(A);
end
y = sum(s>tol);
|
github | aristofanio/freemat-master | norm.m | .m | freemat-master/FreeMat/toolbox/matrix/norm.m | 794 | utf_8 | 925d1bd340b3da767a4c8cb5013fcd55 | % DOCBLOCK array_norm
% Copyright (c) 2005 Samit Basu
% Licensed under the GPL
function y = norm(A,p)
if (~isset('p'))
p = 2;
end
if (isempty(A))
y = 0;
return;
end
if (min(size(A)) == 1)
y = vector_norm(A,p);
else
y = matrix_norm(A,p);
end
function y = vector_norm(A,p)
if (p<1 && p~=-inf)
error('p argume... |
github | aristofanio/freemat-master | transpose.m | .m | freemat-master/FreeMat/toolbox/matrix/transpose.m | 131 | utf_8 | 450df8530e4708431ca59ab266266b2d | % DOCBLOCK array_transpose
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = transpose(x)
y = x.';
|
github | aristofanio/freemat-master | tril.m | .m | freemat-master/FreeMat/toolbox/matrix/tril.m | 884 | utf_8 | 3e005f6865b8800f1b243b652cbdc820 | % DOCBLOCK array_tril
% Copyright (c) 2008 Samit Basu
% Licensed under the GPL
function ret = tril(x,n)
[m n] = size(x);
if m ~= n
error('Matrix must be square!\n');
end
if nargin == 1
for i = 1:size(x,1)
for j = i+1:size(x,2)
x(i,j) = 0;
end
end... |
github | aristofanio/freemat-master | cond.m | .m | freemat-master/FreeMat/toolbox/matrix/cond.m | 486 | utf_8 | 9e703a47140e4d555741b16ad25047f4 | % DOCBLOCK array_cond
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = cond(A,p)
if (nargin < 2)
p = 2;
end
if (nargin < 1)
error('expect at least 1 input to cond function');
end
if (isempty(A)) y = 0; return; end;
if (p ~= 2)
y = norm(A,p)*nor... |
github | aristofanio/freemat-master | pinv.m | .m | freemat-master/FreeMat/toolbox/matrix/pinv.m | 297 | utf_8 | e08b48e57cd991624c2c81a9052658d5 | % DOCBLOCK array_pinv
% Copyright (c) 2005 Samit Basu
% Licensed under the GPL
function y = pinv(A,tol)
if (isempty(A))
y = A;
return;
end
[u,s,v] = svd(A,0);
if (~isset('tol'))
tol = max(size(A))*s(1,1)*teps(A);
end
sd = diag(s);
sd(sd > tol) = 1./(sd(sd > tol));
s = diag(sd);
y = v*s*u';
|
github | aristofanio/freemat-master | expm.m | .m | freemat-master/FreeMat/toolbox/matrix/expm.m | 126 | utf_8 | bc11d1c43667030be96a616e40f902a2 | % DOCBLOCK array_expm
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = expm(A)
y = e^A;
|
github | aristofanio/freemat-master | trace.m | .m | freemat-master/FreeMat/toolbox/matrix/trace.m | 236 | utf_8 | f206c17d2d6f421936f41d2561722bc1 | % DOCBLOCK array_trace
% Copyright (c) 2008 Samit Basu
% Licensed under the GPL
function ret = trace(x)
[m n] = size(x);
if m ~= n
error('Matrix must be square!\n');
end
ret = sum(diag(x));
end
|
github | aristofanio/freemat-master | det.m | .m | freemat-master/FreeMat/toolbox/matrix/det.m | 924 | utf_8 | 5ed8c69687b94cbfde8bb6384f27b91f | % DOCBLOCK array_det
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = det(A)
if (~isnumeric(A))
error('Argument to det must be numeric');
end
if (ndims(A) ~= 2)
error('argument to det must be 2D matrix');
end
if (size(A,1) ~= size(A,2))
error('argu... |
github | aristofanio/freemat-master | eye.m | .m | freemat-master/FreeMat/toolbox/matrix/eye.m | 124 | utf_8 | 929fa59d4ee6d6e4ac0d1d1e8cd0f3d4 | % DOCBLOCK array_eye
% Copyright (c) 2002-2005 Samit Basu
% Licensed under the GPL
function I = eye(n)
I = diag(ones(1,n));
|
github | aristofanio/freemat-master | rref.m | .m | freemat-master/FreeMat/toolbox/matrix/rref.m | 2,173 | utf_8 | 18364fd2f8a7140413ec257895bea5c6 | % DOCBLOCK array_rref
function [A,k] = rref(A, tolerance)
% Original notice for rref from
% http://users.powernet.co.uk/kienzle/octave/matcompat/rref.m
% Copyright (C) 2000 Paul Kienzle
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as pu... |
github | aristofanio/freemat-master | blanks.m | .m | freemat-master/FreeMat/toolbox/string/blanks.m | 239 | utf_8 | 27a99be41b33bd62f755f764c0df5032 | % DOCBLOCK string_blanks
function str = blanks(n)
if ~isscalar(n)
n = n(1);
warning('Input should be a scalar number')
elseif n < 0
n = 0;
warning('Input should be a positive number')
end
str = repmat(' ',[1,n]);
|
github | aristofanio/freemat-master | regexprep.m | .m | freemat-master/FreeMat/toolbox/string/regexprep.m | 1,391 | utf_8 | 622e4402f5997000189dfe420783b1a7 | % DOCBLOCK string_regexprep
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function outputs = regexprep(instring,pattern,replacement,varargin)
if (iscellstr(instring))
outputs = {};
for i=1:numel(instring)
outputs = [outputs,regexprep_helper(instring{i},pattern,replacement,varargin{:})];
end... |
github | aristofanio/freemat-master | lower.m | .m | freemat-master/FreeMat/toolbox/string/lower.m | 362 | utf_8 | fd7a01085d379437f7467b19e9354836 | % DOCBLOCK string_lower
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = lower(x)
if (isstr(x))
y = lower_string(x);
elseif (iscellstr(x))
y = cell(size(x));
for i=1:numel(x)
y{i} = lower_string(x{i});
end
else
y = x;
end
function y = lower_string(x)
y = ... |
github | aristofanio/freemat-master | cellstr.m | .m | freemat-master/FreeMat/toolbox/string/cellstr.m | 411 | utf_8 | dfec6bc0baa402b75e137a46808b9e6e | % DOCBLOCK string_cellstr
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function A = cellstr(x)
if (iscell(x))
A = x;
return;
end
if (~isstr(x) | (ndims(x) ~= 2))
error('Argument to cellstr must be a string matrix');
end
n = size(x,1);
if (n == 1)
A = {deblank(x)};
else... |
github | aristofanio/freemat-master | str2num.m | .m | freemat-master/FreeMat/toolbox/string/str2num.m | 141 | utf_8 | fa80e3ca8fa739203412b90795736017 | % DOCBLOCK io_str2num
function y = str2num(x)
if (~isstr(x))
y = [];
return;
end
try
y = eval(['[',x,']'],'[]');
catch
y = [];
end
|
github | aristofanio/freemat-master | upper.m | .m | freemat-master/FreeMat/toolbox/string/upper.m | 402 | utf_8 | eb5a8aa6db8d35a4922e26c907025f7c | % DOCBLOCK string_upper
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function y = upper(x)
if (isstr(x))
y = upper_string(x);
elseif (iscell(x))
y = cell(size(x));
for i=1:numel(x)
y{i} = upper_string(x{i});
end
else
y = x;
end
function y = upper_string(x)
if (iss... |
github | aristofanio/freemat-master | mprint.m | .m | freemat-master/FreeMat/toolbox/help/mprint.m | 172 | utf_8 | e4678abfe4a3cd14275eb6f8c81d0081 | % Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function mprint(namebase)
drawnow
print(sprintf('%s.jpg',namebase));
print(sprintf('%s.png',namebase));
|
github | aristofanio/freemat-master | fraggen.m | .m | freemat-master/FreeMat/toolbox/help/fraggen.m | 1,418 | utf_8 | e5ea56d272a9fa62d0953e4a69220a1a | % Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
% Process the fragment files to generate the
% text fragments that are inserted into the
% help files.
function fraggen(fname)
% Get the list of all fragment groups
cd(fname)
fraglist = dir('frag_*_000.m');
for i=1:numel(fraglist)
% Create a ne... |
github | aristofanio/freemat-master | helpgen.m | .m | freemat-master/FreeMat/toolbox/help/helpgen.m | 11,645 | utf_8 | 1aab3a82035461483a5742388ac120b4 | % Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function helpgen(source_path,test_only)
global sourcepath section_descriptors genfiles skipexec
diary([source_path,'/help_diary.txt']);
genfiles = {};
printf('Cleaning up help directories...\n');
delete_set(helpgen_rdir([source_path,'/help']));
... |
github | aristofanio/freemat-master | siggen.m | .m | freemat-master/FreeMat/toolbox/help/siggen.m | 4,897 | utf_8 | b2311187dd145eb0dc27b2d05ab8ac68 | function siggen(source_path)
diary([source_path,'/siggen_diary.txt']);
genfiles = {};
file_list = {};
file_list = [file_list;helpgen_rdir([source_path,'/libs'])];
file_list = [file_list;helpgen_rdir([source_path,'/src'])];
s = [];
printf('Processing source files...\n');
for i=1:numel(file_list)
prin... |
github | aristofanio/freemat-master | doequation.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/doequation.m | 92 | utf_8 | 743ccffce11fb25e6113b372664686c0 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function doequation(&p,eqn)
|
github | aristofanio/freemat-master | bbtestwriter.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/bbtestwriter.m | 511 | utf_8 | 61e8141e4e9f97349582f1e82d0ac5b7 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function p = bbtestwriter(a)
if (nargin == 0)
p.myfile = -1;
p.sectables = {};
p.eqnlist = {};
p.verbatim = false;
p.modulename = '';
p.groupname = '';
p.ignore = false;
p.section_descriptors = [];
p.sourcepath = '';
... |
github | aristofanio/freemat-master | doitemize.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/doitemize.m | 93 | utf_8 | 83490d7335a8b17abb225a4c6c736306 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function doitemize(&p,enums)
|
github | aristofanio/freemat-master | docomputeblock.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/docomputeblock.m | 735 | utf_8 | 803498ebb3ebf60e9e16f9501ac3a559 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function docomputeblock(&p,cmds,errorsexpected)
if ((strcmp(p.modulename,'retall') == 0) && ...
(strcmp(p.modulename,'keyboard') == 0) && ...
(strcmp(p.modulename,'return') == 0) && ...
(strcmp(p.modulename,'where') == 0))
fprintf(... |
github | aristofanio/freemat-master | doenumerate.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/doenumerate.m | 98 | utf_8 | dd47da6ecfc4e110e1112dc72a272de5 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function doenumerate(&p,itemlist)
|
github | aristofanio/freemat-master | beginmodule.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/beginmodule.m | 840 | utf_8 | 53e14014d3eced513b7872586d66f337 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function beginmodule(&p,sourcepath,modname,moddesc,secname,section_descriptors)
p.moddesc = moddesc;
p.secname = lower(secname);
p.modulename = lower(modname);
p.section_descriptors = section_descriptors;
p.sourcepath = sourcepath;
... |
github | aristofanio/freemat-master | writeindex.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/writeindex.m | 95 | utf_8 | e56c19281a7fc0057ed20acabe58d467 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function writeindex(&p)
|
github | aristofanio/freemat-master | endverbatim.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/endverbatim.m | 89 | utf_8 | b37a349e2c158a8bded81cc418ca39ad |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function endverbatim(&p)
|
github | aristofanio/freemat-master | beginverbatim.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/beginverbatim.m | 117 | utf_8 | 7db4f8ffdeb2f396cb67c3b04589fb05 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function beginverbatim(&p,text)
p.verbatim = true;
|
github | aristofanio/freemat-master | dofile.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/dofile.m | 104 | utf_8 | e21605e33b7ba0ecf8faf9e1b70512cb |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function dofile(&p,filename,textstring)
|
github | aristofanio/freemat-master | dofigure.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/dofigure.m | 94 | utf_8 | a03535885f8755b65088f991b84c1bc4 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function dofigure(&p,figname)
|
github | aristofanio/freemat-master | outputtext.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/outputtext.m | 93 | utf_8 | ac59fa4adffc88c2a004e8810eba5425 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function outputtext(&p,text)
|
github | aristofanio/freemat-master | endmodule.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/endmodule.m | 152 | utf_8 | 65bcd30d65ba9129f3b8d354a87547b9 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function endmodule(&p)
fclose(p.myfile);
if (p.empty)
delete(p.filename);
end
|
github | aristofanio/freemat-master | begingroup.m | .m | freemat-master/FreeMat/toolbox/help/@bbtestwriter/begingroup.m | 125 | utf_8 | 9a47e42b4ace8bf08286a58c5463997b |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function begingroup(&p,groupname)
p.groupname = groupname;
|
github | aristofanio/freemat-master | doequation.m | .m | freemat-master/FreeMat/toolbox/help/@latexwriter/doequation.m | 138 | utf_8 | e7e2cf50b770870134fa6cf4385f6e6d |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function doequation(&p,eqn)
fprintf(p.myfile,'\\[\n%s\\]\n',eqn);
|
github | aristofanio/freemat-master | doitemize.m | .m | freemat-master/FreeMat/toolbox/help/@latexwriter/doitemize.m | 267 | utf_8 | 71d5d78c750d8f1afc652668a449afea |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function doitemize(&p,enums)
fprintf(p.myfile,'\\begin{itemize}\n');
for i=1:numel(enums)
fprintf(p.myfile,'\\item %s\n',expand_codes(enums{i}));
end
fprintf(p.myfile,'\\end{itemize}\n');
|
github | aristofanio/freemat-master | docomputeblock.m | .m | freemat-master/FreeMat/toolbox/help/@latexwriter/docomputeblock.m | 115 | utf_8 | e3de24a17cf7a5ac9c42236e9e3c4b76 |
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function docomputeblock(&p,cmds,errorsexpected)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.