/usr/share/octave/packages/statistics-1.2.3/fullfact.m is in octave-statistics 1.2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Author: Paul Kienzle <pkienzle@users.sf.net>
## This program is granted to the public domain.
## -*- texinfo -*-
## @deftypefn {Function File} fullfact (@var{N})
## Full factorial design.
##
## If @var{N} is a scalar, return the full factorial design with @var{N} binary
## choices, 0 and 1.
##
## If @var{N} is a vector, return the full factorial design with choices 1
## through @var{n_i} for each factor @var{i}.
##
## @end deftypefn
function A = fullfact(n)
if length(n) == 1
% combinatorial design with n either/or choices
A = fullfact(2*ones(1,n))-1;
else
% combinatorial design with n(i) choices per level
A = [1:n(end)]';
for i=length(n)-1:-1:1
A = [kron([1:n(i)]',ones(rows(A),1)), repmat(A,n(i),1)];
end
end
endfunction
|