From: William P. Y. H <wil...@ya...> - 2005-11-12 05:48:42
|
I think I shouldn't keep you busy with the files, so here they are: --------- isfloat.m --------- ## Copyright (C) 2005 William Poetra Yoga Hadisoeseno ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## Octave is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} isfloat (@var{A}) ## Return 1 if @var{A} is a floating point array. Otherwise, return 0. ## @end deftypefn ## ## @seealso{isa, isinteger, isnumeric} function retval = isfloat(A) if (nargin != 1) usage("isfloat (A)"); end # Octave doesn't have a single-precision floating point data type switch class(A) case "double" retval = 1; otherwise retval = 0; endswitch endfunction ----------- isinteger.m ----------- ## Copyright (C) 2005 William Poetra Yoga Hadisoeseno ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## Octave is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} isinteger (@var{A}) ## Return 1 if @var{A} is an integer array. Otherwise, return 0. ## @end deftypefn ## ## @seealso{isa, isnumeric, isfloat} function retval = isinteger(A) if (nargin != 1) usage("isinteger (A)"); end switch class(A) case "int8" retval = 1; case "int16" retval = 1; case "int32" retval = 1; case "int64" retval = 1; case "uint8" retval = 1; case "uint16" retval = 1; case "uint32" retval = 1; case "uint64" retval = 1; otherwise retval = 0; endswitch endfunction ---------- issorted.m ---------- ## Copyright (C) 2005 William Poetra Yoga Hadisoeseno ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## Octave is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} issorted (@var{A}, ["rows"]) ## Return 1 if @var{A} is equal to sort(@var{A}), otherwise return 0. ## If "rows" is specified, return 1 if @var{A} is equal to sortrows(@var{A}). ## @end deftypefn ## ## @seealso{sort, sortrows} function retval = issorted(A,r) switch nargin case 1 retval = isequal(A,sort(A)); case 2 if strcmp(r,"rows") retval = isequal(A,sortrows(A)); else usage("issorted (A, [\"rows\"])"); endif otherwise usage("issorted (A, [\"rows\"])"); endswitch endfunction ----------- isstudent.m ----------- ## Copyright (C) 2005 William Poetra Yoga Hadisoeseno ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## Octave is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -*- texinfo -*- ## @deftypefn {Function File} {} isstudent ## Always returns 0, because when you accept Octave's License Agreement ## you always get all the features of Octave and not a stripped-down ## "student" version. ## @end deftypefn ## ## @seealso{ispc, isunix} function retval = isstudent if (nargin != 0) usage("isstudent"); end retval = 0; endfunction P.S.: It's almost final because I haven't determined the exact behaviour of issorted() yet. William Poetra Yoga Hadisoeseno __________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs |