This list is closed, nobody may subscribe to it.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
(5) |
Sep
(3) |
Oct
(41) |
Nov
(41) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(75) |
Feb
(10) |
Mar
(170) |
Apr
(174) |
May
(66) |
Jun
(11) |
Jul
(10) |
Aug
(44) |
Sep
(73) |
Oct
(28) |
Nov
(139) |
Dec
(52) |
2003 |
Jan
(35) |
Feb
(93) |
Mar
(62) |
Apr
(10) |
May
(55) |
Jun
(70) |
Jul
(37) |
Aug
(16) |
Sep
(56) |
Oct
(31) |
Nov
(57) |
Dec
(83) |
2004 |
Jan
(85) |
Feb
(67) |
Mar
(27) |
Apr
(37) |
May
(75) |
Jun
(85) |
Jul
(160) |
Aug
(68) |
Sep
(104) |
Oct
(25) |
Nov
(39) |
Dec
(23) |
2005 |
Jan
(10) |
Feb
(45) |
Mar
(43) |
Apr
(19) |
May
(108) |
Jun
(31) |
Jul
(41) |
Aug
(23) |
Sep
(65) |
Oct
(58) |
Nov
(44) |
Dec
(54) |
2006 |
Jan
(96) |
Feb
(27) |
Mar
(69) |
Apr
(59) |
May
(67) |
Jun
(35) |
Jul
(13) |
Aug
(461) |
Sep
(160) |
Oct
(399) |
Nov
(32) |
Dec
(72) |
2007 |
Jan
(316) |
Feb
(305) |
Mar
(318) |
Apr
(54) |
May
(194) |
Jun
(173) |
Jul
(282) |
Aug
(91) |
Sep
(227) |
Oct
(365) |
Nov
(168) |
Dec
(18) |
2008 |
Jan
(71) |
Feb
(111) |
Mar
(155) |
Apr
(173) |
May
(70) |
Jun
(67) |
Jul
(55) |
Aug
(83) |
Sep
(32) |
Oct
(68) |
Nov
(80) |
Dec
(29) |
2009 |
Jan
(46) |
Feb
(18) |
Mar
(95) |
Apr
(76) |
May
(140) |
Jun
(98) |
Jul
(84) |
Aug
(123) |
Sep
(94) |
Oct
(131) |
Nov
(142) |
Dec
(125) |
2010 |
Jan
(128) |
Feb
(158) |
Mar
(172) |
Apr
(134) |
May
(94) |
Jun
(84) |
Jul
(32) |
Aug
(127) |
Sep
(167) |
Oct
(109) |
Nov
(69) |
Dec
(78) |
2011 |
Jan
(39) |
Feb
(58) |
Mar
(52) |
Apr
(47) |
May
(56) |
Jun
(76) |
Jul
(55) |
Aug
(54) |
Sep
(165) |
Oct
(255) |
Nov
(328) |
Dec
(263) |
2012 |
Jan
(82) |
Feb
(147) |
Mar
(400) |
Apr
(216) |
May
(209) |
Jun
(160) |
Jul
(86) |
Aug
(141) |
Sep
(156) |
Oct
(6) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(2) |
2016 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
(8) |
Jul
(2) |
Aug
(5) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
From: <par...@us...> - 2012-09-12 11:20:25
|
Revision: 10998 http://octave.svn.sourceforge.net/octave/?rev=10998&view=rev Author: paramaniac Date: 2012-09-12 11:20:19 +0000 (Wed, 12 Sep 2012) Log Message: ----------- control: sync draft code Modified Paths: -------------- trunk/octave-forge/main/control/devel/__frequency_response_2__.m trunk/octave-forge/main/control/devel/bode2.m Modified: trunk/octave-forge/main/control/devel/__frequency_response_2__.m =================================================================== --- trunk/octave-forge/main/control/devel/__frequency_response_2__.m 2012-09-12 10:39:10 UTC (rev 10997) +++ trunk/octave-forge/main/control/devel/__frequency_response_2__.m 2012-09-12 11:20:19 UTC (rev 10998) @@ -1,4 +1,4 @@ -## Copyright (C) 2009, 2010 Lukas F. Reichlin +## Copyright (C) 2009, 2010, 2012 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -21,9 +21,9 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: November 2009 -## Version: 0.2 +## Version: 0.4 -% function [H, w] = __frequency_response_2__ (sys, w = [], mimoflag = 0, resptype = 0, wbounds = "std", cellflag = false) +% function [H, w] = __frequency_response__ (sys, w = [], mimoflag = 0, resptype = 0, wbounds = "std", cellflag = false) function [H, w] = __frequency_response_2__ (mimoflag = 0, resptype = 0, wbounds = "std", cellflag = false, varargin) sys_vec = cellfun (@(x) isa (x, "lti"), varargin) # true or false @@ -40,6 +40,7 @@ varargin{sys_idx} + ## check arguments if(! isa (sys, "lti")) error ("frequency_response: first argument sys must be an LTI system"); @@ -50,18 +51,21 @@ endif if (isa (sys, "frd")) - if (isempty (w)) - w = get (sys, "w"); - else + if (! isempty (w)) warning ("frequency_response: second argument w is ignored"); endif + w = get (sys, "w"); + H = __freqresp__ (sys, [], resptype, cellflag); elseif (isempty (w)) # find interesting frequency range w if not specified w = __frequency_vector__ (sys, wbounds); + H = __freqresp__ (sys, w, resptype, cellflag); + elseif (iscell (w) && numel (w) == 2 && issample (w{1}) && issample (w{2})) + w = __frequency_vector__ (sys, wbounds, w{1}, w{2}); + H = __freqresp__ (sys, w, resptype, cellflag); elseif (! is_real_vector (w)) error ("frequency_response: second argument w must be a vector of frequencies"); + else + H = __freqresp__ (sys, w, resptype, cellflag); endif - ## frequency response - H = __freqresp__ (sys, w, resptype, cellflag); - -endfunction \ No newline at end of file +endfunction Modified: trunk/octave-forge/main/control/devel/bode2.m =================================================================== --- trunk/octave-forge/main/control/devel/bode2.m 2012-09-12 10:39:10 UTC (rev 10997) +++ trunk/octave-forge/main/control/devel/bode2.m 2012-09-12 11:20:19 UTC (rev 10998) @@ -1,4 +1,4 @@ -## Copyright (C) 2009, 2010 Lukas F. Reichlin +## Copyright (C) 2009, 2010, 2011, 2012 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -28,6 +28,9 @@ ## @item w ## Optional vector of frequency values. If @var{w} is not specified, ## it is calculated by the zeros and poles of the system. +## Alternatively, the cell @code{@{wmin, wmax@}} specifies a frequency range, +## where @var{wmin} and @var{wmax} denote minimum and maximum frequencies +## in rad/s. ## @end table ## ## @strong{Outputs} @@ -45,7 +48,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: November 2009 -## Version: 0.2 +## Version: 0.4 function [mag_r, pha_r, w_r] = bode2 (varargin) @@ -64,12 +67,6 @@ if (! nargout) mag_db = 20 * log10 (mag); - wv = [min(w), max(w)]; - ax_vec_mag = __axis_limits__ ([reshape(w, [], 1), reshape(mag_db, [], 1)]); - ax_vec_mag(1:2) = wv; - ax_vec_pha = __axis_limits__ ([reshape(w, [], 1), reshape(pha, [], 1)]); - ax_vec_pha(1:2) = wv; - if (isct (sys)) xl_str = "Frequency [rad/s]"; else @@ -78,14 +75,16 @@ subplot (2, 1, 1) semilogx (w, mag_db) - axis (ax_vec_mag) + axis ("tight") + ylim (__axis_margin__ (ylim)) grid ("on") title (["Bode Diagram of ", inputname(1)]) ylabel ("Magnitude [dB]") subplot (2, 1, 2) semilogx (w, pha) - axis (ax_vec_pha) + axis ("tight") + ylim (__axis_margin__ (ylim)) grid ("on") xlabel (xl_str) ylabel ("Phase [deg]") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-12 10:39:16
|
Revision: 10997 http://octave.svn.sourceforge.net/octave/?rev=10997&view=rev Author: paramaniac Date: 2012-09-12 10:39:10 +0000 (Wed, 12 Sep 2012) Log Message: ----------- control: remove anonymous function calls in cellfun statements if possible Modified Paths: -------------- trunk/octave-forge/main/control/inst/@iddata/cat.m trunk/octave-forge/main/control/inst/@iddata/detrend.m trunk/octave-forge/main/control/inst/@iddata/diff.m trunk/octave-forge/main/control/inst/@iddata/resample.m trunk/octave-forge/main/control/inst/__adjust_iddata_tsam__.m Modified: trunk/octave-forge/main/control/inst/@iddata/cat.m =================================================================== --- trunk/octave-forge/main/control/inst/@iddata/cat.m 2012-09-11 09:09:31 UTC (rev 10996) +++ trunk/octave-forge/main/control/inst/@iddata/cat.m 2012-09-12 10:39:10 UTC (rev 10997) @@ -231,7 +231,7 @@ if (nargin > 1) ## compare n-th string of first cell with n-th string of remaining cells - tmp = cellfun (@(x) strcmp (str, x), varargin, "uniformoutput", false); + tmp = cellfun (@strcmp, {str}, varargin, "uniformoutput", false); ## check whether all strings of each pair are equal tmp = cellfun (@all, tmp); ## check whether all pairs are equal Modified: trunk/octave-forge/main/control/inst/@iddata/detrend.m =================================================================== --- trunk/octave-forge/main/control/inst/@iddata/detrend.m 2012-09-11 09:09:31 UTC (rev 10996) +++ trunk/octave-forge/main/control/inst/@iddata/detrend.m 2012-09-12 10:39:10 UTC (rev 10997) @@ -40,8 +40,8 @@ [n, p, m] = size (dat); - dat.y = cellfun (@(y) detrend (y, ord), dat.y, "uniformoutput", false); - dat.u = cellfun (@(u) detrend (u, ord), dat.u, "uniformoutput", false); + dat.y = cellfun (@detrend, dat.y, {ord}, "uniformoutput", false); + dat.u = cellfun (@detrend, dat.u, {ord}, "uniformoutput", false); ## if a MIMO experiment has only 1 sample, detrend works ## row-wisely instead of column-wisely Modified: trunk/octave-forge/main/control/inst/@iddata/diff.m =================================================================== --- trunk/octave-forge/main/control/inst/@iddata/diff.m 2012-09-11 09:09:31 UTC (rev 10996) +++ trunk/octave-forge/main/control/inst/@iddata/diff.m 2012-09-12 10:39:10 UTC (rev 10997) @@ -32,7 +32,7 @@ print_usage (); endif - dat.y = cellfun (@(y) diff (y, k, 1), dat.y, "uniformoutput", false); - dat.u = cellfun (@(u) diff (u, k, 1), dat.u, "uniformoutput", false); + dat.y = cellfun (@diff, dat.y, {k}, {1}, "uniformoutput", false); + dat.u = cellfun (@diff, dat.u, {k}, {1}, "uniformoutput", false); endfunction Modified: trunk/octave-forge/main/control/inst/@iddata/resample.m =================================================================== --- trunk/octave-forge/main/control/inst/@iddata/resample.m 2012-09-11 09:09:31 UTC (rev 10996) +++ trunk/octave-forge/main/control/inst/@iddata/resample.m 2012-09-12 10:39:10 UTC (rev 10997) @@ -66,7 +66,7 @@ error ("iddata: resample: fourth argument invalid"); endif - dat.y = cellfun (@(y) resample (y, p, q, h), dat.y, "uniformoutput", false); - dat.u = cellfun (@(u) resample (u, p, q, h), dat.u, "uniformoutput", false); + dat.y = cellfun (@resample, dat.y, {p}, {q}, {h}, "uniformoutput", false); + dat.u = cellfun (@resample, dat.u, {p}, {q}, {h}, "uniformoutput", false); endfunction Modified: trunk/octave-forge/main/control/inst/__adjust_iddata_tsam__.m =================================================================== --- trunk/octave-forge/main/control/inst/__adjust_iddata_tsam__.m 2012-09-11 09:09:31 UTC (rev 10996) +++ trunk/octave-forge/main/control/inst/__adjust_iddata_tsam__.m 2012-09-12 10:39:10 UTC (rev 10997) @@ -34,7 +34,7 @@ tsam = {tsam}; endif - tmp = cellfun (@(x) issample (x, -1), tsam); + tmp = cellfun (@issample, tsam, {-1}); if (any (! tmp)) error ("iddata: invalid sampling time"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cd...@us...> - 2012-09-11 09:09:40
|
Revision: 10996 http://octave.svn.sourceforge.net/octave/?rev=10996&view=rev Author: cdf Date: 2012-09-11 09:09:31 +0000 (Tue, 11 Sep 2012) Log Message: ----------- vectorize unnecessarily loopy code Modified Paths: -------------- trunk/octave-forge/main/geometry/inst/polygons2d/distancePointPolyline.m Modified: trunk/octave-forge/main/geometry/inst/polygons2d/distancePointPolyline.m =================================================================== --- trunk/octave-forge/main/geometry/inst/polygons2d/distancePointPolyline.m 2012-09-10 13:18:55 UTC (rev 10995) +++ trunk/octave-forge/main/geometry/inst/polygons2d/distancePointPolyline.m 2012-09-11 09:09:31 UTC (rev 10996) @@ -1,5 +1,6 @@ ## Copyright (C) 2003-2011 David Legland <dav...@gr...> ## Copyright (C) 2012 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +## Copyright (C) 2012 Carlo de Falco (Speed up by vectorization) ## All rights reserved. ## ## Redistribution and use in source and binary forms, with or without @@ -51,18 +52,23 @@ # allocate memory for result minDist = inf * ones(Np, 1); + + ## compute distance between current each point and all edges + dist = distancePointEdge(point, edges); + ## get the minimum distance + minDist = min(dist, [], 2); + + ## original loopy verion: # process each point - for p = 1:Np - # construct the set of edges - edges = [poly(1:end-1, :) poly(2:end, :)]; - - # compute distance between current each point and all edges - dist = distancePointEdge(point(p, :), edges); + # for p = 1:Np + # # construct the set of edges + # edges = [poly(1:end-1, :) poly(2:end, :)]; + # # compute distance between current each point and all edges + # dist = distancePointEdge(point(p, :), edges); + # # update distance if necessary + # minDist(p) = min(dist); + # end - # update distance if necessary - minDist(p) = min(dist); - end - # process output arguments if nargout<=1 varargout{1} = minDist; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-10 13:19:06
|
Revision: 10995 http://octave.svn.sourceforge.net/octave/?rev=10995&view=rev Author: eandrius Date: 2012-09-10 13:18:55 +0000 (Mon, 10 Sep 2012) Log Message: ----------- instrument-control: parallel, fix for constructor argument parsing and textinfo Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc Modified: trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc 2012-09-10 13:11:53 UTC (rev 10994) +++ trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc 2012-09-10 13:18:55 UTC (rev 10995) @@ -99,7 +99,8 @@ Open Parallel interface.\n \ \n\ @var{path} - the interface path of type String. If omitted defaults to '/dev/parport0'.@*\ -@var{direction} - the direction of interface drivers of type Integer, see: @seealso{pp_datadir} for more info.\n \ +@var{direction} - the direction of interface drivers of type Integer, see: @seealso{pp_datadir} for more info.\ +If omitted defaults to 1 (Input).\n \ \n\ The parallel() shall return instance of @var{octave_parallel} class as the result @var{parallel}.\n \ @end deftypefn") @@ -108,13 +109,9 @@ error("parallel: Windows platform support is not yet implemented, go away..."); return octave_value(); #endif - + int nargin = args.length(); - // Default values - int oflags = O_RDWR; - string path("/dev/parport0"); - // Do not open interface if return value is not assigned if (nargout != 1) { @@ -122,14 +119,56 @@ return octave_value(); } + // Default values + int oflags = O_RDWR; + int dir = 1; // Input + string path("/dev/parport0"); + + + if (!type_loaded) + { + octave_parallel::register_type(); + type_loaded = true; + } + + // Parse the function arguments + if (args.length() > 0) + { + if (args(0).is_string()) + { + path = args(0).string_value(); + } + else + { + print_usage(); + return octave_value(); + } + + } + + // is_float_type() is or'ed to allow expression like ("", 123), without user + // having to use ("", int32(123)), as we still only take "int_value" + if (args.length() > 1) + { + if (args(1).is_integer_type() || args(1).is_float_type()) + { + dir = args(1).int_value(); + } + else + { + print_usage(); + return octave_value(); + } + } + // Open the interface octave_parallel* retval = new octave_parallel(); if (retval->open(path, oflags) < 0) return octave_value(); - - // Set direction to Input - retval->set_datadir(1); + // Set direction + retval->set_datadir(dir); + return octave_value(retval); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-10 13:12:04
|
Revision: 10994 http://octave.svn.sourceforge.net/octave/?rev=10994&view=rev Author: eandrius Date: 2012-09-10 13:11:53 +0000 (Mon, 10 Sep 2012) Log Message: ----------- instrument-control: parallel, texinfo help strings Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc Modified: trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc 2012-09-09 21:55:23 UTC (rev 10993) +++ trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc 2012-09-10 13:11:53 UTC (rev 10994) @@ -92,13 +92,23 @@ } // PKG_ADD: autoload ("parallel", "instrument-control.oct"); -DEFUN_DLD (parallel, args, nargout, "") +DEFUN_DLD (parallel, args, nargout, +"-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {@var{parallel} = } parallel ([@var{path}], [@var{direction})\n \ +\n\ +Open Parallel interface.\n \ +\n\ +@var{path} - the interface path of type String. If omitted defaults to '/dev/parport0'.@*\ +@var{direction} - the direction of interface drivers of type Integer, see: @seealso{pp_datadir} for more info.\n \ +\n\ +The parallel() shall return instance of @var{octave_parallel} class as the result @var{parallel}.\n \ +@end deftypefn") { #ifdef __WIN32__ error("parallel: Windows platform support is not yet implemented, go away..."); return octave_value(); -#endif - +#endif + int nargin = args.length(); // Default values Modified: trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc 2012-09-09 21:55:23 UTC (rev 10993) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc 2012-09-10 13:11:53 UTC (rev 10994) @@ -38,7 +38,14 @@ #include "parallel.h" // PKG_ADD: autoload ("pp_close", "instrument-control.oct"); -DEFUN_DLD (pp_close, args, nargout, "") +DEFUN_DLD (pp_close, args, nargout, +"-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {} pp_close (@var{parallel})\n \ +\n\ +Close the interface and release a file descriptor.\n \ +\n\ +@var{parallel} - instance of @var{octave_serial} class.@*\ +@end deftypefn") { if (args.length() != 1 || args(0).type_id() != octave_parallel::static_type_id()) { Modified: trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc 2012-09-09 21:55:23 UTC (rev 10993) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc 2012-09-10 13:11:53 UTC (rev 10994) @@ -38,7 +38,18 @@ #include "parallel.h" // PKG_ADD: autoload ("pp_ctrl", "instrument-control.oct"); -DEFUN_DLD (pp_ctrl, args, nargout, "") +DEFUN_DLD (pp_ctrl, args, nargout, +"-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {} pp_ctrl (@var{parallel}, @var{ctrl})\n \ +@deftypefnx {Loadable Function} {@var{c} = } pp_ctrl (@var{parallel})\n \ +\n\ +Sets or Read the Control lines.\ +\n\ +@var{parallel} - instance of @var{octave_parallel} class.@*\ +@var{ctrl} - control parameter to be set of type Byte.\n \ +\n\ +If @var{ctrl} parameter is omitted, the pp_ctrl() shall return current Control lines state as the result @var{c}.\n \ +@end deftypefn") { if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_parallel::static_type_id()) { Modified: trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc 2012-09-09 21:55:23 UTC (rev 10993) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc 2012-09-10 13:11:53 UTC (rev 10994) @@ -38,7 +38,18 @@ #include "parallel.h" // PKG_ADD: autoload ("pp_data", "instrument-control.oct"); -DEFUN_DLD (pp_data, args, nargout, "") +DEFUN_DLD (pp_data, args, nargout, +"-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {} pp_data (@var{parallel}, @var{data})\n \ +@deftypefnx {Loadable Function} {@var{d} = } pp_data (@var{parallel})\n \ +\n\ +Sets or Read the Data lines.\ +\n\ +@var{parallel} - instance of @var{octave_parallel} class.@*\ +@var{data} - data parameter to be set of type Byte.\n \ +\n\ +If @var{data} parameter is omitted, the pp_data() shall return current Data lines state as the result @var{d}.\n \ +@end deftypefn") { if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_parallel::static_type_id()) { Modified: trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc 2012-09-09 21:55:23 UTC (rev 10993) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc 2012-09-10 13:11:53 UTC (rev 10994) @@ -38,7 +38,22 @@ #include "parallel.h" // PKG_ADD: autoload ("pp_datadir", "instrument-control.oct"); -DEFUN_DLD (pp_datadir, args, nargout, "") +DEFUN_DLD (pp_datadir, args, nargout, +"-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {} pp_datadir (@var{parallel}, @var{direction})\n \ +@deftypefnx {Loadable Function} {@var{dir} = } pp_datadir (@var{parallel})\n \ +\n\ +Controls the Data line drivers. Normally the computer's parallel port will drive the data lines, \ +but for byte-wide transfers from the peripheral to the host it is useful to turn off those drivers \ +and let the peripheral drive the signals. (If the drivers on the computer's parallel port are left \ +on when this happens, the port might be damaged.)\n \ +\n\ +@var{parallel} - instance of @var{octave_parallel} class.@*\ +@var{direction} - direction parameter of type Integer. Supported values: 0 - the drivers are turned on \ +(Output/Forward direction); 1 - the drivers are turned off (Input/Reverse direction).\n \ +\n\ +If @var{direction} parameter is omitted, the pp_datadir() shall return current Data direction as the result @var{dir}.\n \ +@end deftypefn") { if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_parallel::static_type_id()) { Modified: trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc 2012-09-09 21:55:23 UTC (rev 10993) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc 2012-09-10 13:11:53 UTC (rev 10994) @@ -38,7 +38,16 @@ #include "parallel.h" // PKG_ADD: autoload ("pp_stat", "instrument-control.oct"); -DEFUN_DLD (pp_stat, args, nargout, "") +DEFUN_DLD (pp_stat, args, nargout, +"-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {@var{stat} = } pp_stat (@var{parallel})\n \ +\n\ +Reads the Status lines.\n \ +\n\ +@var{parallel} - instance of @var{octave_parallel} class.@*\ +\n\ +The pp_stat() shall return current Status lines state as the result @var{stat}.\n \ +@end deftypefn") { if (args.length() != 1 || args(0).type_id() != octave_parallel::static_type_id()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-09 21:55:29
|
Revision: 10993 http://octave.svn.sourceforge.net/octave/?rev=10993&view=rev Author: eandrius Date: 2012-09-09 21:55:23 +0000 (Sun, 09 Sep 2012) Log Message: ----------- instrument-control: updated PKG_ADD with functions from Parallel implementation Modified Paths: -------------- trunk/octave-forge/main/instrument-control/PKG_ADD Modified: trunk/octave-forge/main/instrument-control/PKG_ADD =================================================================== --- trunk/octave-forge/main/instrument-control/PKG_ADD 2012-09-09 21:47:44 UTC (rev 10992) +++ trunk/octave-forge/main/instrument-control/PKG_ADD 2012-09-09 21:55:23 UTC (rev 10993) @@ -1,6 +1,6 @@ # Serial +autoload ("serial", "instrument-control.oct"); autoload ("srl_timeout", "instrument-control.oct"); -autoload ("serial", "instrument-control.oct"); autoload ("srl_stopbits", "instrument-control.oct"); autoload ("srl_read", "instrument-control.oct"); autoload ("srl_parity", "instrument-control.oct"); @@ -11,8 +11,16 @@ autoload ("srl_baudrate", "instrument-control.oct"); # I2C +autoload ("i2c", "instrument-control.oct"); autoload ("i2c_addr", "instrument-control.oct"); -autoload ("i2c", "instrument-control.oct"); autoload ("i2c_read", "instrument-control.oct"); autoload ("i2c_close", "instrument-control.oct"); autoload ("i2c_write", "instrument-control.oct"); + +# Parallel +autoload ("parallel", "instrument-control.oct"); +autoload ("pp_close", "instrument-control.oct"); +autoload ("pp_ctrl", "instrument-control.oct"); +autoload ("pp_data", "instrument-control.oct"); +autoload ("pp_datadir", "instrument-control.oct"); +autoload ("pp_stat", "instrument-control.oct"); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-09 21:47:51
|
Revision: 10992 http://octave.svn.sourceforge.net/octave/?rev=10992&view=rev Author: eandrius Date: 2012-09-09 21:47:44 +0000 (Sun, 09 Sep 2012) Log Message: ----------- instrument-control: serial, check if interface is open before operating on it Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_baudrate.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -83,6 +83,12 @@ int octave_serial::set_baudrate(unsigned int baud) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + speed_t baud_rate = 0; switch (baud) @@ -145,6 +151,12 @@ int octave_serial::get_baudrate() { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + int retval = -1; speed_t baudrate = cfgetispeed(&this->config); Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_bytesize.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -80,6 +80,12 @@ int octave_serial::set_bytesize(unsigned short bytesize) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + tcflag_t c_bytesize = 0; switch (bytesize) @@ -110,6 +116,12 @@ int octave_serial::get_bytesize() { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + int retval = -1; if (BITMASK_CHECK(this->config.c_cflag, CS5)) Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_close.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -61,7 +61,14 @@ int octave_serial::close() { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + int retval = ::close(this->get_fd()); this->fd = -1; + return retval; } \ No newline at end of file Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_flush.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -78,6 +78,12 @@ int octave_serial::flush(unsigned short queue_selector) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + /* * TCIOFLUSH Flush both pending input and untransmitted output. * TCOFLUSH Flush untransmitted output. Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_parity.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -80,6 +80,12 @@ int octave_serial::set_parity(string parity) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + // Convert string to lowercase std::transform(parity.begin(), parity.end(), parity.begin(), ::tolower); Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_read.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -34,7 +34,6 @@ #include "serial.h" -// PKG_ADD: autoload ("srl_read", "instrument-control.oct"); DEFUN_DLD (srl_read, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{data}, @var{count}] = } srl_read (@var{serial}, @var{n})\n \ @@ -106,5 +105,11 @@ int octave_serial::read(char *buf, unsigned int len) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + return ::read(get_fd(), buf, len); } \ No newline at end of file Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_stopbits.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -33,7 +33,6 @@ #include "serial.h" -// PKG_ADD: autoload ("srl_stopbits", "instrument-control.oct"); DEFUN_DLD (srl_stopbits, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} srl_stopbits (@var{serial}, @var{stopb})\n \ @@ -78,6 +77,12 @@ int octave_serial::set_stopbits(unsigned short stopbits) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + /* * CSTOPB Send two stop bits, else one. */ @@ -108,6 +113,12 @@ int octave_serial::get_stopbits() { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + if (BITMASK_CHECK(this->config.c_cflag, CSTOPB)) return 2; else Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_timeout.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -33,7 +33,6 @@ #include "serial.h" -// PKG_ADD: autoload ("srl_timeout", "instrument-control.oct"); DEFUN_DLD (srl_timeout, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} srl_timeout (@var{serial}, @var{timeout})\n \ @@ -78,6 +77,12 @@ int octave_serial::set_timeout(short timeout) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + if (timeout < 0 || timeout > 255) { error("srl_timeout: timeout value must be between [0..255]..."); Modified: trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc 2012-09-09 20:59:15 UTC (rev 10991) +++ trunk/octave-forge/main/instrument-control/src/serial/srl_write.cc 2012-09-09 21:47:44 UTC (rev 10992) @@ -33,7 +33,6 @@ #include "serial.h" -// PKG_ADD: autoload ("srl_write", "instrument-control.oct"); DEFUN_DLD (srl_write, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{n} = } srl_write (@var{serial}, @var{data})\n \ @@ -86,10 +85,22 @@ int octave_serial::write(string str) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + return ::write(get_fd(), str.c_str(), str.length()); } int octave_serial::write(unsigned char *buf, int len) { + if (this->get_fd() < 0) + { + error("serial: Interface must be opened first..."); + return -1; + } + return ::write(get_fd(), buf, len); } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-09 20:59:22
|
Revision: 10991 http://octave.svn.sourceforge.net/octave/?rev=10991&view=rev Author: eandrius Date: 2012-09-09 20:59:15 +0000 (Sun, 09 Sep 2012) Log Message: ----------- instrument-control: i2c, check if interface is opened before operating on it Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc 2012-09-09 20:56:23 UTC (rev 10990) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc 2012-09-09 20:59:15 UTC (rev 10991) @@ -61,6 +61,11 @@ int octave_i2c::set_addr(int addr) { + if (this->get_fd() < 0) + { + error("i2c: Interface must be open first..."); + return -1; + } if (::ioctl(this->get_fd(), I2C_SLAVE, addr) < 0) { @@ -73,5 +78,11 @@ int octave_i2c::get_addr() { + if (this->get_fd() < 0) + { + error("i2c: Interface must be open first..."); + return -1; + } + return this->addr; } \ No newline at end of file Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc 2012-09-09 20:56:23 UTC (rev 10990) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc 2012-09-09 20:59:15 UTC (rev 10991) @@ -45,6 +45,12 @@ int octave_i2c::close() { + if (this->get_fd() < 0) + { + error("i2c: Interface must be open first..."); + return -1; + } + int retval = ::close(this->get_fd()); this->fd = -1; Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc 2012-09-09 20:56:23 UTC (rev 10990) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc 2012-09-09 20:59:15 UTC (rev 10991) @@ -80,6 +80,12 @@ int octave_i2c::read(char *buf, unsigned int len) { + if (this->get_fd() < 0) + { + error("i2c: Interface must be open first..."); + return -1; + } + int retval = ::read(this->get_fd(), buf, len); if (retval != len) Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc 2012-09-09 20:56:23 UTC (rev 10990) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc 2012-09-09 20:59:15 UTC (rev 10991) @@ -72,6 +72,12 @@ int octave_i2c::write(unsigned char *buf, int len) { + if (this->get_fd() < 0) + { + error("i2c: Interface must be open first..."); + return -1; + } + int retval = ::write(this->get_fd(), buf, len); if (retval < 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-09 20:56:31
|
Revision: 10990 http://octave.svn.sourceforge.net/octave/?rev=10990&view=rev Author: eandrius Date: 2012-09-09 20:56:23 +0000 (Sun, 09 Sep 2012) Log Message: ----------- instrument-control: i2c code refactoring Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/i2c/i2c.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c.h trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c.cc 2012-09-09 20:31:57 UTC (rev 10989) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c.cc 2012-09-09 20:56:23 UTC (rev 10990) @@ -14,24 +14,15 @@ // along with this program; if not, see <http://www.gnu.org/licenses/>. #include <octave/oct.h> -#include <octave/ov-int32.h> -//#include <octave/ops.h> -//#include <octave/ov-typeinfo.h> +//#include <octave/ov-int32.h> -#include <iostream> +#include <stdio.h> +#include <stdlib.h> #include <string> -#include <algorithm> #ifndef __WIN32__ #include <errno.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#include <linux/i2c-dev.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> #endif @@ -44,19 +35,6 @@ static bool type_loaded = false; - - -DEFUN_DLD (helloworld, args, nargout, - "Hello World Help String") - { - int nargin = args.length (); - octave_stdout << "Hello World has " << nargin - << " input arguments and " - << nargout << " output arguments.\n"; - return octave_value_list (); - } - - octave_i2c::octave_i2c() { this->fd = -1; @@ -69,10 +47,10 @@ octave_i2c::~octave_i2c() { - this->i2c_close(); + this->close(); } -int octave_i2c::i2c_get_fd() +int octave_i2c::get_fd() { return this->fd; } @@ -88,8 +66,7 @@ os << this->fd; } -// PKG_ADD: autoload ("i2c", "instrument-control.oct"); -DEFUN_DLD (i2c, args, nargout, "i2c() function has one mandatory output argument") +DEFUN_DLD (i2c, args, nargout, "") { #ifdef __WIN32__ error("i2c: Windows platform support is not yet implemented, go away..."); @@ -112,7 +89,7 @@ // Open the interface octave_i2c* retval = new octave_i2c(path, oflags); - if (retval->i2c_get_fd() < 0) + if (retval->get_fd() < 0) { error("i2c: Error opening the interface: %s\n", strerror(errno)); return octave_value(); Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c.h =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c.h 2012-09-09 20:31:57 UTC (rev 10989) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c.h 2012-09-09 20:56:23 UTC (rev 10990) @@ -17,7 +17,6 @@ #define i2c_H #include <octave/oct.h> -#include <octave/ov-int32.h> #include <string> @@ -30,15 +29,15 @@ octave_i2c(string, int); ~octave_i2c(); - int i2c_get_fd(); - int i2c_close(); + int get_fd(); + int close(); - int i2c_set_addr(int); - int i2c_get_addr(); + int set_addr(int); + int get_addr(); // Simple i2c commands - int i2c_write(unsigned char*, int); - int i2c_read(char*, unsigned int); + int write(unsigned char*, int); + int read(char*, unsigned int); // Overloaded base functions Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc 2012-09-09 20:31:57 UTC (rev 10989) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_addr.cc 2012-09-09 20:56:23 UTC (rev 10990) @@ -14,31 +14,19 @@ // along with this program; if not, see <http://www.gnu.org/licenses/>. #include <octave/oct.h> -#include <octave/ov-int32.h> -//#include <octave/ops.h> -//#include <octave/ov-typeinfo.h> -#include <iostream> -#include <string> -#include <algorithm> - -#ifndef __WIN32__ -#include <errno.h> -#include <string.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> + +#ifndef __WIN32__ #include <linux/i2c-dev.h> +#include <errno.h> #include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> #endif #include "i2c.h" -// PKG_ADD: autoload ("i2c_addr", "instrument-control.oct"); -DEFUN_DLD (i2c_addr, args, nargout, "Hello World Help String") +DEFUN_DLD (i2c_addr, args, nargout, "") { if (args.length() > 2 || args(0).type_id() != octave_i2c::static_type_id()) @@ -62,28 +50,28 @@ return octave_value(-1); } - i2c->i2c_set_addr(args(1).int_value()); + i2c->set_addr(args(1).int_value()); return octave_value(); } // Returning current slave address - return octave_value(i2c->i2c_get_addr()); + return octave_value(i2c->get_addr()); } -int octave_i2c::i2c_set_addr(int addr) +int octave_i2c::set_addr(int addr) { - if (::ioctl(i2c_get_fd(), I2C_SLAVE, addr) < 0) + if (::ioctl(this->get_fd(), I2C_SLAVE, addr) < 0) { error("i2c: Error setting slave address: %s\n", strerror(errno)); - return false; + return -1; } - return true; + return 1; } -int octave_i2c::i2c_get_addr() +int octave_i2c::get_addr() { return this->addr; } \ No newline at end of file Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc 2012-09-09 20:31:57 UTC (rev 10989) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_close.cc 2012-09-09 20:56:23 UTC (rev 10990) @@ -14,33 +14,18 @@ // along with this program; if not, see <http://www.gnu.org/licenses/>. #include <octave/oct.h> -#include <octave/ov-int32.h> -//#include <octave/ops.h> -//#include <octave/ov-typeinfo.h> -#include <iostream> -#include <string> -#include <algorithm> +#include <stdio.h> +#include <stdlib.h> #ifndef __WIN32__ #include <errno.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#include <linux/i2c-dev.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> #endif -using std::string; - #include "i2c.h" -// PKG_ADD: autoload ("i2c_close", "instrument-control.oct"); -DEFUN_DLD (i2c_close, args, nargout, "Hello World Help String") +DEFUN_DLD (i2c_close, args, nargout, "") { if (args.length() != 1 || args(0).type_id() != octave_i2c::static_type_id()) { @@ -53,14 +38,15 @@ const octave_base_value& rep = args(0).get_rep(); i2c = &((octave_i2c &)rep); - i2c->i2c_close(); + i2c->close(); return octave_value(); } -int octave_i2c::i2c_close() +int octave_i2c::close() { - int retval = ::close(this->i2c_get_fd()); + int retval = ::close(this->get_fd()); this->fd = -1; + return retval; } \ No newline at end of file Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc 2012-09-09 20:31:57 UTC (rev 10989) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_read.cc 2012-09-09 20:56:23 UTC (rev 10990) @@ -14,30 +14,18 @@ // along with this program; if not, see <http://www.gnu.org/licenses/>. #include <octave/oct.h> -#include <octave/ov-int32.h> -#include <iostream> -#include <string> -#include <algorithm> +#include <stdio.h> +#include <stdlib.h> #ifndef __WIN32__ #include <errno.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#include <linux/i2c-dev.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> #endif - #include "i2c.h" -// PKG_ADD: autoload ("i2c_read", "instrument-control.oct"); -DEFUN_DLD (i2c_read, args, nargout, "Hello World Help String") +DEFUN_DLD (i2c_read, args, nargout, "") { if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_i2c::static_type_id()) { @@ -74,7 +62,7 @@ int retval; - retval = i2c->i2c_read(buffer, buffer_len); + retval = i2c->read(buffer, buffer_len); octave_value_list return_list; uint8NDArray data(retval); @@ -90,9 +78,9 @@ return return_list; } -int octave_i2c::i2c_read(char *buf, unsigned int len) +int octave_i2c::read(char *buf, unsigned int len) { - int retval = ::read(i2c_get_fd(), buf, len); + int retval = ::read(this->get_fd(), buf, len); if (retval != len) error("i2c: Failed to read from the i2c bus: %s\n", strerror(errno)); Modified: trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc 2012-09-09 20:31:57 UTC (rev 10989) +++ trunk/octave-forge/main/instrument-control/src/i2c/i2c_write.cc 2012-09-09 20:56:23 UTC (rev 10990) @@ -14,30 +14,21 @@ // along with this program; if not, see <http://www.gnu.org/licenses/>. #include <octave/oct.h> -#include <octave/ov-int32.h> -#include <iostream> #include <string> -#include <algorithm> +#include <stdio.h> +#include <stdlib.h> #ifndef __WIN32__ #include <errno.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#include <linux/i2c-dev.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> #endif - #include "i2c.h" -// PKG_ADD: autoload ("i2c_write", "instrument-control.oct"); -DEFUN_DLD (i2c_write, args, nargout, "Hello World Help String") +using std::string; + +DEFUN_DLD (i2c_write, args, nargout, "") { if (args.length() != 2 || args(0).type_id() != octave_i2c::static_type_id()) { @@ -56,7 +47,7 @@ if (data.is_string()) { string buf = data.string_value(); - retval = i2c->i2c_write((unsigned char*)buf.c_str(), buf.length()); + retval = i2c->write((unsigned char*)buf.c_str(), buf.length()); } else if (data.byte_size() == data.numel()) { @@ -66,7 +57,7 @@ for (int i = 0; i < dtmp.length(); i++) buf[i] = (unsigned char)dtmp(i); - retval = i2c->i2c_write(buf, data.byte_size()); + retval = i2c->write(buf, data.byte_size()); delete[] buf; } @@ -79,9 +70,9 @@ return octave_value(retval); } -int octave_i2c::i2c_write(unsigned char *buf, int len) +int octave_i2c::write(unsigned char *buf, int len) { - int retval = ::write(i2c_get_fd(), buf, len); + int retval = ::write(this->get_fd(), buf, len); if (retval < 0) error("i2c: Failed to write to the i2c bus: %s\n", strerror(errno)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ean...@us...> - 2012-09-09 20:32:05
|
Revision: 10989 http://octave.svn.sourceforge.net/octave/?rev=10989&view=rev Author: eandrius Date: 2012-09-09 20:31:57 +0000 (Sun, 09 Sep 2012) Log Message: ----------- instrument-control: support for Parallel interface Modified Paths: -------------- trunk/octave-forge/main/instrument-control/src/Makefile Added Paths: ----------- trunk/octave-forge/main/instrument-control/src/parallel/ trunk/octave-forge/main/instrument-control/src/parallel/Makefile trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc trunk/octave-forge/main/instrument-control/src/parallel/parallel.h trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc Modified: trunk/octave-forge/main/instrument-control/src/Makefile =================================================================== --- trunk/octave-forge/main/instrument-control/src/Makefile 2012-09-09 19:09:48 UTC (rev 10988) +++ trunk/octave-forge/main/instrument-control/src/Makefile 2012-09-09 20:31:57 UTC (rev 10989) @@ -1,11 +1,11 @@ -OCT = instrument-control -SUBDIRS = i2c serial +OCT = instrument-control.oct +SUBDIRS = i2c serial parallel MKOCTFILE ?= mkoctfile all: @for dir in $(SUBDIRS); do $(MAKE) -C $$dir; done - $(MKOCTFILE) i2c/*.o serial/*.o -o $(OCT) + $(MKOCTFILE) i2c/*.o serial/*.o parallel/*.o -o $(OCT) clean: @for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done Added: trunk/octave-forge/main/instrument-control/src/parallel/Makefile =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/Makefile (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/Makefile 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,21 @@ +OCT := parallel.oct +OBJ := parallel.o pp_close.o pp_datadir.o pp_data.o pp_stat.o pp_ctrl.o + +MKOCTFILE ?= mkoctfile + +all: $(OBJ) + +oct: $(OCT) + +%.oct: $(OBJ) + $(MKOCTFILE) $^ + +%.o: %.cc + $(MKOCTFILE) -c -s $< + + +clean: + rm -f *.oct *.o + + +.PHONY: all clean Added: trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/parallel.cc 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,125 @@ +// Copyright (C) 2012 Andrius Sutas <and...@gm...> +// +// This program 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 3 of the License, or +// (at your option) any later version. +// +// This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> +#include <octave/ov-int32.h> + +#include <iostream> +#include <string> +#include <algorithm> + +#ifndef __WIN32__ +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <linux/parport.h> +#include <linux/ppdev.h> +#endif + +using std::string; + +#include "parallel.h" + +DEFINE_OCTAVE_ALLOCATOR (octave_parallel); +DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_parallel, "octave_parallel", "octave_parallel"); + +static bool type_loaded = false; + +octave_parallel::octave_parallel() +{ + this->fd = -1; +} + +int octave_parallel::open(string path, int flags) +{ + this->fd = ::open(path.c_str(), flags, 0); + + if (this->fd < 0) + { + error("parallel: Error opening the interface: %s\n", strerror(errno)); + return -1; + } + + // Claim control of parallel port + if (ioctl(this->get_fd(), PPCLAIM) < 0) + { + error("parallel: Error when claiming the interface: %s\n", strerror(errno)); + ::close(this->get_fd()); + return -1; + } + + return 1; +} + +octave_parallel::~octave_parallel() +{ + this->close(); +} + +int octave_parallel::get_fd() +{ + return this->fd; +} + +void octave_parallel::print(std::ostream& os, bool pr_as_read_syntax ) const +{ + print_raw(os, pr_as_read_syntax); + newline(os); +} + +void octave_parallel::print_raw(std::ostream& os, bool pr_as_read_syntax) const +{ + os << this->fd; +} + +// PKG_ADD: autoload ("parallel", "instrument-control.oct"); +DEFUN_DLD (parallel, args, nargout, "") +{ +#ifdef __WIN32__ + error("parallel: Windows platform support is not yet implemented, go away..."); + return octave_value(); +#endif + + int nargin = args.length(); + + // Default values + int oflags = O_RDWR; + string path("/dev/parport0"); + + // Do not open interface if return value is not assigned + if (nargout != 1) + { + print_usage(); + return octave_value(); + } + + // Open the interface + octave_parallel* retval = new octave_parallel(); + + if (retval->open(path, oflags) < 0) + return octave_value(); + + // Set direction to Input + retval->set_datadir(1); + + return octave_value(retval); +} Added: trunk/octave-forge/main/instrument-control/src/parallel/parallel.h =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/parallel.h (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/parallel.h 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,78 @@ +// Copyright (C) 2012 Andrius Sutas <and...@gm...> +// +// This program 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 3 of the License, or +// (at your option) any later version. +// +// This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +#ifndef parallel_H +#define parallel_H + +#include <octave/oct.h> +#include <octave/ov-int32.h> + +#include <string> + +using std::string; + +class octave_parallel : public octave_base_value +{ +public: + octave_parallel(); + ~octave_parallel(); + + int open(string, int); + int close(); + int get_fd(); + + int get_datadir(); + int set_datadir(int); + + int get_data(); + int set_data(uint8_t); + + int get_stat(); + + int get_ctrl(); + int set_ctrl(uint8_t); + + // Overloaded base functions + double parallel_value() const + { + return (double)this->fd; + } + + virtual double scalar_value (bool frc_str_conv = false) const + { + return (double)this->fd; + } + + void print (std::ostream& os, bool pr_as_read_syntax = false) const; + void print_raw (std::ostream& os, bool pr_as_read_syntax) const; + + // Properties + bool is_constant (void) const { return true;} + bool is_defined (void) const { return true;} + bool print_as_scalar (void) const { return true;} + +private: + int fd; + + // 1 - Input + // 0 - Output + int dir; + + DECLARE_OCTAVE_ALLOCATOR + DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA +}; + + +#endif Added: trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_close.cc 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,76 @@ +// Copyright (C) 2012 Andrius Sutas <and...@gm...> +// +// This program 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 3 of the License, or +// (at your option) any later version. +// +// This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> + +#include <iostream> +#include <string> +#include <algorithm> + +#ifndef __WIN32__ +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <linux/parport.h> +#include <linux/ppdev.h> +#endif + +using std::string; + +#include "parallel.h" + +// PKG_ADD: autoload ("pp_close", "instrument-control.oct"); +DEFUN_DLD (pp_close, args, nargout, "") +{ + if (args.length() != 1 || args(0).type_id() != octave_parallel::static_type_id()) + { + print_usage(); + return octave_value(-1); + } + + octave_parallel* parallel = NULL; + + const octave_base_value& rep = args(0).get_rep(); + parallel = &((octave_parallel &)rep); + + parallel->close(); + + return octave_value(); +} + +int octave_parallel::close() +{ + if (this->get_fd() < 0) + { + error("parallel: port must be open first..."); + return -1; + } + + // Release parallel port + if (ioctl(this->get_fd(), PPRELEASE) < 0) + error("parallel: error releasing parallel port: %s\n", strerror(errno)); + + int retval = ::close(this->get_fd()); + + this->fd = -1; + + return retval; +} Added: trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_ctrl.cc 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,107 @@ +// Copyright (C) 2012 Andrius Sutas <and...@gm...> +// +// This program 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 3 of the License, or +// (at your option) any later version. +// +// This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> + +#include <iostream> +#include <string> +#include <algorithm> + +#ifndef __WIN32__ +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <linux/parport.h> +#include <linux/ppdev.h> +#endif + +using std::string; + +#include "parallel.h" + +// PKG_ADD: autoload ("pp_ctrl", "instrument-control.oct"); +DEFUN_DLD (pp_ctrl, args, nargout, "") +{ + if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_parallel::static_type_id()) + { + print_usage(); + return octave_value(-1); + } + + octave_parallel* parallel = NULL; + + const octave_base_value& rep = args(0).get_rep(); + parallel = &((octave_parallel &)rep); + + // Set new Control register value + if (args.length() > 1) + { + if ( !(args(1).is_integer_type() || args(1).is_float_type()) ) + { + print_usage(); + return octave_value(-1); + } + + parallel->set_ctrl(args(1).int_value()); + + return octave_value(); + } + + // Return current Control register value on port + return octave_value(parallel->get_ctrl()); +} + +int octave_parallel::set_ctrl(uint8_t ctrl) +{ + if (this->get_fd() < 0) + { + error("parallel: Open the interface first..."); + return -1; + } + + if (ioctl(this->get_fd(), PPWCONTROL, &ctrl) < 0) + { + error("parallel: Error while writing to Control register: %s\n", strerror(errno)); + return -1; + } + + return 1; +} + +int octave_parallel::get_ctrl() +{ + if (this->get_fd() < 0) + { + error("parallel: Open the interface first..."); + return -1; + } + + uint8_t ctrl; + + if (ioctl(this->get_fd(), PPRCONTROL, &ctrl) < 0) + { + error("parallel: Error while reading from Control register: %s\n", strerror(errno)); + return -1; + } + + return ctrl; +} + Added: trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_data.cc 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,116 @@ +// Copyright (C) 2012 Andrius Sutas <and...@gm...> +// +// This program 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 3 of the License, or +// (at your option) any later version. +// +// This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> + +#include <iostream> +#include <string> +#include <algorithm> + +#ifndef __WIN32__ +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <linux/parport.h> +#include <linux/ppdev.h> +#endif + +using std::string; + +#include "parallel.h" + +// PKG_ADD: autoload ("pp_data", "instrument-control.oct"); +DEFUN_DLD (pp_data, args, nargout, "") +{ + if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_parallel::static_type_id()) + { + print_usage(); + return octave_value(-1); + } + + octave_parallel* parallel = NULL; + + const octave_base_value& rep = args(0).get_rep(); + parallel = &((octave_parallel &)rep); + + // Set new Data register value + if (args.length() > 1) + { + if ( !(args(1).is_integer_type() || args(1).is_float_type()) ) + { + print_usage(); + return octave_value(-1); + } + + parallel->set_datadir(args(1).int_value()); + + return octave_value(); + } + + // Return current Data register value on port + return octave_value(parallel->get_data()); +} + +int octave_parallel::set_data(uint8_t data) +{ + if (this->get_fd() < 0) + { + error("parallel: Open the interface first..."); + return -1; + } + + /* + if (this->get_dir() == 1) + { + error("parallel: Trying to output data while in Input mode, this can result in hardware damage! \ + Use override if you know what you are doing..."); + return false; + } + */ + + if (ioctl(this->get_fd(), PPWDATA, &data) < 0) + { + error("parallel: Error while writing to Data register: %s\n", strerror(errno)); + return -1; + } + + return 1; +} + +int octave_parallel::get_data() +{ + if (this->get_fd() < 0) + { + error("parallel: Open the interface first..."); + return -1; + } + + uint8_t data; + + if (ioctl(this->get_fd(), PPRDATA, &data) < 0) + { + error("parallel: Error while reading from Data register: %s\n", strerror(errno)); + return -1; + } + + return data; +} + Added: trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_datadir.cc 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,110 @@ +// Copyright (C) 2012 Andrius Sutas <and...@gm...> +// +// This program 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 3 of the License, or +// (at your option) any later version. +// +// This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> + +#include <iostream> +#include <string> +#include <algorithm> + +#ifndef __WIN32__ +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <linux/parport.h> +#include <linux/ppdev.h> +#endif + +using std::string; + +#include "parallel.h" + +// PKG_ADD: autoload ("pp_datadir", "instrument-control.oct"); +DEFUN_DLD (pp_datadir, args, nargout, "") +{ + if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_parallel::static_type_id()) + { + print_usage(); + return octave_value(-1); + } + + octave_parallel* parallel = NULL; + + const octave_base_value& rep = args(0).get_rep(); + parallel = &((octave_parallel &)rep); + + // Set new direction + if (args.length() > 1) + { + if ( !(args(1).is_integer_type() || args(1).is_float_type()) ) + { + print_usage(); + return octave_value(-1); + } + + parallel->set_datadir(args(1).int_value()); + + return octave_value(); + } + + // Return current direction + return octave_value(parallel->get_datadir()); +} + +int octave_parallel::set_datadir(int dir) +{ + if (this->get_fd() < 0) + { + error("parallel: Open the interface first..."); + return -1; + } + + if (dir != 1 || dir != 0) + { + error("parallel: Unsupported data direction..."); + return -1; + } + + // The ioctl parameter is a pointer to an int. + // If the int is zero, the drivers are turned on (forward/output direction); + // if non-zero, the drivers are turned off (reverse/input direction). + if (ioctl(this->get_fd(), PPDATADIR, &dir) < 0) + { + error("pp_datadir: error setting data direction: %s\n", strerror(errno)); + return false; + } + + this->dir = dir; + + return 1; +} + +int octave_parallel::get_datadir() +{ + if (this->get_fd() < 0) + { + error("parallel: Open the interface first..."); + return false; + } + + return this->dir; +} + Added: trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc =================================================================== --- trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc (rev 0) +++ trunk/octave-forge/main/instrument-control/src/parallel/pp_stat.cc 2012-09-09 20:31:57 UTC (rev 10989) @@ -0,0 +1,76 @@ +// Copyright (C) 2012 Andrius Sutas <and...@gm...> +// +// This program 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 3 of the License, or +// (at your option) any later version. +// +// This program 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 this program; if not, see <http://www.gnu.org/licenses/>. + +#include <octave/oct.h> + +#include <iostream> +#include <string> +#include <algorithm> + +#ifndef __WIN32__ +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <linux/parport.h> +#include <linux/ppdev.h> +#endif + +using std::string; + +#include "parallel.h" + +// PKG_ADD: autoload ("pp_stat", "instrument-control.oct"); +DEFUN_DLD (pp_stat, args, nargout, "") +{ + if (args.length() != 1 || args(0).type_id() != octave_parallel::static_type_id()) + { + print_usage(); + return octave_value(-1); + } + + octave_parallel* parallel = NULL; + + const octave_base_value& rep = args(0).get_rep(); + parallel = &((octave_parallel &)rep); + + // Return current Status register value on port + return octave_value(parallel->get_stat()); +} + + +int octave_parallel::get_stat() +{ + if (this->get_fd() < 0) + { + error("parallel: Open the interface first..."); + return -1; + } + + uint8_t status; + + if (ioctl(this->get_fd(), PPRSTATUS, &status) < 0) + { + error("parallel: Error while reading from Status register: %s\n", strerror(errno)); + return -1; + } + + return status; +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <par...@us...> - 2012-09-09 19:09:57
|
Revision: 10988 http://octave.svn.sourceforge.net/octave/?rev=10988&view=rev Author: paramaniac Date: 2012-09-09 19:09:48 +0000 (Sun, 09 Sep 2012) Log Message: ----------- control: add underscores to C++ filenames Modified Paths: -------------- trunk/octave-forge/main/control/src/__control_slicot_functions__.cc Added Paths: ----------- trunk/octave-forge/main/control/src/sl_ab01od.cc trunk/octave-forge/main/control/src/sl_ab04md.cc trunk/octave-forge/main/control/src/sl_ab08nd.cc trunk/octave-forge/main/control/src/sl_ab09hd.cc trunk/octave-forge/main/control/src/sl_ab09id.cc trunk/octave-forge/main/control/src/sl_ab09jd.cc trunk/octave-forge/main/control/src/sl_ab13ad.cc trunk/octave-forge/main/control/src/sl_ab13bd.cc trunk/octave-forge/main/control/src/sl_ab13dd.cc trunk/octave-forge/main/control/src/sl_ag08bd.cc trunk/octave-forge/main/control/src/sl_ib01ad.cc trunk/octave-forge/main/control/src/sl_ib01cd.cc trunk/octave-forge/main/control/src/sl_ident.cc trunk/octave-forge/main/control/src/sl_sb01bd.cc trunk/octave-forge/main/control/src/sl_sb02od.cc trunk/octave-forge/main/control/src/sl_sb03md.cc trunk/octave-forge/main/control/src/sl_sb03od.cc trunk/octave-forge/main/control/src/sl_sb04md.cc trunk/octave-forge/main/control/src/sl_sb04qd.cc trunk/octave-forge/main/control/src/sl_sb10dd.cc trunk/octave-forge/main/control/src/sl_sb10ed.cc trunk/octave-forge/main/control/src/sl_sb10fd.cc trunk/octave-forge/main/control/src/sl_sb10hd.cc trunk/octave-forge/main/control/src/sl_sb10id.cc trunk/octave-forge/main/control/src/sl_sb10jd.cc trunk/octave-forge/main/control/src/sl_sb10kd.cc trunk/octave-forge/main/control/src/sl_sb10yd.cc trunk/octave-forge/main/control/src/sl_sb10zd.cc trunk/octave-forge/main/control/src/sl_sb16ad.cc trunk/octave-forge/main/control/src/sl_sb16bd.cc trunk/octave-forge/main/control/src/sl_sb16cd.cc trunk/octave-forge/main/control/src/sl_sg02ad.cc trunk/octave-forge/main/control/src/sl_sg03ad.cc trunk/octave-forge/main/control/src/sl_sg03bd.cc trunk/octave-forge/main/control/src/sl_tb01id.cc trunk/octave-forge/main/control/src/sl_tb01pd.cc trunk/octave-forge/main/control/src/sl_tb01ud.cc trunk/octave-forge/main/control/src/sl_tb04bd.cc trunk/octave-forge/main/control/src/sl_td04ad.cc trunk/octave-forge/main/control/src/sl_tg01ad.cc trunk/octave-forge/main/control/src/sl_tg01hd.cc trunk/octave-forge/main/control/src/sl_tg01id.cc trunk/octave-forge/main/control/src/sl_tg01jd.cc trunk/octave-forge/main/control/src/sl_tg04bx.cc Removed Paths: ------------- trunk/octave-forge/main/control/src/slab01od.cc trunk/octave-forge/main/control/src/slab04md.cc trunk/octave-forge/main/control/src/slab08nd.cc trunk/octave-forge/main/control/src/slab09hd.cc trunk/octave-forge/main/control/src/slab09id.cc trunk/octave-forge/main/control/src/slab09jd.cc trunk/octave-forge/main/control/src/slab13ad.cc trunk/octave-forge/main/control/src/slab13bd.cc trunk/octave-forge/main/control/src/slab13dd.cc trunk/octave-forge/main/control/src/slag08bd.cc trunk/octave-forge/main/control/src/slib01ad.cc trunk/octave-forge/main/control/src/slib01cd.cc trunk/octave-forge/main/control/src/slident.cc trunk/octave-forge/main/control/src/slsb01bd.cc trunk/octave-forge/main/control/src/slsb02od.cc trunk/octave-forge/main/control/src/slsb03md.cc trunk/octave-forge/main/control/src/slsb03od.cc trunk/octave-forge/main/control/src/slsb04md.cc trunk/octave-forge/main/control/src/slsb04qd.cc trunk/octave-forge/main/control/src/slsb10dd.cc trunk/octave-forge/main/control/src/slsb10ed.cc trunk/octave-forge/main/control/src/slsb10fd.cc trunk/octave-forge/main/control/src/slsb10hd.cc trunk/octave-forge/main/control/src/slsb10id.cc trunk/octave-forge/main/control/src/slsb10jd.cc trunk/octave-forge/main/control/src/slsb10kd.cc trunk/octave-forge/main/control/src/slsb10yd.cc trunk/octave-forge/main/control/src/slsb10zd.cc trunk/octave-forge/main/control/src/slsb16ad.cc trunk/octave-forge/main/control/src/slsb16bd.cc trunk/octave-forge/main/control/src/slsb16cd.cc trunk/octave-forge/main/control/src/slsg02ad.cc trunk/octave-forge/main/control/src/slsg03ad.cc trunk/octave-forge/main/control/src/slsg03bd.cc trunk/octave-forge/main/control/src/sltb01id.cc trunk/octave-forge/main/control/src/sltb01pd.cc trunk/octave-forge/main/control/src/sltb01ud.cc trunk/octave-forge/main/control/src/sltb04bd.cc trunk/octave-forge/main/control/src/sltd04ad.cc trunk/octave-forge/main/control/src/sltg01ad.cc trunk/octave-forge/main/control/src/sltg01hd.cc trunk/octave-forge/main/control/src/sltg01id.cc trunk/octave-forge/main/control/src/sltg01jd.cc trunk/octave-forge/main/control/src/sltg04bx.cc Modified: trunk/octave-forge/main/control/src/__control_slicot_functions__.cc =================================================================== --- trunk/octave-forge/main/control/src/__control_slicot_functions__.cc 2012-09-08 20:02:40 UTC (rev 10987) +++ trunk/octave-forge/main/control/src/__control_slicot_functions__.cc 2012-09-09 19:09:48 UTC (rev 10988) @@ -1,47 +1,47 @@ -#include "slab08nd.cc" // transmission zeros of state-space models -#include "slab13dd.cc" // L-infinity norm -#include "slsb10hd.cc" // H-2 controller synthesis - continuous-time -#include "slsb10ed.cc" // H-2 controller synthesis - discrete-time -#include "slab13bd.cc" // H-2 norm -#include "slsb01bd.cc" // Pole assignment -#include "slsb10fd.cc" // H-infinity controller synthesis - continuous-time -#include "slsb10dd.cc" // H-infinity controller synthesis - discrete-time -#include "slsb03md.cc" // Lyapunov equations -#include "slsb04md.cc" // Sylvester equations - continuous-time -#include "slsb04qd.cc" // Sylvester equations - discrete-time -#include "slsg03ad.cc" // generalized Lyapunov equations -#include "slsb02od.cc" // algebraic Riccati equations -#include "slab13ad.cc" // Hankel singular values -#include "slab01od.cc" // staircase form using orthogonal transformations -#include "sltb01pd.cc" // minimal realization of state-space models -#include "slsb03od.cc" // Cholesky factor of Lyapunov equations -#include "slsg03bd.cc" // Cholesky factor of generalized Lyapunov equations -#include "slag08bd.cc" // transmission zeros of descriptor state-space models -#include "sltg01jd.cc" // minimal realization of descriptor state-space models -#include "sltg01hd.cc" // controllability staircase form of descriptor state-space models -#include "sltg01id.cc" // observability staircase form of descriptor state-space models -#include "slsg02ad.cc" // solution of algebraic Riccati equations for descriptor systems -#include "sltg04bx.cc" // gain of descriptor state-space models -#include "sltb01id.cc" // scaling of state-space models -#include "sltg01ad.cc" // scaling of descriptor state-space models -#include "slsb10id.cc" // H-infinity loop shaping - continuous-time -#include "slsb10kd.cc" // H-infinity loop shaping - discrete-time - strictly proper case -#include "slsb10zd.cc" // H-infinity loop shaping - discrete-time - proper case -#include "sltb04bd.cc" // State-space to transfer function conversion -#include "slab04md.cc" // bilinear transformation -#include "slsb10jd.cc" // descriptor to regular state-space conversion -#include "sltd04ad.cc" // transfer function to state-space conversion -#include "sltb01ud.cc" // controllable block Hessenberg realization -#include "slab09hd.cc" // balanced stochastic truncation model reduction -#include "slab09id.cc" // balanced truncation & singular perturbation approximation model reduction -#include "slab09jd.cc" // hankel-norm approximation model reduction -#include "slsb16ad.cc" // balanced truncation & singular perturbation approximation controller reduction -#include "slsb16bd.cc" // coprime factorization state-feedback controller reduction -#include "slsb16cd.cc" // frequency-weighted coprime factorization state-feedback controller reduction -#include "slsb10yd.cc" // fit state-space model to frequency response data -#include "slident.cc" // system identification -#include "slib01cd.cc" // compute initial state vector -#include "slib01ad.cc" // compute singular values +#include "sl_ab08nd.cc" // transmission zeros of state-space models +#include "sl_ab13dd.cc" // L-infinity norm +#include "sl_sb10hd.cc" // H-2 controller synthesis - continuous-time +#include "sl_sb10ed.cc" // H-2 controller synthesis - discrete-time +#include "sl_ab13bd.cc" // H-2 norm +#include "sl_sb01bd.cc" // Pole assignment +#include "sl_sb10fd.cc" // H-infinity controller synthesis - continuous-time +#include "sl_sb10dd.cc" // H-infinity controller synthesis - discrete-time +#include "sl_sb03md.cc" // Lyapunov equations +#include "sl_sb04md.cc" // Sylvester equations - continuous-time +#include "sl_sb04qd.cc" // Sylvester equations - discrete-time +#include "sl_sg03ad.cc" // generalized Lyapunov equations +#include "sl_sb02od.cc" // algebraic Riccati equations +#include "sl_ab13ad.cc" // Hankel singular values +#include "sl_ab01od.cc" // staircase form using orthogonal transformations +#include "sl_tb01pd.cc" // minimal realization of state-space models +#include "sl_sb03od.cc" // Cholesky factor of Lyapunov equations +#include "sl_sg03bd.cc" // Cholesky factor of generalized Lyapunov equations +#include "sl_ag08bd.cc" // transmission zeros of descriptor state-space models +#include "sl_tg01jd.cc" // minimal realization of descriptor state-space models +#include "sl_tg01hd.cc" // controllability staircase form of descriptor state-space models +#include "sl_tg01id.cc" // observability staircase form of descriptor state-space models +#include "sl_sg02ad.cc" // solution of algebraic Riccati equations for descriptor systems +#include "sl_tg04bx.cc" // gain of descriptor state-space models +#include "sl_tb01id.cc" // scaling of state-space models +#include "sl_tg01ad.cc" // scaling of descriptor state-space models +#include "sl_sb10id.cc" // H-infinity loop shaping - continuous-time +#include "sl_sb10kd.cc" // H-infinity loop shaping - discrete-time - strictly proper case +#include "sl_sb10zd.cc" // H-infinity loop shaping - discrete-time - proper case +#include "sl_tb04bd.cc" // State-space to transfer function conversion +#include "sl_ab04md.cc" // bilinear transformation +#include "sl_sb10jd.cc" // descriptor to regular state-space conversion +#include "sl_td04ad.cc" // transfer function to state-space conversion +#include "sl_tb01ud.cc" // controllable block Hessenberg realization +#include "sl_ab09hd.cc" // balanced stochastic truncation model reduction +#include "sl_ab09id.cc" // balanced truncation & singular perturbation approximation model reduction +#include "sl_ab09jd.cc" // hankel-norm approximation model reduction +#include "sl_sb16ad.cc" // balanced truncation & singular perturbation approximation controller reduction +#include "sl_sb16bd.cc" // coprime factorization state-feedback controller reduction +#include "sl_sb16cd.cc" // frequency-weighted coprime factorization state-feedback controller reduction +#include "sl_sb10yd.cc" // fit state-space model to frequency response data +#include "sl_ident.cc" // system identification +#include "sl_ib01cd.cc" // compute initial state vector +#include "sl_ib01ad.cc" // compute singular values // stub function to avoid gen_doc_cache warning upon package installation Copied: trunk/octave-forge/main/control/src/sl_ab01od.cc (from rev 10987, trunk/octave-forge/main/control/src/slab01od.cc) =================================================================== --- trunk/octave-forge/main/control/src/sl_ab01od.cc (rev 0) +++ trunk/octave-forge/main/control/src/sl_ab01od.cc 2012-09-09 19:09:48 UTC (rev 10988) @@ -0,0 +1,139 @@ +/* + +Copyright (C) 2010 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope 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 3 of the License, or +(at your option) any later version. + +LTI Syncope 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 LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Staircase controllability form. +Uses SLICOT AB01OD by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: August 2010 +Version: 0.1 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.h" + +extern "C" +{ + int F77_FUNC (ab01od, AB01OD) + (char& STAGES, + char& JOBU, char& JOBV, + int& N, int& M, + double* A, int& LDA, + double* B, int& LDB, + double* U, int& LDU, + double* V, int& LDV, + int& NCONT, int& INDCON, + int* KSTAIR, + double& TOL, + int* IWORK, + double* DWORK, int& LDWORK, + int& INFO); +} + +// PKG_ADD: autoload ("__sl_ab01od__", "__control_slicot_functions__.oct"); +DEFUN_DLD (__sl_ab01od__, args, nargout, + "-*- texinfo -*-\n\ +Slicot AB01OD Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 3) + { + print_usage (); + } + else + { + // arguments in + char stages = 'F'; + char jobu = 'I'; + char jobv = 'N'; // not referenced because stages = 'F' + + Matrix a = args(0).matrix_value (); + Matrix b = args(1).matrix_value (); + double tol = args(2).double_value (); + + int n = a.rows (); // n: number of states + int m = b.columns (); // m: number of inputs + + int lda = max (1, n); + int ldb = max (1, n); + int ldu = max (1, n); + int ldv = 1; + + // arguments out + Matrix u (ldu, n); + double* v = 0; // not referenced because stages = 'F' + + int ncont; + int indcon; + + OCTAVE_LOCAL_BUFFER (int, kstair, n); + + // workspace + int ldwork = max (1, n + max (n, 3*m)); + + OCTAVE_LOCAL_BUFFER (int, iwork, m); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + + // error indicators + int info; + + + // SLICOT routine AB01OD + F77_XFCN (ab01od, AB01OD, + (stages, + jobu, jobv, + n, m, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + u.fortran_vec (), ldu, + v, ldv, + ncont, indcon, + kstair, + tol, + iwork, + dwork, ldwork, + info)); + + if (f77_exception_encountered) + error ("__sl_ab01od__: exception in SLICOT subroutine AB01OD"); + + if (info != 0) + error ("__sl_ab01od__: AB01OD returned info = %d", info); + + // resize + a.resize (n, n); + b.resize (n, m); + u.resize (n, n); + + // return values + retval(0) = a; + retval(1) = b; + retval(2) = u; + retval(3) = octave_value (ncont); + } + + return retval; +} Copied: trunk/octave-forge/main/control/src/sl_ab04md.cc (from rev 10987, trunk/octave-forge/main/control/src/slab04md.cc) =================================================================== --- trunk/octave-forge/main/control/src/sl_ab04md.cc (rev 0) +++ trunk/octave-forge/main/control/src/sl_ab04md.cc 2012-09-09 19:09:48 UTC (rev 10988) @@ -0,0 +1,129 @@ +/* + +Copyright (C) 2011 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope 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 3 of the License, or +(at your option) any later version. + +LTI Syncope 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 LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Discrete-time <--> continuous-time systems conversion +by a bilinear transformation. +Uses SLICOT AB04MD by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: September 2011 +Version: 0.1 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.h" + +extern "C" +{ + int F77_FUNC (ab04md, AB04MD) + (char& TYPE, + int& N, int& M, int& P, + double& ALPHA, double& BETA, + double* A, int& LDA, + double* B, int& LDB, + double* C, int& LDC, + double* D, int& LDD, + int* IWORK, + double* DWORK, int& LDWORK, + int& INFO); +} + +// PKG_ADD: autoload ("__sl_ab04md__", "__control_slicot_functions__.oct"); +DEFUN_DLD (__sl_ab04md__, args, nargout, + "-*- texinfo -*-\n\ +Slicot AB04MD Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 7) + { + print_usage (); + } + else + { + // arguments in + char type; + + Matrix a = args(0).matrix_value (); + Matrix b = args(1).matrix_value (); + Matrix c = args(2).matrix_value (); + Matrix d = args(3).matrix_value (); + + double alpha = args(4).double_value (); + double beta = args(5).double_value (); + int discrete = args(6).int_value (); + + if (discrete == 0) + type = 'C'; + else + type = 'D'; + + int n = a.rows (); // n: number of states + int m = b.columns (); // m: number of inputs + int p = c.rows (); // p: number of outputs + + int lda = max (1, n); + int ldb = max (1, n); + int ldc = max (1, p); + int ldd = max (1, p); + + // workspace + int ldwork = max (1, n); + + OCTAVE_LOCAL_BUFFER (int, iwork, n); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + + // error indicator + int info; + + + // SLICOT routine AB04MD + F77_XFCN (ab04md, AB04MD, + (type, + n, m, p, + alpha, beta, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + c.fortran_vec (), ldc, + d.fortran_vec (), ldd, + iwork, + dwork, ldwork, + info)); + + if (f77_exception_encountered) + error ("__sl_ab04md__: exception in SLICOT subroutine AB04MD"); + + if (info != 0) + error ("__sl_ab04md__: AB04MD returned info = %d", info); + + // return values + retval(0) = a; + retval(1) = b; + retval(2) = c; + retval(3) = d; + } + + return retval; +} Copied: trunk/octave-forge/main/control/src/sl_ab08nd.cc (from rev 10987, trunk/octave-forge/main/control/src/slab08nd.cc) =================================================================== --- trunk/octave-forge/main/control/src/sl_ab08nd.cc (rev 0) +++ trunk/octave-forge/main/control/src/sl_ab08nd.cc 2012-09-09 19:09:48 UTC (rev 10988) @@ -0,0 +1,225 @@ +/* + +Copyright (C) 2009, 2010, 2011 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope 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 3 of the License, or +(at your option) any later version. + +LTI Syncope 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 LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Transmission zeros of state-space models. +Uses SLICOT AB08ND by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: November 2009 +Version: 0.5 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.h" +#include <complex> +#include <xpow.h> + +extern "C" +{ + int F77_FUNC (ab08nd, AB08ND) + (char& EQUIL, + int& N, int& M, int& P, + const double* A, int& LDA, + const double* B, int& LDB, + const double* C, int& LDC, + const double* D, int& LDD, + int& NU, int& RANK, int& DINFZ, + int& NKROR, int& NKROL, int* INFZ, + int* KRONR, int* KRONL, + double* AF, int& LDAF, + double* BF, int& LDBF, + double& TOL, + int* IWORK, double* DWORK, int& LDWORK, + int& INFO); + + int F77_FUNC (dggev, DGGEV) + (char& JOBVL, char& JOBVR, + int& N, + double* AF, int& LDAF, + double* BF, int& LDBF, + double* ALPHAR, double* ALPHAI, + double* BETA, + double* VL, int& LDVL, + double* VR, int& LDVR, + double* WORK, int& LWORK, + int& INFO); +} + +// PKG_ADD: autoload ("__sl_ab08nd__", "__control_slicot_functions__.oct"); +DEFUN_DLD (__sl_ab08nd__, args, nargout, + "-*- texinfo -*-\n\ +Slicot AB08ND Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 5) + { + print_usage (); + } + else + { + // arguments in + char equil; + + const Matrix a = args(0).matrix_value (); + const Matrix b = args(1).matrix_value (); + const Matrix c = args(2).matrix_value (); + const Matrix d = args(3).matrix_value (); + const int scaled = args(4).int_value (); + + if (scaled == 0) + equil = 'S'; + else + equil = 'N'; + + int n = a.rows (); // n: number of states + int m = b.columns (); // m: number of inputs + int p = c.rows (); // p: number of outputs + + int lda = max (1, a.rows ()); + int ldb = max (1, b.rows ()); + int ldc = max (1, c.rows ()); + int ldd = max (1, d.rows ()); + + // arguments out + int nu; + int rank; + int dinfz; + int nkror; + int nkrol; + + int ldaf = max (1, n + m); + int ldbf = max (1, n + p); + + OCTAVE_LOCAL_BUFFER (int, infz, n); + OCTAVE_LOCAL_BUFFER (int, kronr, 1 + max (n, m)); + OCTAVE_LOCAL_BUFFER (int, kronl, 1 + max (n, p)); + + OCTAVE_LOCAL_BUFFER (double, af, ldaf * (n + min (p, m))); + OCTAVE_LOCAL_BUFFER (double, bf, ldbf * (n + m)); + + // workspace + int s = max (m, p); + int ldwork = max (s, n) + max (3*s-1, n+s); + + OCTAVE_LOCAL_BUFFER (int, iwork, s); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + + // error indicator + int info; + + // tolerance + double tol = 0; // AB08ND uses DLAMCH for default tolerance + + // SLICOT routine AB08ND + F77_XFCN (ab08nd, AB08ND, + (equil, + n, m, p, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + c.fortran_vec (), ldc, + d.fortran_vec (), ldd, + nu, rank, dinfz, + nkror, nkrol, infz, + kronr, kronl, + af, ldaf, + bf, ldbf, + tol, + iwork, dwork, ldwork, + info)); + + if (f77_exception_encountered) + error ("ss: zero: __sl_ab08nd__: exception in SLICOT subroutine AB08ND"); + + if (info != 0) + error ("ss: zero: __sl_ab08nd__: AB08ND returned info = %d", info); + + + // DGGEV Part + char jobvl = 'N'; + char jobvr = 'N'; + + double* vl = 0; // not referenced because jobvl = 'N' + int ldvl = 1; + double* vr = 0; // not referenced because jobvr = 'N' + int ldvr = 1; + + int lwork = max (1, 8*nu); + OCTAVE_LOCAL_BUFFER (double, work, lwork); + + ColumnVector alphar (nu); + ColumnVector alphai (nu); + ColumnVector beta (nu); + + int info2; + + F77_XFCN (dggev, DGGEV, + (jobvl, jobvr, + nu, + af, ldaf, + bf, ldbf, + alphar.fortran_vec (), alphai.fortran_vec (), + beta.fortran_vec (), + vl, ldvl, + vr, ldvr, + work, lwork, + info2)); + + if (f77_exception_encountered) + error ("ss: zero: __sl_ab08nd__: exception in LAPACK subroutine DGGEV"); + + if (info2 != 0) + error ("ss: zero: __sl_ab08nd__: DGGEV returned info = %d", info2); + + // calculate gain + octave_value gain = Matrix (0, 0);; + + if (m == 1 && p == 1) + { + if (nu < n) + gain = c * xpow (a, double (n-1-nu)) * b; + else + gain = d; + } + + // assemble complex vector - adapted from DEFUN complex in data.cc + ColumnVector zeror (nu); + ColumnVector zeroi (nu); + + zeror = quotient (alphar, beta); + zeroi = quotient (alphai, beta); + + ComplexColumnVector zero (nu, Complex ()); + + for (octave_idx_type i = 0; i < nu; i++) + zero.xelem (i) = Complex (zeror(i), zeroi(i)); + + // return values + retval(0) = zero; + retval(1) = gain; + } + + return retval; +} Copied: trunk/octave-forge/main/control/src/sl_ab09hd.cc (from rev 10987, trunk/octave-forge/main/control/src/slab09hd.cc) =================================================================== --- trunk/octave-forge/main/control/src/sl_ab09hd.cc (rev 0) +++ trunk/octave-forge/main/control/src/sl_ab09hd.cc 2012-09-09 19:09:48 UTC (rev 10988) @@ -0,0 +1,242 @@ +/* + +Copyright (C) 2011 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope 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 3 of the License, or +(at your option) any later version. + +LTI Syncope 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 LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Model reduction based on balanced stochastic truncation method. +Uses SLICOT AB09HD by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: October 2011 +Version: 0.1 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.h" + +extern "C" +{ + int F77_FUNC (ab09hd, AB09HD) + (char& DICO, char& JOB, char& EQUIL, char& ORDSEL, + int& N, int& M, int& P, + int& NR, + double& ALPHA, double& BETA, + double* A, int& LDA, + double* B, int& LDB, + double* C, int& LDC, + double* D, int& LDD, + int& NS, + double* HSV, + double& TOL1, double& TOL2, + int* IWORK, + double* DWORK, int& LDWORK, + bool* BWORK, + int& IWARN, int& INFO); +} + +// PKG_ADD: autoload ("__sl_ab09hd__", "__control_slicot_functions__.oct"); +DEFUN_DLD (__sl_ab09hd__, args, nargout, + "-*- texinfo -*-\n\ +Slicot AB09HD Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 13) + { + print_usage (); + } + else + { + // arguments in + char dico; + char job; + char equil; + char ordsel; + + Matrix a = args(0).matrix_value (); + Matrix b = args(1).matrix_value (); + Matrix c = args(2).matrix_value (); + Matrix d = args(3).matrix_value (); + + const int idico = args(4).int_value (); + const int iequil = args(5).int_value (); + const int ijob = args(6).int_value (); + + int nr = args(7).int_value (); + const int iordsel = args(8).int_value (); + + double alpha = args(9).double_value (); + double beta = args(10).double_value (); + double tol1 = args(11).double_value (); + double tol2 = args(12).double_value (); + + switch (ijob) + { + case 0: + job = 'B'; + break; + case 1: + job = 'F'; + break; + case 2: + job = 'S'; + break; + case 3: + job = 'P'; + break; + default: + error ("__sl_ab09hd__: argument job invalid"); + } + + if (idico == 0) + dico = 'C'; + else + dico = 'D'; + + if (iequil == 0) + equil = 'S'; + else + equil = 'N'; + + if (iordsel == 0) + ordsel = 'F'; + else + ordsel = 'A'; + + int n = a.rows (); // n: number of states + int m = b.columns (); // m: number of inputs + int p = c.rows (); // p: number of outputs + + int lda = max (1, n); + int ldb = max (1, n); + int ldc = max (1, p); + int ldd = max (1, p); + + // arguments out + int ns; + ColumnVector hsv (n); + + // workspace + int liwork = max (1, 2*n); + int mb; + + if (beta == 0) + mb = m; + else + mb = m + p; + + int ldwork = 2*n*n + mb*(n+p) + + max (2, n*(max (n,mb,p)+5), 2*n*p + max (p*(mb+2), 10*n*(n+1))); + + OCTAVE_LOCAL_BUFFER (int, iwork, liwork); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + OCTAVE_LOCAL_BUFFER (bool, bwork, 2*n); + + // error indicators + int iwarn = 0; + int info = 0; + + + // SLICOT routine AB09HD + F77_XFCN (ab09hd, AB09HD, + (dico, job, equil, ordsel, + n, m, p, + nr, + alpha, beta, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + c.fortran_vec (), ldc, + d.fortran_vec (), ldd, + ns, + hsv.fortran_vec (), + tol1, tol2, + iwork, + dwork, ldwork, + bwork, + iwarn, info)); + + if (f77_exception_encountered) + error ("bstmodred: exception in SLICOT subroutine AB09HD"); + + + static const char* err_msg[] = { + "0: OK", + "1: the computation of the ordered real Schur form of A " + "failed", + "2: the reduction of the Hamiltonian matrix to real " + "Schur form failed", + "3: the reordering of the real Schur form of the " + "Hamiltonian matrix failed", + "4: the Hamiltonian matrix has less than N stable " + "eigenvalues", + "5: the coefficient matrix U11 in the linear system " + "X*U11 = U21 to determine X is singular to working " + "precision", + "6: BETA = 0 and D has not a maximal row rank", + "7: the computation of Hankel singular values failed", + "8: the separation of the ALPHA-stable/unstable diagonal " + "blocks failed because of very close eigenvalues", + "9: the resulting order of reduced stable part is less " + "than the number of unstable zeros of the stable " + "part"}; + + static const char* warn_msg[] = { + "0: OK", + "1: with ORDSEL = 'F', the selected order NR is greater " + "than NSMIN, the sum of the order of the " + "ALPHA-unstable part and the order of a minimal " + "realization of the ALPHA-stable part of the given " + "system; in this case, the resulting NR is set equal " + "to NSMIN.", + "2: with ORDSEL = 'F', the selected order NR corresponds " + "to repeated singular values for the ALPHA-stable " + "part, which are neither all included nor all " + "excluded from the reduced model; in this case, the " + "resulting NR is automatically decreased to exclude " + "all repeated singular values.", + "3: with ORDSEL = 'F', the selected order NR is less " + "than the order of the ALPHA-unstable part of the " + "given system; in this case NR is set equal to the " + "order of the ALPHA-unstable part."}; + + error_msg ("bstmodred", info, 9, err_msg); + warning_msg ("bstmodred", iwarn, 3, warn_msg); + + // resize + a.resize (nr, nr); + b.resize (nr, m); + c.resize (p, nr); + hsv.resize (ns); + + // return values + retval(0) = a; + retval(1) = b; + retval(2) = c; + retval(3) = d; + retval(4) = octave_value (nr); + retval(5) = hsv; + retval(6) = octave_value (ns); + } + + return retval; +} Copied: trunk/octave-forge/main/control/src/sl_ab09id.cc (from rev 10987, trunk/octave-forge/main/control/src/slab09id.cc) =================================================================== --- trunk/octave-forge/main/control/src/sl_ab09id.cc (rev 0) +++ trunk/octave-forge/main/control/src/sl_ab09id.cc 2012-09-09 19:09:48 UTC (rev 10988) @@ -0,0 +1,396 @@ +/* + +Copyright (C) 2011 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope 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 3 of the License, or +(at your option) any later version. + +LTI Syncope 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 LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Model reduction based on Balance & Truncate (B&T) or +Singular Perturbation Approximation (SPA) method. +Uses SLICOT AB09ID by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: October 2011 +Version: 0.1 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.h" + +extern "C" +{ + int F77_FUNC (ab09id, AB09ID) + (char& DICO, char& JOBC, char& JOBO, char& JOB, + char& WEIGHT, char& EQUIL, char& ORDSEL, + int& N, int& M, int& P, + int& NV, int& PV, int& NW, int& MW, + int& NR, + double& ALPHA, double& ALPHAC, double& ALPHAO, + double* A, int& LDA, + double* B, int& LDB, + double* C, int& LDC, + double* D, int& LDD, + double* AV, int& LDAV, + double* BV, int& LDBV, + double* CV, int& LDCV, + double* DV, int& LDDV, + double* AW, int& LDAW, + double* BW, int& LDBW, + double* CW, int& LDCW, + double* DW, int& LDDW, + int& NS, + double* HSV, + double& TOL1, double& TOL2, + int* IWORK, + double* DWORK, int& LDWORK, + int& IWARN, int& INFO); +} + +// PKG_ADD: autoload ("__sl_ab09id__", "__control_slicot_functions__.oct"); +DEFUN_DLD (__sl_ab09id__, args, nargout, + "-*- texinfo -*-\n\ +Slicot AB09ID Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 25) + { + print_usage (); + } + else + { + // arguments in + char dico; + char jobc; + char jobo; + char job; + char weight; + char equil; + char ordsel; + + Matrix a = args(0).matrix_value (); + Matrix b = args(1).matrix_value (); + Matrix c = args(2).matrix_value (); + Matrix d = args(3).matrix_value (); + + const int idico = args(4).int_value (); + const int iequil = args(5).int_value (); + int nr = args(6).int_value (); + const int iordsel = args(7).int_value (); + double alpha = args(8).double_value (); + const int ijob = args(9).int_value (); + + Matrix av = args(10).matrix_value (); + Matrix bv = args(11).matrix_value (); + Matrix cv = args(12).matrix_value (); + Matrix dv = args(13).matrix_value (); + + Matrix aw = args(14).matrix_value (); + Matrix bw = args(15).matrix_value (); + Matrix cw = args(16).matrix_value (); + Matrix dw = args(17).matrix_value (); + + const int iweight = args(18).int_value (); + const int ijobc = args(19).int_value (); + double alphac = args(20).double_value (); + const int ijobo = args(21).int_value (); + double alphao = args(22).double_value (); + + double tol1 = args(23).double_value (); + double tol2 = args(24).double_value (); + + if (idico == 0) + dico = 'C'; + else + dico = 'D'; + + if (iequil == 0) + equil = 'S'; + else + equil = 'N'; + + if (iordsel == 0) + ordsel = 'F'; + else + ordsel = 'A'; + + if (ijobc == 0) + jobc = 'S'; + else + jobc = 'E'; + + if (ijobo == 0) + jobo = 'S'; + else + jobo = 'E'; + + switch (ijob) + { + case 0: + job = 'B'; + break; + case 1: + job = 'F'; + break; + case 2: + job = 'S'; + break; + case 3: + job = 'P'; + break; + default: + error ("__sl_ab09id__: argument job invalid"); + } + + switch (iweight) + { + case 0: + weight = 'N'; + break; + case 1: + weight = 'L'; + break; + case 2: + weight = 'R'; + break; + case 3: + weight = 'B'; + break; + default: + error ("__sl_ab09id__: argument weight invalid"); + } + + int n = a.rows (); // n: number of states + int m = b.columns (); // m: number of inputs + int p = c.rows (); // p: number of outputs + + int nv = av.rows (); + int pv = cv.rows (); + int nw = aw.rows (); + int mw = bw.columns (); + + int lda = max (1, n); + int ldb = max (1, n); + int ldc = max (1, p); + int ldd = max (1, p); + + int ldav = max (1, nv); + int ldbv = max (1, nv); + int ldcv = max (1, pv); + int lddv = max (1, pv); + + int ldaw = max (1, nw); + int ldbw = max (1, nw); + int ldcw = max (1, m); + int lddw = max (1, m); + + // arguments out + int ns; + ColumnVector hsv (n); + + // workspace + int liwork; + int liwrk1; + int liwrk2; + int liwrk3; + + switch (job) + { + case 'B': + liwrk1 = 0; + break; + case 'F': + liwrk1 = n; + break; + default: + liwrk1 = 2*n; + } + + if (nv == 0 || weight == 'R' || weight == 'N') + liwrk2 = 0; + else + liwrk2 = nv + max (p, pv); + + if (nw == 0 || weight == 'L' || weight == 'N') + liwrk3 = 0; + else + liwrk3 = nw + max (m, mw); + + liwork = max (3, liwrk1, liwrk2, liwrk3); + + int ldwork; + int lminl; + int lrcf; + int lminr; + int llcf; + int lleft; + int lright; + + if (nw == 0 || weight == 'L' || weight == 'N') + { + lrcf = 0; + lminr = 0; + } + else + { + lrcf = mw*(nw+mw) + max (nw*(nw+5), mw*(mw+2), 4*mw, 4*m); + if (m == mw) + lminr = nw + max (nw, 3*m); + else + lminr = 2*nw*max (m, mw) + nw + max (nw, 3*m, 3*mw); + } + + llcf = pv*(nv+pv) + pv*nv + max (nv*(nv+5), pv*(pv+2), 4*pv, 4*p); + + if (nv == 0 || weight == 'R' || weight == 'N') + lminl = 0; + else if (p == pv) + lminl = max (llcf, nv + max (nv, 3*p)); + else + lminl = max (p, pv) * (2*nv + max (p, pv)) + max (llcf, nv + max (nv, 3*p, 3*pv)); + + + if (pv == 0 || weight == 'R' || weight == 'N') + lleft = n*(p+5); + else + lleft = (n+nv) * (n + nv + max (n+nv, pv) + 5); + + if (mw == 0 || weight == 'L' || weight == 'N') + lright = n*(m+5); + else + lright = (n+nw) * (n + nw + max (n+nw, mw) + 5); + + ldwork = max (lminl, lminr, lrcf, + 2*n*n + max (1, lleft, lright, 2*n*n+5*n, n*max (m, p))); + + OCTAVE_LOCAL_BUFFER (int, iwork, liwork); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + + // error indicators + int iwarn = 0; + int info = 0; + + + // SLICOT routine AB09ID + F77_XFCN (ab09id, AB09ID, + (dico, jobc, jobo, job, + weight, equil, ordsel, + n, m, p, + nv, pv, nw, mw, + nr, + alpha, alphac, alphao, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + c.fortran_vec (), ldc, + d.fortran_vec (), ldd, + av.fortran_vec (), ldav, + bv.fortran_vec (), ldbv, + cv.fortran_vec (), ldcv, + dv.fortran_vec (), lddv, + aw.fortran_vec (), ldaw, + bw.fortran_vec (), ldbw, + cw.fortran_vec (), ldcw, + dw.fortran_vec (), lddw, + ns, + hsv.fortran_vec (), + tol1, tol2, + iwork, + dwork, ldwork, + iwarn, info)); + + if (f77_exception_encountered) + error ("modred: exception in SLICOT subroutine AB09ID"); + + + static const char* err_msg[] = { + "0: OK", + "1: the computation of the ordered real Schur form of A " + "failed", + "2: the separation of the ALPHA-stable/unstable " + "diagonal blocks failed because of very close " + "eigenvalues", + "3: the reduction to a real Schur form of the state " + "matrix of a minimal realization of V failed", + "4: a failure was detected during the ordering of the " + "real Schur form of the state matrix of a minimal " + "realization of V or in the iterative process to " + "compute a left coprime factorization with inner " + "denominator", + "5: if DICO = 'C' and the matrix AV has an observable " + "eigenvalue on the imaginary axis, or DICO = 'D' and " + "AV has an observable eigenvalue on the unit circle", + "6: the reduction to a real Schur form of the state " + "matrix of a minimal realization of W failed", + "7: a failure was detected during the ordering of the " + "real Schur form of the state matrix of a minimal " + "realization of W or in the iterative process to " + "compute a right coprime factorization with inner " + "denominator", + "8: if DICO = 'C' and the matrix AW has a controllable " + "eigenvalue on the imaginary axis, or DICO = 'D' and " + "AW has a controllable eigenvalue on the unit circle", + "9: the computation of eigenvalues failed", + "10: the computation of Hankel singular values failed"}; + + static const char* warn_msg[] = { + "0: OK", + "1: with ORDSEL = 'F', the selected order NR is greater " + "than NSMIN, the sum of the order of the " + "ALPHA-unstable part and the order of a minimal " + "realization of the ALPHA-stable part of the given " + "system; in this case, the resulting NR is set equal " + "to NSMIN.", + "2: with ORDSEL = 'F', the selected order NR corresponds " + "to repeated singular values for the ALPHA-stable " + "part, which are neither all included nor all " + "excluded from the reduced model; in this case, the " + "resulting NR is automatically decreased to exclude " + "all repeated singular values.", + "3: with ORDSEL = 'F', the selected order NR is less " + "than the order of the ALPHA-unstable part of the " + "given system; in this case NR is set equal to the " + "order of the ALPHA-unstable part.", +/* 10+%d: %d */ "violations of the numerical stability condition " + "occured during the assignment of eigenvalues in the " + "SLICOT Library routines SB08CD and/or SB08DD."}; + + + error_msg ("modred", info, 10, err_msg); + warning_msg ("modred", iwarn, 3, warn_msg, 10); + + // resize + a.resize (nr, nr); + b.resize (nr, m); + c.resize (p, nr); + hsv.resize (ns); + + // return values + retval(0) = a; + retval(1) = b; + retval(2) = c; + retval(3) = d; + retval(4) = octave_value (nr); + retval(5) = hsv; + retval(6) = octave_value (ns); + } + + return retval; +} Copied: trunk/octave-forge/main/control/src/sl_ab09jd.cc (from rev 10987, trunk/octave-forge/main/control/src/slab09jd.cc) =================================================================== --- trunk/octave-forge/main/control/src/sl_ab09jd.cc (rev 0) +++ trunk/octave-forge/main/control/src/sl_ab09jd.cc 2012-09-09 19:09:48 UTC (rev 10988) @@ -0,0 +1,404 @@ +/* + +Copyright (C) 2011 Lukas F. Reichlin + +This file is part of LTI Syncope. + +LTI Syncope 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 3 of the License, or +(at your option) any later version. + +LTI Syncope 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 LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +Model reduction based on Hankel-norm approximation method. +Uses SLICOT AB09JD by courtesy of NICONET e.V. +<http://www.slicot.org> + +Author: Lukas Reichlin <luk...@gm...> +Created: July 2011 +Version: 0.1 + +*/ + +#include <octave/oct.h> +#include <f77-fcn.h> +#include "common.h" + +extern "C" +{ + int F77_FUNC (ab09jd, AB09JD) + (char& JOBV, char& JOBW, char& JOBINV, + char& DICO, char& EQUIL, char& ORDSEL, + int& N, int& NV, int& NW, int& M, int& P, + int& NR, + double& ALPHA, + double* A, int& LDA, + double* B, int& LDB, + double* C, int& LDC, + double* D, int& LDD, + double* AV, int& LDAV, + double* BV, int& LDBV, + double* CV, int& LDCV, + double* DV, int& LDDV, + double* AW, int& LDAW, + double* BW, int& LDBW, + double* CW, int& LDCW, + double* DW, int& LDDW, + int& NS, + double* HSV, + double& TOL1, double& TOL2, + int* IWORK, + double* DWORK, int& LDWORK, + int& IWARN, int& INFO); +} + +// PKG_ADD: autoload ("__sl_ab09jd__", "__control_slicot_functions__.oct"); +DEFUN_DLD (__sl_ab09jd__, args, nargout, + "-*- texinfo -*-\n\ +Slicot AB09JD Release 5.0\n\ +No argument checking.\n\ +For internal use only.") +{ + int nargin = args.length (); + octave_value_list retval; + + if (nargin != 22) + { + print_usage (); + } + else + { + // arguments in + char jobv; + char jobw; + char jobinv; + char dico; + char equil; + char ordsel; + + Matrix a = args(0).matrix_value (); + Matrix b = args(1).matrix_value (); + Matrix c = args(2).matrix_value (); + Matrix d = args(3).matrix_value (); + + const int idico = args(4).int_value (); + const int iequil = args(5).int_value (); + int nr = args(6).int_value (); + const int iordsel = args(7).int_value (); + double alpha = args(8).double_value (); + + const int ijobv = args(9).int_value (); + Matrix av = args(10).matrix_value (); + Matrix bv = args(11).matrix_value (); + Matrix cv = args(12).matrix_value (); + Matrix dv = args(13).matrix_value (); + + const int ijobw = args(14).int_value (); + Matrix aw = args(15).matrix_value (); + Matrix bw = args(16).matrix_value (); + Matrix cw = args(17).matrix_value (); + Matrix dw = args(18).matrix_value (); + + const int ijobinv = args(19).int_value (); + double tol1 = args(20).double_value (); + double tol2 = args(21).double_value (); + + switch (ijobv) + { + case 0: + jobv = 'N'; + break; + case 1: + jobv = 'V'; + break; + case 2: + jobv = 'I'; + break; + case 3: + jobv = 'C'; + break; + case 4: + jobv = 'R'; + break; + default: + error ("__sl_ab09jd__: argument jobv invalid"); + } + + switch (ijobw) + { + case 0: + jobw = 'N'; + break; + case 1: + jobw = 'W'; + break; + case 2: + jobw = 'I'; + break; + case 3: + jobw = 'C'; + break; + case 4: + jobw = 'R'; + break; + default: + error ("__sl_ab09jd__: argument jobw invalid"); + } + + switch (ijobinv) + { + case 0: + jobinv = 'N'; + break; + case 1: + jobinv = 'I'; + break; + case 2: + jobinv = 'A'; + break; + default: + error ("__sl_ab09jd__: argument jobinv invalid"); + } + + if (idico == 0) + dico = 'C'; + else + dico = 'D'; + + if (iequil == 0) + equil = 'S'; + else + equil = 'N'; + + if (iordsel == 0) + ordsel = 'F'; + else + ordsel = 'A'; + + int n = a.rows (); // n: number of states + int nv = av.rows (); + int nw = aw.rows (); + int m = b.columns (); // m: number of inputs + int p = c.rows (); // p: number of outputs + + int lda = max (1, n); + int ldb = max (1, n); + int ldc = max (1, p); + int ldd = max (1, p); + + int ldav = max (1, nv); + int ldbv = max (1, nv); + int ldcv = max (1, p); + int lddv = max (1, p); + + int ldaw = max (1, nw); + int ldbw = max (1, nw); + int ldcw = max (1, m); + int lddw = max (1, m); + + // arguments out + int ns; + ColumnVector hsv (n); + + // workspace + int liwork; + int tmpc; + int tmpd; + + if (jobv == 'N') + tmpc = 0; + else + tmpc = max (2*p, nv+p+n+6, 2*nv+p+2); + + if (jobw == 'N') + tmpd = 0; + else + tmpd = max (2*m, nw+m+n+6, 2*nw+m+2); + + if (dico == 'C') + liwork = max (1, m, tmpc, tmpd); + else + liwork = max (1, n, m, tmpc, tmpd); + + int ldwork; + int nvp = nv + p; + int nwm = nw + m; + int ldw1; + int ldw2; + int ldw3 = n*(2*n + max (n, m, p) + 5) + n*(n+1)/2; + int ldw4 = n*(m+p+2) + 2*m*p + min (n, m) + max (3*m+1, min (n, m) + p); + + if (jobv == 'N') + { + ldw1 = 0; + } + else + { + ldw1 = 2*nvp*(nvp+p) + p*p + max (2*nvp*nvp + max (11*nvp+16, p*nvp), + nvp*n + max (nvp*n+n*n, p*n, p*m)); + } + + if (jobw == 'N') + { + ldw2 = 0; + } + else + { + ldw2 = 2*nwm*(nwm+m) + m*m + max (2*nwm*nwm + max (11*nwm+16, m*nwm), + nwm*n + max (nwm*n+n*n, m*n, p*m)); + } + + ldwork = max (ldw1, ldw2, ldw3, ldw4); + + OCTAVE_LOCAL_BUFFER (int, iwork, liwork); + OCTAVE_LOCAL_BUFFER (double, dwork, ldwork); + + // error indicators + int iwarn = 0; + int info = 0; + + + // SLICOT routine AB09JD + F77_XFCN (ab09jd, AB09JD, + (jobv, jobw, jobinv, + dico, equil, ordsel, + n, nv, nw, m, p, + nr, + alpha, + a.fortran_vec (), lda, + b.fortran_vec (), ldb, + c.fortran_vec (), ldc, + d.fortran_vec (), ldd, + av.fortran_vec (), ldav, + bv.fortran_vec (), ldbv, + cv.fortran_vec (), ldcv, + dv.fortran_vec (), lddv, + aw.fortran_vec (), ldaw, + bw.fortran_vec (), ldbw, + cw.fortran_vec (), ldcw, + dw.fortran_vec (), lddw, + ns, + hsv.fortran_vec (), + tol1, tol2, + iwork, + dwork, ldwork, + iwarn, info)); + + if (f77_exception_encountered) + error ("hnamodred: exception in SLICOT subroutine AB09JD"); + + + static const char* err_msg[] = { + "0: OK", + "1: the computation of the ordered real Schur form of A " + "failed", + + "2: the separation of the ALPHA-stable/unstable " + "diagonal blocks failed because of very close eigenvalues", + + "3: the reduction of AV to a real Schur form failed", + + "4: the reduction of AW to a real Schur form failed", + + "5: the reduction to generalized Schur form of the " + "descriptor pair corresponding to the inverse of V " + "failed", + + "6: the reduction to generalized Schur form of the " + "descriptor pair corresponding to the inverse of W " + "failed", + + "7: the computation of Hankel singular values failed", + + "8: the computation of stable projection in the " + "Hankel-norm approximation algorithm failed", + + "9: the order of computed stable projection in the " + "Hankel-norm approximation algorithm differs " + "from the order of Hankel-norm approximation", + + "10: the reduction of AV-BV*inv(DV)*CV to a " + "real Schur form failed", + + "11: the reduction of AW-BW*inv(DW)*CW to a " + "real Schur form failed", + + "12: the solution of the Sylvester equation failed " + "because the poles of V (if JOBV = 'V') or of " + "conj(V) (if JOBV = 'C') are not distinct from " + "the poles of G1 (see METHOD)", + + "13: the solution of the Sylvester equation failed " + "because the poles of W (if JOBW = 'W') or of " + "conj(W) (if JOBW = 'C') are not distinct from " + "the poles of G1 (see METHOD)", + + "14: the solution of the Sylvester equation failed " + "because the zeros of V (if JOBV = 'I') or of " + "conj(V) (if JOBV = 'R') are not distinct from " + "the poles of G1sr (see METHOD)", + + "15: the solution of the Sylvester equation failed " + "because the zeros of W (if JOBW = 'I') or of " + "conj(W) (if JOBW = 'R') are not distinct from " + "the poles of G1sr (see METHOD)", + + "16: the solution of the generalized Sylvester system " + "failed because the zeros of V (if JOBV = 'I') or " + "of conj(V) (if JOBV = 'R') are not distinct from " + "the poles of G1sr (see METHOD)", + + "17: the solution of the generalized Sylvester system " + "failed becau... [truncated message content] |
From: <mma...@us...> - 2012-09-08 20:02:46
|
Revision: 10987 http://octave.svn.sourceforge.net/octave/?rev=10987&view=rev Author: mmarzolla Date: 2012-09-08 20:02:40 +0000 (Sat, 08 Sep 2012) Log Message: ----------- Fixed build script Modified Paths: -------------- trunk/octave-forge/main/queueing/Makefile Modified: trunk/octave-forge/main/queueing/Makefile =================================================================== --- trunk/octave-forge/main/queueing/Makefile 2012-09-08 19:56:55 UTC (rev 10986) +++ trunk/octave-forge/main/queueing/Makefile 2012-09-08 20:02:40 UTC (rev 10987) @@ -52,7 +52,7 @@ ln $(DISTFILES) $(PROGNAME)/ tar cfz $(DISTNAME).tar.gz $(PROGNAME)/ uuencode $(DISTNAME).tar.gz < $(DISTNAME).tar.gz > $(DISTNAME).tar.gz.uue - ~/src/octave-3.6.1/run-octave -q --eval "pkg load generate_html; pkg install -local $(DISTNAME).tar.gz; generate_package_html ('queueing', 'queueing-html', 'octave-forge'); pkg uninstall $(PROGNAME)" + ~/src/octave-3.6.1/run-octave -qf --eval "pkg load generate_html; pkg install -local $(DISTNAME).tar.gz; pkg load queueing; generate_package_html ('queueing', 'queueing-html', 'octave-forge'); pkg uninstall $(PROGNAME)" tar cfz $(PROGNAME)-html.tar.gz $(PROGNAME)-html uuencode $(PROGNAME)-html.tar.gz < $(PROGNAME)-html.tar.gz > $(PROGNAME)-html.tar.gz.uue This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-09-08 19:57:01
|
Revision: 10986 http://octave.svn.sourceforge.net/octave/?rev=10986&view=rev Author: mmarzolla Date: 2012-09-08 19:56:55 +0000 (Sat, 08 Sep 2012) Log Message: ----------- Misc fixse for release 1.1.1 Modified Paths: -------------- trunk/octave-forge/main/queueing/ChangeLog trunk/octave-forge/main/queueing/DESCRIPTION trunk/octave-forge/main/queueing/DESCRIPTION.in trunk/octave-forge/main/queueing/NEWS trunk/octave-forge/main/queueing/doc/INSTALL trunk/octave-forge/main/queueing/doc/installation.txi Modified: trunk/octave-forge/main/queueing/ChangeLog =================================================================== --- trunk/octave-forge/main/queueing/ChangeLog 2012-09-08 17:16:55 UTC (rev 10985) +++ trunk/octave-forge/main/queueing/ChangeLog 2012-09-08 19:56:55 UTC (rev 10986) @@ -2,6 +2,7 @@ * Version 1.1.1 released * Increased tolerance in tests for dtmc_fpt and dtmc_mtta + * Disabled autoloading of this package on Octave startup 2012-04-05 Moreno Marzolla <mar...@cs...> Modified: trunk/octave-forge/main/queueing/DESCRIPTION =================================================================== --- trunk/octave-forge/main/queueing/DESCRIPTION 2012-09-08 17:16:55 UTC (rev 10985) +++ trunk/octave-forge/main/queueing/DESCRIPTION 2012-09-08 19:56:55 UTC (rev 10986) @@ -14,6 +14,6 @@ probabilities, mean time to absorption, time-averaged sojourn times). Categories: Misc Depends: octave (>= 3.2.3) -Autoload: yes -License: GPL version 3 or later +Autoload: no +License: GPLv3+ Url: http://www.moreno.marzolla.name/software/queueing/ Modified: trunk/octave-forge/main/queueing/DESCRIPTION.in =================================================================== --- trunk/octave-forge/main/queueing/DESCRIPTION.in 2012-09-08 17:16:55 UTC (rev 10985) +++ trunk/octave-forge/main/queueing/DESCRIPTION.in 2012-09-08 19:56:55 UTC (rev 10986) @@ -14,6 +14,6 @@ probabilities, mean time to absorption, time-averaged sojourn times). Categories: Misc Depends: octave (>= 3.2.3) -Autoload: yes -License: GPL version 3 or later +Autoload: no +License: GPLv3+ Url: http://www.moreno.marzolla.name/software/queueing/ Modified: trunk/octave-forge/main/queueing/NEWS =================================================================== --- trunk/octave-forge/main/queueing/NEWS 2012-09-08 17:16:55 UTC (rev 10985) +++ trunk/octave-forge/main/queueing/NEWS 2012-09-08 19:56:55 UTC (rev 10986) @@ -1,6 +1,32 @@ Summary of important user-visible changes for queueing-1.1.1 ------------------------------------------------------------------------------ +** queueing-1.1.1 is a bug fix release + ** Increased tolerance in tests for dtmc_fpt and dtmc_mtta to avoid - spurious failures on some platforms. + spurious failures on some platforms +** Set "Autoload: no" in the DESCRIPTION file. This means that this + package is no longer automatically loaded on Octave startup. To use + the queueing package you need to issue the command "pkg load + queueing" at the Octave prompt. + + +Summary of important user-visible changes for queueing-1.1.0 +------------------------------------------------------------------------------ + +** Function ctmc_exps() can now compute the expected sojourn time + until absorption for absorbing CTMC + +** Functions ctmc_exps() and ctmc_taexps() now accept a scalar as + the second argument (time). + +** Function ctmc_bd() now returns the infinitesimal generator matrix Q + of the birth-death process with given rates, not the steady-state + solution. + +** The following new functions have been added: dtmc_bd(), dtmc_mtta(), + ctmc_check_Q(), dtmc_exps(), dtmc_taexps() + +** The following deprecated functions have been removed: ctmc_bd_solve(), + ctmc_solve(), dtmc_solve() Modified: trunk/octave-forge/main/queueing/doc/INSTALL =================================================================== --- trunk/octave-forge/main/queueing/doc/INSTALL 2012-09-08 17:16:55 UTC (rev 10985) +++ trunk/octave-forge/main/queueing/doc/INSTALL 2012-09-08 19:56:55 UTC (rev 10986) @@ -38,8 +38,15 @@ octave:1>pkg list queueing Package Name | Version | Installation directory --------------+---------+----------------------- - queueing *| 1.1.1 | /home/moreno/octave/queueing-1.1.1 + queueing | 1.1.1 | /home/moreno/octave/queueing-1.1.1 + Note: Starting from version 1.1.1, `queueing' is no longer + automatically loaded on startup. To load the package you need to + issue the command `pkg load queueing' at the Octave prompt. To + automatically load `queueing' each time Octave starts, you can add + the command above to the startup script (`.octaverc' on Unix + systems). + Alternatively, you can first download `queueing' from Octave-Forge; then, to install the package in the system-wide location issue this command at the Octave prompt: Modified: trunk/octave-forge/main/queueing/doc/installation.txi =================================================================== --- trunk/octave-forge/main/queueing/doc/installation.txi 2012-09-08 17:16:55 UTC (rev 10985) +++ trunk/octave-forge/main/queueing/doc/installation.txi 2012-09-08 19:56:55 UTC (rev 10986) @@ -80,9 +80,18 @@ octave:1>@kbd{pkg list queueing} Package Name | Version | Installation directory --------------+---------+----------------------- - queueing *| @value{VERSION} | /home/moreno/octave/queueing-@value{VERSION} + queueing | @value{VERSION} | /home/moreno/octave/queueing-@value{VERSION} @end example +@quotation Note +Starting from version 1.1.1, @code{queueing} is no longer +automatically loaded on startup. To load the package you need to issue +the command @code{pkg load queueing} at the Octave prompt. To +automatically load @code{queueing} each time Octave starts, you can +add the command above to the startup script (@file{.octaverc} on Unix +systems). +@end quotation + Alternatively, you can first download @code{queueing} from Octave-Forge; then, to install the package in the system-wide location issue this command at the Octave prompt: @@ -107,7 +116,7 @@ @quotation Note Octave version 3.2.3 as shipped with Ubuntu 10.04 seems to ignore -@code{-local} and always tries to install the package on the system +@option{-local} and always tries to install the package on the system directory. @end quotation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-09-08 17:17:02
|
Revision: 10985 http://octave.svn.sourceforge.net/octave/?rev=10985&view=rev Author: mmarzolla Date: 2012-09-08 17:16:55 +0000 (Sat, 08 Sep 2012) Log Message: ----------- Prepare for release Modified Paths: -------------- trunk/octave-forge/main/queueing/ChangeLog trunk/octave-forge/main/queueing/DESCRIPTION trunk/octave-forge/main/queueing/Makefile trunk/octave-forge/main/queueing/NEWS trunk/octave-forge/main/queueing/doc/INSTALL Modified: trunk/octave-forge/main/queueing/ChangeLog =================================================================== --- trunk/octave-forge/main/queueing/ChangeLog 2012-09-08 17:12:40 UTC (rev 10984) +++ trunk/octave-forge/main/queueing/ChangeLog 2012-09-08 17:16:55 UTC (rev 10985) @@ -1,3 +1,8 @@ +2012-09-08 Moreno Marzolla <mar...@cs...> + + * Version 1.1.1 released + * Increased tolerance in tests for dtmc_fpt and dtmc_mtta + 2012-04-05 Moreno Marzolla <mar...@cs...> * Version 1.1.0 released Modified: trunk/octave-forge/main/queueing/DESCRIPTION =================================================================== --- trunk/octave-forge/main/queueing/DESCRIPTION 2012-09-08 17:12:40 UTC (rev 10984) +++ trunk/octave-forge/main/queueing/DESCRIPTION 2012-09-08 17:16:55 UTC (rev 10985) @@ -1,6 +1,6 @@ Name: queueing -Version: 1.1.0 -Date: 2012-04-05 +Version: 1.1.1 +Date: 2012-09-08 Author: Moreno Marzolla <mar...@cs...> Maintainer: Moreno Marzolla <mar...@cs...> Title: Queueing networks and Markov chains analysis package for GNU Octave Modified: trunk/octave-forge/main/queueing/Makefile =================================================================== --- trunk/octave-forge/main/queueing/Makefile 2012-09-08 17:12:40 UTC (rev 10984) +++ trunk/octave-forge/main/queueing/Makefile 2012-09-08 17:16:55 UTC (rev 10985) @@ -1,5 +1,5 @@ -VERSIONNUM=1.1.0 -VERSIONDATE="2012-04-05" +VERSIONNUM=1.1.1 +VERSIONDATE="2012-09-08" PROGNAME=queueing DISTNAME=$(PROGNAME)-$(VERSIONNUM) Modified: trunk/octave-forge/main/queueing/NEWS =================================================================== --- trunk/octave-forge/main/queueing/NEWS 2012-09-08 17:12:40 UTC (rev 10984) +++ trunk/octave-forge/main/queueing/NEWS 2012-09-08 17:16:55 UTC (rev 10985) @@ -1,18 +1,6 @@ -Summary of important user-visible changes for queueing-1.1.0 +Summary of important user-visible changes for queueing-1.1.1 ------------------------------------------------------------------------------ -** Function ctmc_exps() can now compute the expected sojourn time - until absorption for absorbing CTMC +** Increased tolerance in tests for dtmc_fpt and dtmc_mtta to avoid + spurious failures on some platforms. -** Functions ctmc_exps() and ctmc_taexps() now accept a scalar as - the second argument (time). - -** Function ctmc_bd() now returns the infinitesimal generator matrix Q - of the birth-death process with given rates, not the steady-state - solution. - -** The following new functions have been added: dtmc_bd(), dtmc_mtta(), - ctmc_check_Q(), dtmc_exps(), dtmc_taexps() - -** The following deprecated functions have been removed: ctmc_bd_solve(), - ctmc_solve(), dtmc_solve() Modified: trunk/octave-forge/main/queueing/doc/INSTALL =================================================================== --- trunk/octave-forge/main/queueing/doc/INSTALL 2012-09-08 17:12:40 UTC (rev 10984) +++ trunk/octave-forge/main/queueing/doc/INSTALL 2012-09-08 17:16:55 UTC (rev 10985) @@ -16,7 +16,7 @@ 1.1 Installation through Octave package management system ========================================================= -The most recent version of `queueing' is 1.1.0 and can be downloaded +The most recent version of `queueing' is 1.1.1 and can be downloaded from Octave-Forge `http://octave.sourceforge.net/queueing/' @@ -38,13 +38,13 @@ octave:1>pkg list queueing Package Name | Version | Installation directory --------------+---------+----------------------- - queueing *| 1.1.0 | /home/moreno/octave/queueing-1.1.0 + queueing *| 1.1.1 | /home/moreno/octave/queueing-1.1.1 Alternatively, you can first download `queueing' from Octave-Forge; then, to install the package in the system-wide location issue this command at the Octave prompt: - octave:1> pkg install _queueing-1.1.0.tar.gz_ + octave:1> pkg install _queueing-1.1.1.tar.gz_ (you may need to start Octave as root in order to allow the installation to copy the files to the target locations). After this, @@ -53,7 +53,7 @@ If you do not have root access, you can do a local install using: - octave:1> pkg install -local queueing-1.1.0.tar.gz + octave:1> pkg install -local queueing-1.1.1.tar.gz This will install `queueing' within your home directory, and the package will be available to your user only. @@ -72,8 +72,8 @@ If you want to manually install `queueing' in a custom location, you can download the tarball and unpack it somewhere: - tar xvfz queueing-1.1.0.tar.gz - cd queueing-1.1.0/queueing/ + tar xvfz queueing-1.1.1.tar.gz + cd queueing-1.1.1/queueing/ Copy all `.m' files from the `inst/' directory to some target location. Then, start Octave with the `-p' option to add the target This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-09-08 17:12:46
|
Revision: 10984 http://octave.svn.sourceforge.net/octave/?rev=10984&view=rev Author: mmarzolla Date: 2012-09-08 17:12:40 +0000 (Sat, 08 Sep 2012) Log Message: ----------- Removed comment in documentation block which caused problems to generate_package_html Modified Paths: -------------- trunk/octave-forge/main/queueing/inst/qnmh1.m Modified: trunk/octave-forge/main/queueing/inst/qnmh1.m =================================================================== --- trunk/octave-forge/main/queueing/inst/qnmh1.m 2012-09-08 16:50:10 UTC (rev 10983) +++ trunk/octave-forge/main/queueing/inst/qnmh1.m 2012-09-08 17:12:40 UTC (rev 10984) @@ -1,4 +1,5 @@ ## Copyright (C) 2009 Dmitry Kolesnikov +## Copyright (C) 2012 Moreno Marzolla ## ## This file is part of the queueing toolbox. ## @@ -84,8 +85,6 @@ ## ## @end table ## -## @c @seealso{qnmhr1} -## ## @end deftypefn ## Author: Dmitry Kolesnikov This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mma...@us...> - 2012-09-08 16:50:16
|
Revision: 10983 http://octave.svn.sourceforge.net/octave/?rev=10983&view=rev Author: mmarzolla Date: 2012-09-08 16:50:10 +0000 (Sat, 08 Sep 2012) Log Message: ----------- Increased tolerance in tests Modified Paths: -------------- trunk/octave-forge/main/queueing/inst/dtmc_fpt.m trunk/octave-forge/main/queueing/inst/dtmc_mtta.m trunk/octave-forge/main/queueing/inst/qnvisits.m Modified: trunk/octave-forge/main/queueing/inst/dtmc_fpt.m =================================================================== --- trunk/octave-forge/main/queueing/inst/dtmc_fpt.m 2012-09-07 20:54:56 UTC (rev 10982) +++ trunk/octave-forge/main/queueing/inst/dtmc_fpt.m 2012-09-08 16:50:10 UTC (rev 10983) @@ -138,5 +138,5 @@ %! P(8,[7 5 9]) = 1/3; %! P(9,[6 8]) = .5; %! M = dtmc_fpt(P); -%! assert( M(1:9 != 5,5)', [6 5 6 5 5 6 5 6], 10*eps ); +%! assert( M(1:9 != 5,5)', [6 5 6 5 5 6 5 6], 100*eps ); Modified: trunk/octave-forge/main/queueing/inst/dtmc_mtta.m =================================================================== --- trunk/octave-forge/main/queueing/inst/dtmc_mtta.m 2012-09-07 20:54:56 UTC (rev 10982) +++ trunk/octave-forge/main/queueing/inst/dtmc_mtta.m 2012-09-08 16:50:10 UTC (rev 10983) @@ -158,9 +158,9 @@ %!test %! P = dtmc_bd([0 .5 .5 .5 .5], [.5 .5 .5 .5 0]); %! [t N B] = dtmc_mtta(P); -%! assert( t(2:5), [4 6 6 4], 10*eps ); -%! assert( B(2:5,1), [.8 .6 .4 .2]', 10*eps ); -%! assert( B(2:5,6), [.2 .4 .6 .8]', 10*eps ); +%! assert( t(2:5), [4 6 6 4], 100*eps ); +%! assert( B(2:5,1), [.8 .6 .4 .2]', 100*eps ); +%! assert( B(2:5,6), [.2 .4 .6 .8]', 100*eps ); ## Compute the probability of completing the "snakes and ladders" ## game in n steps, for various values of n. Also, computes the expected Modified: trunk/octave-forge/main/queueing/inst/qnvisits.m =================================================================== --- trunk/octave-forge/main/queueing/inst/qnvisits.m 2012-09-07 20:54:56 UTC (rev 10982) +++ trunk/octave-forge/main/queueing/inst/qnvisits.m 2012-09-08 16:50:10 UTC (rev 10983) @@ -189,7 +189,7 @@ %! P(2,3,2,1) = 0.2; %! P(2,4,2,1) = 0.16; %! lambda = [0.1 0 0 0.1 ; 0 0 0.2 0.1]; -%! lambda_sum = sum(sum(lambda)); +%! lambda_sum = sum(lambda(:)); %! V = qnvisits(P, lambda); %! assert( all( all(V>=0) ) ); %! for i=1:K @@ -413,7 +413,7 @@ ## solve the traffic equation A = eye(K*C) - reshape(P,[K*C K*C]); - b = reshape(lambda / sum(sum(lambda)), [1,K*C]); + b = reshape(lambda / sum(lambda(:)), [1,K*C]); V = reshape(b/A, [C, K]); endif ## Make sure that no negative values appear (sometimes, numerical This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-09-07 20:55:06
|
Revision: 10982 http://octave.svn.sourceforge.net/octave/?rev=10982&view=rev Author: prnienhuis Date: 2012-09-07 20:54:56 +0000 (Fri, 07 Sep 2012) Log Message: ----------- Unintended auto-indenting fixed Modified Paths: -------------- trunk/octave-forge/main/io/INDEX trunk/octave-forge/main/io/NEWS trunk/octave-forge/main/io/PKG_ADD trunk/octave-forge/main/io/PKG_DEL trunk/octave-forge/main/io/doc/READ-ODS.html trunk/octave-forge/main/io/doc/READ-XLS.html trunk/octave-forge/main/io/inst/calccelladdress.m trunk/octave-forge/main/io/inst/chk_spreadsheet_support.m trunk/octave-forge/main/io/inst/getusedrange.m trunk/octave-forge/main/io/inst/io_ods_testscript.m trunk/octave-forge/main/io/inst/io_xls_testscript.m trunk/octave-forge/main/io/inst/object2json.m trunk/octave-forge/main/io/inst/oct2ods.m trunk/octave-forge/main/io/inst/oct2xls.m trunk/octave-forge/main/io/inst/ods2oct.m trunk/octave-forge/main/io/inst/odsclose.m trunk/octave-forge/main/io/inst/odsfinfo.m trunk/octave-forge/main/io/inst/odsopen.m trunk/octave-forge/main/io/inst/odsread.m trunk/octave-forge/main/io/inst/odswrite.m trunk/octave-forge/main/io/inst/parse_sp_range.m trunk/octave-forge/main/io/inst/parsecell.m trunk/octave-forge/main/io/inst/pch2mat.m trunk/octave-forge/main/io/inst/spsh_chkrange.m trunk/octave-forge/main/io/inst/spsh_prstype.m trunk/octave-forge/main/io/inst/xls2oct.m trunk/octave-forge/main/io/inst/xlsclose.m trunk/octave-forge/main/io/inst/xlsfinfo.m trunk/octave-forge/main/io/inst/xlswrite.m trunk/octave-forge/main/io/src/cell2csv.cc trunk/octave-forge/main/io/src/csv2cell.cc trunk/octave-forge/main/io/src/csvconcat.cc trunk/octave-forge/main/io/src/csvexplode.cc trunk/octave-forge/main/io/src/xmlread.cc trunk/octave-forge/main/io/src/xmltree.c trunk/octave-forge/main/io/src/xmltree.h trunk/octave-forge/main/io/src/xmltree_read.c trunk/octave-forge/main/io/src/xmltree_read.h Modified: trunk/octave-forge/main/io/INDEX =================================================================== --- trunk/octave-forge/main/io/INDEX 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/INDEX 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,45 +1,44 @@ io >> Input from and output to external formats - File I/O - append_save - fexist - Miscellaneous conversion functions - object2json - pch2mat - CSV file functions - csv2cell - csvconcat - csvexplode - cell2csv - XML I/O - xmlread - xmlwrite - Spreadsheet I/O user functions for MS-Excel - oct2xls - xls2oct - xlsclose - xlsfinfo - xlsopen - xlsread - xlswrite - Spreadsheet I/O user functions for OpenOffice.org Calc - oct2ods - ods2oct - odsclose - odsfinfo - odsopen - odsread - odswrite - Spreadsheet utility functions - calccelladdress - chk_spreadsheet_support - parsecell - Spreadsheet I/O internal functions - getusedrange - parse_sp_range - spsh_chkrange - spsh_prstype - Spreadsheet function test scripts - io_xls_testscript - io_ods_testscript - - \ No newline at end of file +File I/O + append_save + fexist +Miscellaneous conversion functions + object2json + pch2mat +CSV file functions + csv2cell + csvconcat + csvexplode + cell2csv +XML I/O + xmlread + xmlwrite +Spreadsheet I/O user functions for MS-Excel + oct2xls + xls2oct + xlsclose + xlsfinfo + xlsopen + xlsread + xlswrite +Spreadsheet I/O user functions for OpenOffice.org Calc + oct2ods + ods2oct + odsclose + odsfinfo + odsopen + odsread + odswrite +Spreadsheet utility functions + calccelladdress + chk_spreadsheet_support + parsecell +Spreadsheet I/O internal functions + getusedrange + parse_sp_range + spsh_chkrange + spsh_prstype +Spreadsheet function test scripts + io_xls_testscript + io_ods_testscript + Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/NEWS 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,147 +1,146 @@ Summary of important user-visible changes for releases of the io package - - =============================================================================== - io-1.0.20 Release Date: 2012-09-07 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixes: - --- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call - with make_absolute_filename for non-windows systems (canonicalize_file_name - doesn't work with non-existent (new) files on *nix) (bug #36677); - Web addresses (URLs) only need two rather than three slashes; - --- xlsopen: matching .jar names to javaclasspath entries worked the wrong way - --- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to - avoid lock-ups with recent LibreOffice (3.6.x) - - ** The annoying flashing LibreOffice splash screens have been fixed upstream; - with LibreOffice 3.6.1 I didn't see them anymore - - ** Extended file rename section in odsclose similar to that in xlsclose - - =============================================================================== - io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixes: - --- getusedrange subfunc getusedrange_jod: str2num applied to indices rather - than the substring. Must have been there for > 2 years, only surfaced - with jopendocument v 1.3b1 - --- oct2xls, oct2ods: cast all numeric types in input array to double as - spreadsheets have only double, boolean or character string type. This bug - has been there from the very beginning of the spreadsheet functions >8-O - - --- Support for reading back formulas from .xls spreadsheets using ActiveX/COM - - ** Compatible with jOpenDocument version 1.3b1 - getUsedRange() method added (MUCH faster than the old hack) - - ** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) - - ** Compatible with Apache POI 3.8 final - - =============================================================================== - io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis - =============================================================================== - - ** The following functions have been imported from the miscellaneous package: - cell2csv csvconcat xmlread - csv2cell csvexplode xmlwrite - Their error messages and help messages have been cleaned up a bit. - - ** Bug fixes: - --- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. - --- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. - --- csv2cell: checks if file is empty and if so, return an empty cell. - --- xlsopen: better Java detection logic, more informative error messages - - ** Adapted to internal LibreOffice-3.5-final changes. - Some bugs (flashing LO screens) still have to be fixed upstream - see here: - https://bugs.freedesktop.org/show_bug.cgi?id=42470 - - ** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. - - =============================================================================== - io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixes: - --- oct2ods, oct2xls, odswrite default range input arg. These functions may not - have worked properly for two years (!) - - ** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works - well with xercesImpl.jar 2.9.1 (Sep 14, 2009) - - ** Many small bug fixes & documentation updated to actual functionality. - - ** Fixed "seealso" texinfo header string in almost all functions. - - ** Added formal test scripts to "internal functions" section. - - =============================================================================== - io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis - =============================================================================== - - ** Bug fixing release - - ** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java - (for MinGW) - - =============================================================================== - io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis - =============================================================================== - - io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current - development status (some still a bit experimental). It mainly comprises: - - ** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); - - ** Some mainly cosmetic improvements to existing code; less verbosity; - - ** pch2mat (reading & transforming Nastran PCH files, contributed by - B. Oytun Peksel); - - ** object2json.m (creating a json description string of objects, contributed - by Daniel Torre). This was already silently introduced in io-1.0.14; - - ** A scripted troubleshooting / classpath setup tool for spreadsheet I/O - support (chk_spreadsheet_support.m); - - ** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). - OpenXLS is -let's say- a little bit lacking: For reading it is faster than - JXL. However, while OXS write support has been coded (and works) I had to - disable it as the OXS Java classes won't release the file handle so Octave - will hang upon closing :-( I'm stuck with this so I just release it as-is; - - ** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like - LibreOffice) behind the scenes to read spreadsheet files, much like - ActiveX/COM for MS-Excel. This is also based on Java. The first time you - use UNO, OOo has to be loaded and you'll have to be patient, but once loaded - (and in the OS cache) you'll see the pros: - --* Very fast; - --* Much lower Java memory usage as OOo loads the spreadsheet in its own - memory chunk (not Octave's) => much bigger spreadsheet capacity; - --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, - .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter - whether xlsopen of odsopen is used. - Of course all this wonderful stuff comes at a prize: - --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo - invocations will be closed, also those started outside Octave. This is - due to "the way OpenOffice works" (quoted from OOo dev forum), especially - through Java. There are other ways to close OOo but they'll hang Octave; - --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite - up-to-date with the main program. As a consequence, with e.g., - LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I - filed a bug report for this - (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen - it being picked up yet. Another example: while LO 3.3.1's row capacity - was already > 10^6, it took until LO 3.4 before this capacity was - implemented in the Java UNO classes. - Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. - - Hint: - for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps - flag. You'll then loose the old and buggy textread and csv/dlm-read/write - functions but I'd consider that as no big loss. - - <please scroll up/back to see rest of io NEWS> - \ No newline at end of file + +=============================================================================== +io-1.0.20 Release Date: 2012-09-07 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixes: +--- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call + with make_absolute_filename for non-windows systems (canonicalize_file_name + doesn't work with non-existent (new) files on *nix) (bug #36677); + Web addresses (URLs) only need two rather than three slashes; +--- xlsopen: matching .jar names to javaclasspath entries worked the wrong way +--- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to + avoid lock-ups with recent LibreOffice (3.6.x) + +** The annoying flashing LibreOffice splash screens have been fixed upstream; + with LibreOffice 3.6.1 I didn't see them anymore + +** Extended file rename section in odsclose similar to that in xlsclose + +=============================================================================== +io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixes: +--- getusedrange subfunc getusedrange_jod: str2num applied to indices rather + than the substring. Must have been there for > 2 years, only surfaced + with jopendocument v 1.3b1 +--- oct2xls, oct2ods: cast all numeric types in input array to double as + spreadsheets have only double, boolean or character string type. This bug + has been there from the very beginning of the spreadsheet functions >8-O + +--- Support for reading back formulas from .xls spreadsheets using ActiveX/COM + +** Compatible with jOpenDocument version 1.3b1 + getUsedRange() method added (MUCH faster than the old hack) + +** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) + +** Compatible with Apache POI 3.8 final + +=============================================================================== +io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis +=============================================================================== + +** The following functions have been imported from the miscellaneous package: + cell2csv csvconcat xmlread + csv2cell csvexplode xmlwrite + Their error messages and help messages have been cleaned up a bit. + +** Bug fixes: +--- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. +--- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. +--- csv2cell: checks if file is empty and if so, return an empty cell. +--- xlsopen: better Java detection logic, more informative error messages + +** Adapted to internal LibreOffice-3.5-final changes. + Some bugs (flashing LO screens) still have to be fixed upstream - see here: + https://bugs.freedesktop.org/show_bug.cgi?id=42470 + +** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. + +=============================================================================== +io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixes: +--- oct2ods, oct2xls, odswrite default range input arg. These functions may not + have worked properly for two years (!) + +** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works + well with xercesImpl.jar 2.9.1 (Sep 14, 2009) + +** Many small bug fixes & documentation updated to actual functionality. + +** Fixed "seealso" texinfo header string in almost all functions. + +** Added formal test scripts to "internal functions" section. + +=============================================================================== +io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis +=============================================================================== + +** Bug fixing release + +** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java + (for MinGW) + +=============================================================================== +io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis +=============================================================================== + +io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current + development status (some still a bit experimental). It mainly comprises: + +** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); + +** Some mainly cosmetic improvements to existing code; less verbosity; + +** pch2mat (reading & transforming Nastran PCH files, contributed by + B. Oytun Peksel); + +** object2json.m (creating a json description string of objects, contributed + by Daniel Torre). This was already silently introduced in io-1.0.14; + +** A scripted troubleshooting / classpath setup tool for spreadsheet I/O + support (chk_spreadsheet_support.m); + +** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). + OpenXLS is -let's say- a little bit lacking: For reading it is faster than + JXL. However, while OXS write support has been coded (and works) I had to + disable it as the OXS Java classes won't release the file handle so Octave + will hang upon closing :-( I'm stuck with this so I just release it as-is; + +** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like + LibreOffice) behind the scenes to read spreadsheet files, much like + ActiveX/COM for MS-Excel. This is also based on Java. The first time you + use UNO, OOo has to be loaded and you'll have to be patient, but once loaded + (and in the OS cache) you'll see the pros: + --* Very fast; + --* Much lower Java memory usage as OOo loads the spreadsheet in its own + memory chunk (not Octave's) => much bigger spreadsheet capacity; + --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, + .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter + whether xlsopen of odsopen is used. + Of course all this wonderful stuff comes at a prize: + --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo + invocations will be closed, also those started outside Octave. This is + due to "the way OpenOffice works" (quoted from OOo dev forum), especially + through Java. There are other ways to close OOo but they'll hang Octave; + --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite + up-to-date with the main program. As a consequence, with e.g., + LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I + filed a bug report for this + (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen + it being picked up yet. Another example: while LO 3.3.1's row capacity + was already > 10^6, it took until LO 3.4 before this capacity was + implemented in the Java UNO classes. + Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. + +Hint: +for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps + flag. You'll then loose the old and buggy textread and csv/dlm-read/write + functions but I'd consider that as no big loss. + + <please scroll up/back to see rest of io NEWS> Modified: trunk/octave-forge/main/io/PKG_ADD =================================================================== --- trunk/octave-forge/main/io/PKG_ADD 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/PKG_ADD 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,16 +1,16 @@ ## PKG_ADD - ## add paths of io pkg java jars if java pkg is installed and loaded - pkglist = pkg ("list"); - javapkgind = find (cellfun (@(x) strcmp(x.name, "java"), pkglist), 1, "first"); - if (! isempty (javapkgind)) - javapkg = pkglist{javapkgind}; - if (javapkg.loaded) - # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out - libdir = octave_config_info ("libdir"); - ## Allow time for package to be fully loaded - pause (0.25); - spr_status = chk_spreadsheet_support ([ libdir filesep "java" ]); - endif - endif - ## Clean up - clear javapkgind javapkg libdir spr_status pkglist ; \ No newline at end of file +## add paths of io pkg java jars if java pkg is installed and loaded +pkglist = pkg ("list"); +javapkgind = find (cellfun (@(x) strcmp(x.name, "java"), pkglist), 1, "first"); +if (! isempty (javapkgind)) + javapkg = pkglist{javapkgind}; + if (javapkg.loaded) + # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out + libdir = octave_config_info ("libdir"); + ## Allow time for package to be fully loaded + pause (0.25); + spr_status = chk_spreadsheet_support ([ libdir filesep "java" ]); + endif +endif +## Clean up +clear javapkgind javapkg libdir spr_status pkglist ; \ No newline at end of file Modified: trunk/octave-forge/main/io/PKG_DEL =================================================================== --- trunk/octave-forge/main/io/PKG_DEL 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/PKG_DEL 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,8 +1,7 @@ ## PKG_DEL - ## - ## Below are base names of spreadsheet I/O Java class libs. - ## They'll stay (harmless) in the javaclasspath until termination of the current Octave session. - ## {'poi-3', 'poi-ooxml-3', xbean', 'poi-ooxml-schemas', 'dom4j-1.6.1', 'jxl', 'openxls', ... - ## 'odfdom', 'xercesImpl', 'jopendocument', ... - ## 'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'} - \ No newline at end of file +## +## Below are base names of spreadsheet I/O Java class libs. +## They'll stay (harmless) in the javaclasspath until termination of the current Octave session. +## {'poi-3', 'poi-ooxml-3', xbean', 'poi-ooxml-schemas', 'dom4j-1.6.1', 'jxl', 'openxls', ... +## 'odfdom', 'xercesImpl', 'jopendocument', ... +## 'program', 'unoil', 'jurt', 'juh', 'unoloader', 'ridl'} Modified: trunk/octave-forge/main/io/doc/READ-ODS.html =================================================================== --- trunk/octave-forge/main/io/doc/READ-ODS.html 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/doc/READ-ODS.html 2012-09-07 20:54:56 UTC (rev 10982) @@ -170,8 +170,7 @@ <b>odsopen</b> / <b>ods2oct</b> / \x85 / <b>oct2ods</b> / \x85. / <b>odsclose</b>, <b><u><i>DO NOT FORGET</i></u></b> to invoke <b>odsclose</b> in the end. The file pointers can contain an enormous amount of data and - may needlessly keep precious memory allocated. In case of the UNO interface, the - hidden OpenOffice.org invocation (soffice.bin) can even block proper closing of + may needlessly keep precious memory allocated. In case of the UNO interface, the hidden OpenOffice.org invocation (soffice.bin) can even block proper closing of Octave.</font></font></p></dt><dt><br> </dt></dl> <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>SPREADSHEET Modified: trunk/octave-forge/main/io/doc/READ-XLS.html =================================================================== --- trunk/octave-forge/main/io/doc/READ-XLS.html 2012-09-07 15:44:24 UTC (rev 10981) +++ trunk/octave-forge/main/io/doc/READ-XLS.html 2012-09-07 20:54:56 UTC (rev 10982) @@ -1,333 +1,332 @@ <HTML> - <HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> - <META NAME="Generator" CONTENT="Microsoft Word 97"> - <META NAME="CREATED" CONTENT="20091211;17230700"> - <META NAME="CHANGEDBY" CONTENT="Philip Nienhuis"> - <META NAME="CHANGED" CONTENT="20120226;18083900"> - </HEAD> - <BODY LINK="#0000ff" VLINK="#800080"> - - <P><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"></P> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P ALIGN="CENTER">README for Excel spreadsheet file r/w access scripts for octave (> 3.4.0)<BR> - <BR> - Copyright (C) 2009 - 2012 Philip Nienhuis <prnienhuis at users.sf.net><BR> - <BR> - This version September 7, 2012</P> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">EXCEL .XLS SUPPORT FILES</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - <B>doc/README-XLS.html</B><BR> - This file.</FONT></FONT> </DT><BR> - <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DT>xlsread.m</DT> - </B><DT>All-in-one function for reading data from one specific worksheet in an Excel spreadsheet file. This script has Matlab-compatible functionality. <BR> - </DT><BR> - <B>xlswrite.m</B> - <DT>All-in-one function for writing data to one specific worksheet in an Excel spreadsheet file. This script has Matlab-compatible functionality.<BR> - <BR> - <B>xlsfinfo.m</B> - <DT>All-in-one function for exploring basic properties of an Excel spreadsheet file. This script has Matlab-compatible functionality. <BR> - <BR> - <B>xlsopen.m</B></DT> - <DT>Function for "opening" (= providing a handle to) an Excel spreadsheet file ("workbook"). This function sorts out which interface to use for .xls access (i.e.,COM; Java & Apache POI; JexcelAPI; OpenXLS; etc.), but it's choice can be overridden. <BR> - <BR> - <B>xls2oct.m</B></DT> - <DT>Function for reading data from a specific worksheet pointed to in a struct created by xlsopen.m. xls2oct can be called multiple times consecutively using the same pointer struct, each time allowing to read data from different ranges and/or worksheets. Data are returned in the form of a 2D heterogeneous cell array that can be parsed by parsecell.m. xls2oct is a mere wrapper for interface-dependent scripts that do the actual low-level reading. <BR> - <BR> - <B>oct2xls.m</B></DT> - <DT>Function for writing data to a specific worksheet pointed to in a struct created by xlsopen.m. octxls can be called multiple times consecutively using the same pointer struct, each time allowing to write data to different ranges and/or worksheets. oct2xls is a mere wrapper for interface-dependent scripts that do the actual low-level writing. <BR> - <BR> - <B>xlsclose.m</B></DT> - <DT>Function for closing (the handle to) an Excel workbook. When data have been written to the workbook oct2xls will write the workbook to disk. Otherwise, the file pointer is simply closed and possibly used interfaces for Excel access (COM/ActiveX/Excel.exe) will be shut down properly. <BR> - <BR> - <B>parsecell.m</B></DT> - <DT>Function for separating the data in raw arrays returned by xls2oct, into numerical/logical and text (cell) arrays. <BR> - <BR> - <B>chk_spreadsheet_support.m</B></DT> - <DT>Internal function for (1) checking, (2) setting up, (3) debugging spreadsheet support. While not specifically meant for direct invocation from the Octave prompt (it is more useful during initialization of Octave itself) it can be very helpful when hunting down issues with spreadsheet support in Octave.</DT> - </DL> - <B>spsh_chkrange.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>spsh_prstype.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>getusedrange.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>calccelladdress.m</B>,</FONT></FONT> <B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>parse_sp_range.m - </B> - <DT>Support files called by the scripts and not meant for direct invocation by users.<BR></DT> - <BR> - <DT><B>io_xls_testscript.m</B></DT> - <DT>Script for testing basic features of the spreadsheet scripts.</DT> - </DL> - <P ALIGN="CENTER"><BR> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4>REQUIRED SUPPORT SOFTWARE</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - For the Excel/COM interface:</DT> - </DL> - - <UL> - <LI>A windows computer with Excel installed</LI> - <LI>Octave-forge Windows-1.0.8 (WITH LATEST SVN PATCHES APPLIED) or later package (preferrably 1.1.10 or later)</LI></UL> - - <P>For the Java / Apache POI / JExcelAPI interfaces (general):</FONT></FONT> </P> - - <UL> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><LI>octave-forge java-1.2.8 package or later version on Linux</LI> - <LI>octave-forge java-1.2.8 with latest svn fixes, or later version on Windows/MingW</LI> - <LI>Java JRE or JDK > 1.6.0 (hasn't been tested with earlier versions)</LI></UL> - - <DL> - <DT>Apache POI specific:</DT> - </DL> - - <UL> - <LI>class .jars: <B>poi-3.5-FINAL-<date>.jar</B> & <B>poi-ooxml-3.5-FINAL-<date>.jar</B> (or later versions) in classpath</LI> - <LI>Get it here: </FONT></FONT><A HREF="http://poi.apache.org/download.html"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://poi.apache.org/download.html</FONT></FONT></A></LI></UL> - <DIR> - <DIR> - - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>and here:</P></DIR> - </DIR> - - - <UL> - <LI>for OOXML support (only available with Apache POI): </LI></UL> - <DIR> - <DIR> - - <B><P>poi-ooxml-schemas-<version>.jar</B>, <B>xbean.jar</B>, <B>dom4j-1.6.1.jar</B> in javaclasspath. </P> - <P>Get them here:</P> - </FONT></FONT><P><A HREF="http://poi.apache.org/download.html"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://poi.apache.org/download.html</FONT></FONT></A><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2> ("xmlbeans" and poi-ooxml-schemas)</P> - </FONT></FONT><P><A HREF="http://sourceforge.net/projects/dom4j/files"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/projects/dom4j/files</FONT></FONT></A><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2> (dom4j-<version>)</P></DIR> - </DIR> - - <DL> - <DT>JExcelAPI specific:</DT> - </DL> - - <UL> - <LI>class .jar: <B>jxl.jar</B> in classpath</LI> - <LI>Get it here: </FONT></FONT><A HREF="http://sourceforge.net/projects/jexcelapi/files/"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/projects/jexcelapi/files/</FONT></FONT></A></LI></UL> - - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>OpenXLS specific:</DT> - </DL> - - <UL> - <LI>class .jar: <B>jxl.jar</B> in classpath</LI> - <LI>Get it here: </FONT></FONT><A HREF="http://sourceforge.net/projects/openxls/"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/projects/openxls/</FONT></FONT></A></LI></UL> - - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>These class libs must be referenced with full pathnames in your javaclasspath.<br>They had best be put in /<libdir>/java where <libdir> on Linux is usually /usr/lib; on MinGW it is usually /lib. The PKG_ADD command expects the class libs there; if they are elsewhere, add them in ./share/octave/<version>/m/startup/octaverc using appropriate javaaddpath statements or a chk_spreadsheet_support() call.</DT></DL> - <DL><DT>UNO specific (invoking OpenOffice.org (or clones) behind the scenes):<BR> - NOTE: EXPERIMENTAL!! A working OpenOffice.org installation. The utility function chk_spreadsheet_support can be used to add the needed entries to the javaclasspath.<BR></DT> - </DL> - <P ALIGN="CENTER"><BR> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4>USAGE</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - <B>xlsread</B> and <B>xlswrite</B> are mere wrappers for <B>xlsopen</B>-<B>xls2oct</B>-<B>xlsclose</B>-<B>parsecell</B> and <B>xlsopen</B>-<B>oct2xls</B>-<B>xlsclose</B> sequences, resp. They exist for the sake of Matlab compatibility.<BR> - <BR> - <B>xlsfinf</B>o can be used for finding out what worksheet names exist in the file. For OOXML files you either need MS-Excel 2007 for Windows (or later version) installed, and/or the input parameter REQINTF should be specified with a value of 'poi' (case-insensitive) and -obviously- the complete POI interface must have been installed.<BR> - <BR> - Invoking <B>xlsopen</B>/..../<B>xlsclose</B> directly provides for much more flexibility, speed, and robustness than <B>xlsread</B> / <B>xlswrite</B>. Indeed, using the same file handle (pointer struct) you can mix reading & writing before writing the workbook out to disk using xlsclose.<BR> - And: <B>xlsopen </B>/ <B>xlsclose</B> hide the gory interface details from the user.<BR> - Currently only .xls files (BIFF8) can be read/written; using JExcelAPI BIFF5 can be read as well. For OOXML files either Excel 2007 for Windows (or higher) and/or the complete Apache POI interface must be installed (and probably the REQINTF parameter specified with a value of 'poi').<BR> - <BR> - When using <B>xlsopen</B>....<B>xlsclose</B> be sure to keep track of the file handle struct.<BR> - <BR> - A possible scenario:<BR> - <BR> - <B>xlh = xlsopen (<excel_filename> , [rw], [<requested interface>])</B><BR> - <I># Set rw to 1 if you want to write to a workbook immediately.<BR> - # In that case the check for file existence is skipped and<BR> - # -if needed- a new workbook created.<BR> - # If you really want an other interface than auto-selected<BR> - # by xlsopen you can request that. But xlsopen still checks<BR> - # proper support for your choice.</I><BR> - <BR> - <I># Read some data</I><BR> - <B>[ rawarr1, xlh ] = xls2oct (xlh, <SomeWorksheet>, <Range>)</B><BR> - <I># Be sure to specify xlh as output argument as xls2oct keeps<BR> - # track of changes and the need to write the workbook to disk <BR> - # in the xlhstruct. And the origin range is conveyed through<BR> - # the xlh pointer struct.</I><BR> - <BR> - <I># Separate data into numeric and text data</I><BR> - <B>[ numarr1, txtarr1, lim1 ] = parsecell (rawarr1)</B><BR> - <I><BR> - </I># Get more data from another worksheet in the same workbook<BR> - <B>[ rawarr2, xlh ] = xls2oct (xlh, <SomeOtherWorksheet>, <Range>)</B><BR> - <B>[ numarr2, txtarr2, lim2 ] = parsecell (rawarr2)</B><BR> - <BR> - # <... Analysis and preparation of new data in cell array Newdata....><BR> - <BR> - <I># Add new data to spreadsheet</I><BR> - <B>xlh = oct2xls (Newdata, xlh, <AnotherWorksheet>, <Range>)</B><BR> - <BR> - <I># Close the workbook and write it to disk; then clear the handle</I><BR> - <B>xlh = xlsclose (xlh)</B><BR> - <B>clear xlh</DT> - </B><DT>When not using the COM interface, specify a value of 'POI' for parameter REQINTF when accessing OOXML files in xlsread, xlswrite, xlsopen, xlsfinfo (and be sure the complete Apache POI interface is installed). If you haven't got ActiveX installed (i.e., not having MS-Excel under Windows) specifying 'POI' may not be needed as in such cases Apache POI is the next default interface.</DT> - <DT>When using JExcelAPI (JXL), after writing into a worksheet you MUST save the file \x96 adding data to the same or another worksheet is no more possible after the first call to oct2xls(). This is a limitation of JExcelAPI.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">SPREADSHEET FORMULA SUPPORT</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - When using the COM, POI, JXL, and UNO interfaces you can:</DT> - </DL> - - <UL> - <LI>(When reading, xls2oct) either read evaluated spreadsheet formula results, or the literal formula text strings;</LI> - <LI>(When writing, oct2xls) either enter text strings in the form of spreadsheet formulas in the worksheet as formulas, or enter them as literal text strings.</LI></UL> - - <P>In short, you can enter spreadsheet formulas and in a later stage read them back, change them and re-enter them in the worksheet. </P> - <DL> - <DT>The behaviour is controlled by an option structure <B>options</B></FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>which for now has only one (logical) field:</DT> - <B><DT>options.formulas_as_text</B></FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>= 0 (the default) implies enter formulas as formulas and read back formula results</DT> - <B><DT>options.formulas_as_text </B>=1 (or any positive integer) means enter formulas as text strings and read them back as text strings.</DT> - <DT>Be aware that there's no formula evaluator in JExcelAPI (JXL). So if you create formulas in your spreadsheet using oct2xls or xlswrite with 'JXL', do not expect meaningful results when reading those files later on <B>unless</B></FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>you open them in Excel and write them back to disk.</DT> - <DT>While both Apache POI and JExcelAPI feature a formula validator, not all spreadsheet functions present in Excel have been implemented (yet).</DT> - <DT>Worse, older Excel versions feature less functions than newer versions. So be wary as this may make for interesting confusion.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">MATLAB COMPATIBILITY</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT><BR> - <B>xlsread</B>, <B>xlswrite</B> and <B>xlsfinfo</B> are for the most part Matlab-compatible. Some small differences are mentioned below. When using the Java interfaces octave supplies some formula manipulation support.<BR> - <BR> - <B><U>xlsread</B></U><BR> - Matlab's <B>xlsread</B> supports invoking extra functions while reading ("passing function handle"); octave not. But this can be simulated outside <B>xlsread</B>.<BR> - <BR> - Matlab's <B>xlsread</B> flags some spreadsheet errors, octave-forge just returns blank cells.<BR> - <BR> - Octave's xlsread returns info about the actual (rather than the requested) cell range where the data came from. Personally I find it very useful to know from what part of a worksheet the data originate so I've put quite some effort in it :-)</DT> - <DT>Matlab can't, due to Excel automatically trimming returned arrays from empty outer columns and rows. Octave is more clever but the Visual Basic call used for determining the actually used range has some limitations: (1) it relies on cached range values and thus may be out-of-date, and (2) it counts empty formatted cells too. When using ActiveX/COM, if octave's <B>xlsfinfo</B>.m returns wrong data ranges it is most often an overestimation.</DT> - <DT>Matlab's <B>xlsread</B> ignores all non-numeric data values outside the smallest rectangle encompassing all numerical values. Octave's <B>xlsread</B> doesn't. This means that Matlab ignores all row/column headers, not very user-friendly IMO. <BR> - <BR> - When using the Java interface, reading and writing xls-files by octave's xlsread is platform-independent. On systems w/o installed Excel, Matlab can only read Excel 95 formatted .xls files (written using ML <B>xlswrite</B>'s 'Basic" option) \x96 and then differently than under Windows.....</DT> - <DT>Matlab's <B>xlsread</B> returns strings for cells containing date values. This makes for endless if-then-elseif-else-end constructs to catch all expected date formates. Octave returns numerical data (where 0 = 1/1/1900 \x96 you can easily transfer them into proper octave date values yourself using e.g. datestr(), see bottom of this document for more info).<BR> - <BR> - Matlab's <B>xlsread</B> invokes <B>csvread</B> if no Excel interface is present. Octave's <B>xlsread</B> doesn't.<BR> - <BR> - <B><U>xlswrite</B></U><BR> - Octave's <B>xlswrite</B> works on systems w/o Excel support, Matlab's doesn't (properly).</DT> - <DT>When specifying a sheet number larger than the number of existing sheets in an .xls file, Matlab's <B>xlswrite</B> adds empty sheets until the new sheet number is created; Octave's <B>xlswrite</B> only adds one sheet called "Sheet<number>" where <number> is the specified sheet number. </DT> - <DT>Even better (IMO) while M's <B>xlswrite</B> always creates Sheet1/Sheet2/Sheet3 when creating a new spreadsheet, octave's <B>xlswrite</B> only creates the requested worksheet. (Did you know that you can instruct Excel to create spreadsheets with just one, or any number of, worksheets? Look in Tools | Options, General tab.)</DT> - <DT>Oh and octave doesn't touch the "active sheet" - but that's not automatically an advantage.</DT> - <DT>If the specified write range is larger than the actual data array, Matlab's <B>xlswrite</B> adds #N/A cells to fill up the lowermost rows and rightmost columns; octave-forge's <B>xlswrite</B> doesn't. <BR> - <BR> - <B>xlsfinfo</B><BR> - When invoking Excel/COM interface, octave's <B>xlsfinfo</B> also echoes the type of sheet (worksheet, chart), not just the sheet names. Using Java I haven't found similar functionality (yet).</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">COMPARISON OF INTERFACES & USAGE</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>Using Excel itself (through <b>COM / ActiveX</b> on Windows systems) is probably the most robust and versatile and especially FAST option. There's one gotcha: in case of some type of COM errors Excel will keep running invisibly; you can only end it through Task Manager. <BR> - A tiny problem is that one cannot find out easily through COM what file types are supported; xls, wks, wk1, xlsx, etc. <BR> - Another -obvious- limitation is that COM Excel access only works on Windows systems where Excel is installed. <BR> - <BR> - <b>JExcelAPI</b> (Java-based and therefore platform-independent) is proven technology but switching between reading and writing is quite involved and memory-hungry when processing large spreadsheets. As the docs state, JExcelAPI is optimized for reading and it does do that well - but still slower than Excel/COM. The fact that upon a switch from reading to writing the existing spreadsheet is overwritten <B>in place</B> by a blank one and that you can only get the contents back wen writing out all of the changes is worrying - and any change after the first write() is lost as a next write() doesn't seem to work, worse yet, you may completely loose the spreadsheet in question. The first is by JExcelAPI design, the second is probably a bug (in octave-forge/Java or JExcelAPI ? I don't know). Adding data to existing spreadsheets does work, but IMO undue user confidence is needed.</DT> - <DT>JExcelAPI supports BIFF5 (only reading) and BIFF8 (Excel 95 and Excel 97-2003, respectively). Upon overwriting, BIFF5 spreadsheets are converted silently to BIFF8.</DT> - <DT>JexcelAPI, unlike ApachePOI, doesn't evaluate functions while reading but instead relies on cached results (i.e. results computed by Excel itself). Depending on Excel settings ("Automatic calculation" ON or OFF) this may or may not yield incorrect (or expected) results. <BR> - <BR> - <b>Apache POI</b> (Java-based and platform-independent too) is based on the OpenOffice.org I/O Excel r/w routines. It is a more versatile than JExcelAPI, while it doesn't support BIFF5 it does support BIFF8 (Excel 97 \x96 2003) and OOXML (Excel 2007).</DT> - <DT>It is slower than native JXL let alone Excel & COM but it features active formula evaluation, although at the moment (v. 3.8) still not all Excel functions have been implemented. I've made the relevant subfunction (xls2jpoi2oct) fall back to cached formula results (and yield a suitable warning) for non-implemented Excel functions while reading Excel files. <BR> - <BR> - <b>OpenXLS</b> (an open source version of Extentech's commercial Java-xls product) is still experimental. It seems to work faster than JExcelAPI, but it has other issues - i.e., it locks the .xls file and the unlocking mechanism is a bit wonky. Sometimes xls files keep being locked until Octave is shut down. Currently OXS write support is disabled (but the code is there). OpenXLS doesn't support reading back formulas as text strings.<BR> - <BR> - <b>UNO</b> (invoking OpenOffice.org or clones behind the scenes, a la ActiveX) is experimental. It works FAST (i.e., once OOo itself is loaded which can take some time) and can process much larger spreadsheets than the other Java-based interfaces because the data are not entered in the JVM but in OOo's memory.<BR> - A big stumbling block is that odsclose() on a UNO xls struct will kill ALL OpenOffice.org invocations, also those that were not related to Octave! This is due to UNO-Java limitations.<br> - The underlying issue is that when Octave starts an OpenOffice.org invocation, OpenOffice.org must be closed for Octave to be able to exit; otherwise Octave will wait for OOo to shut down before it can terminate itself. So Octave must kill OOo to be able to terminate.<br> - A way out hasn't been found yet.<br><br> - All in all, of the three Java options I'd prefer Apache POI rather than OpenXLS or JexcelAPI. But the latter is indispensable for BIFF5 formats. Once UNO is stable it is to be preferred as it can read ALL file formats supported by OOo (viz. wk1, ods, xlsx, sxc, ...)</DT> - <DT><br>Some notes on the choice for Java:</DT> - </DL> - <OL> - - <LI>It saves a LOT of development time to use ready-baked Java classes rather than developing your own routines and thus effectively reinvent the wheel.</LI> - <LI>A BIG advantage is that a Java-based solution is platform-independent ("portable").</LI> - <LI>But Java is known to be not very conservative with resources, especially not when processing XML-based formats.</LI></OL> - - <DL> - <DT>So Java is a compromise between portability and rapid development time versus capacity (and speed).</DT> - <DT>But IMO data sets larger than 5.10<SUP>5</SUP> cells should not be kept in spreadsheets anyway. Better use real databases for such data sets.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">A NOTE ON JAVA MEMORY USAGE</P> - </U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>Java memory pool allocation size</P> - </B><DL> - <DT>The Java virtual machine (JVM), when initialized by octave, reserves one big chunk of your computer's RAM in which all java classes and methods etc. are to be loaded: the java memory pool. It does this because java has a very sophisticated "garbage collection" system. At least on Windows, the initial size is 2MB and the maximum size is 16 MB. On Linux this allocated size might differ (e.g., my Mandriva box with openJDK has a 512 MB default max setting). This part of memory is where the Java-based XLS/ODS octave routines live and keep their variables etc.</DT> - <DT>For transferring large pieces of information to and from spreadsheets you might hit the limits of this pool. E.g. to be able to handle I/O of an array of around 500,000 cells I needed a memory pool size of 512 MB.</DT> - <DT>The memory size can be increased by inserting a file called "java.opts" (without quotes) in the directory ./share/octave/packages/java-<version> (where the script file javaclasspath.m is located), containing just the following lines:</DT> - </FONT></FONT><B><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><DT>-Xms16m<BR> - -Xmx512m</DT> - </B></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DT>(where 16 = initial size, 512 = maximum size (in this example), m stands for Megabyte. This maximum is system-dependent. E.g., I have a 1 GB setting).</DT> - <DT>After processing a large chunk of spreadsheet information you might notice that octave's memory footprint does not shrink so it looks like Java's memory pool does not shrink back; but rest assured, the memory footprint is the <I>allocated</I> (reserved) memory size, not the actual used size. After the JVM has done its garbage collection, only the so-called "working set" of the memory allocation is really in use and that is a trimmed-down part of the memory allocation pool. On Windows systems it often suffices to minimize the octave terminal for a few seconds to get a more reasonable memory footprint.</DT> - </DL> - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">TROUBLESHOOTING</P> - </B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>Some hints for troubleshooting Excel support are contained in this thread:</DT> - </FONT></FONT><DT><A HREF="http://sourceforge.net/mailarchive/forum.php?thread_name=4C61B649.9090802%40hccnet.nl&forum_name=octave-dev"><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>http://sourceforge.net/mailarchive/forum.php?thread_name=4C61B649.9090802%40hccnet.nl&forum_name=octave-dev</FONT></FONT></A></DT> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DT>dated August 10, 2010.</DT> - <DT>A more structured approach is below.<BR> - <BR> - Since April 2011 a special purpose setup file has been included in the io package (chk_spreadsheet_support.m). Large parts of the approach below (starting at Step 2) have been automated in this script. When running it with the second input argument (debug level) set to 3 a lot of useful diagnostic output will be printed to screen.</DT> - </DL> - <OL> - - <LI>Check if COM / ActiveXworks (only under Windows OS). Do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg list </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>and see</LI> - </FONT></FONT><P>a. <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>If there's a windows package mentioned (then it's installed). If not, install it.</P> - <P>b. If there's an asterisk on the windows package line (then the package is loaded). If not, do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg load windows</FONT></FONT> </P> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><LI>Check if the ActiveX server works. Do:</LI> - </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>exl = actxserver ('Excel.Application')</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>## Note the period between "Excel" and "Application"</P> - <P>If a COM object is returned, ActiveX / COM / Excel works. Do: </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>exl.Quit(); delete (exl)</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>to shut down the (hidden) Excel invocation.</P> - <P>If you get an error message, your last resort is re-installing the windows package, or trying the Java-based interfaces.</P> - <LI>Check if java works. Do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg list </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>and see</LI></OL> - <DIR> - <DIR> - - </FONT></FONT><P>a. <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>If there's a java package mentioned (then it's installed). If not, install it.</P> - <P>b. If there's an asterisk on the java package line (then the package is loaded). If not, do a </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>pkg rebuild -auto java</P></DIR> - </DIR> - - <OL START=4> - - </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><LI>Check Java memory settings. Try </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>javamem</LI> - </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>a. If it works, check if it reports sufficiently large max memory (had better be 200 MiB, the bigger the better)</P> - <P>b. If it doesn't work, do:</FONT></FONT> </P> - <FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>rt = java_invoke ('java.lang.Runtime', 'getRuntime')<BR> - rt.gc<BR> - rt.maxMemory ().doubleValue () / 1024 / 1024</P> - </FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P>The last command will show MaxMemory in MiB.<br></P> - <P>c. In case you have insufficient memory, see in "GOTCHAS", "Java memory pool allocation size", how to increase java's memory pre-reservation.</P> - <LI>Check if all classes (.jarfiles) are in class path. Do a '</FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>javaclasspath</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>' (under unix/linux, do '</FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>tmp = javaclasspath; strsplit (tmp,":")</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>' (w/o quotes). See above under "REQUIRED SUPPORT SOFTWARE" what classes should be mentioned.</LI></OL> - <DIR> - <DIR> - - <P>If classes (.jar files) are missing, download and put them somewhere and add them to the javaclass path with their fully qualified pathname (in quotes) using </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>javaaddpath()</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>.</P></DIR> - </DIR> - - <P>Once all classes are present and in the javaclasspath, the xls interfaces should just work. The only remaining showstoppers are insufficient write privileges for the working directory, a wrecked up octave or some other problem outside octave.</P> - <OL START=6> - - <LI>Try opening an xls file: </LI></OL> - <DIR> - <DIR> - - </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>xls1 = xlsopen ('test.xls', 1, 'poi')</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>. If this works and xls1 is a struct with various fields containing objects, the Apache POI interface (POI) works. Do an </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>xls1 = xlsclose (xls1)</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>to close the file.</P> - </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2><P>xls2 = xlsopen ('test.xls', 1, 'jxl')</FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>. If this works and xls2 is a struct with various fields containing objects, the JExcelAPI interface (JXL) works as well. Don't forget to do </FONT></FONT><FONT FACE="Courier New, monospace" SIZE=2><FONT FACE="Courier New, monospace" SIZE=2>xls2 = xlsclose (xls2)</FONT></FONT> <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2>to close the file.</P></DIR> - </DIR> - - </FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">DEVELOPMENT</P> - </U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DT>xlsopen</B>/<B>xlsclos</B>e and friends have been written so that adding other interfaces (Perl? native octave? ...?) should be very easily accomplished. <B>Xlsopen.m</B> merely needs two stanzas, <B>xlsfinfo.m</B> and <B>getusedrange.m</B> each need an additional elseif stanza, and <B>xlsclose.m</B> needs a small stanza for closing the pointer struct and writing to disk. </DT> - <DT>The real work lies in creating the relevant <B><I>xls2<...>2oct</B></I> & <B><I>oct2<...>2xls</B></I> & <B><I><getusedrange_...></B></I> subfunction scripts in <B>xls2oct.m</B>, <B>oct2xls.m</B> and <B>getusedrange.m</B>, resp., but that shouldn't be really hard, depending on the interface support libraries' quality and documentation. Separating the file access functions and the actual reading/writing from/to the workbook in memory has made developer's life (I mean: my time developing this stuff) much easier.<BR> - <BR> - Some other options for development (who?):</DT> - </DL> - - <UL> - <LI>Speeding up, especially Java worksheet/cell access. For cracks, not me.</LI> - <LI>Automatic conversion of Excel date/time values into octave ones and vice versa (adding or subtracting 636960). But then again Excel's dates are 01-01-1900 based (octave's 0-0-0000) and buggy (Excel thinks 1900 is a leap year), and I sometimes have to use dates from before 1900. Maybe as an option?</LI> - <LI>Creating Excel graphs (a significant enterprise to write from scratch).</LI> - <LI>Support for "passing function handle" in xlsread.</LI></UL> - - <P>Enjoy!</FONT></FONT> </P> - <FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> - <DD ALIGN="CENTER">Philip Nienhuis, September 7, 2012</DD> - </DL></FONT></FONT></BODY> - </HTML> - \ No newline at end of file +<HEAD> +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> +<META NAME="Generator" CONTENT="Microsoft Word 97"> +<META NAME="CREATED" CONTENT="20091211;17230700"> +<META NAME="CHANGEDBY" CONTENT="Philip Nienhuis"> +<META NAME="CHANGED" CONTENT="20120226;18083900"> +</HEAD> +<BODY LINK="#0000ff" VLINK="#800080"> + +<P><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"></P> +<FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><P ALIGN="CENTER">README for Excel spreadsheet file r/w access scripts for octave (> 3.4.0)<BR> +<BR> +Copyright (C) 2009 - 2012 Philip Nienhuis <prnienhuis at users.sf.net><BR> +<BR> +This version September 7, 2012</P> +</FONT></FONT><B><U><FONT FACE="Arial, sans-serif" SIZE=4><FONT FACE="Arial, sans-serif" SIZE=4><P ALIGN="CENTER">EXCEL .XLS SUPPORT FILES</P> +</B></U></FONT></FONT><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-serif" SIZE=2><DL> +<DT><BR> +<B>doc/README-XLS.html</B><BR> +This file.</FONT></FONT> </DT><BR> +<B><FONT FACE="Arial, sans-serif" SIZE=2><FONT FACE="Arial, sans-s... [truncated message content] |
From: <car...@us...> - 2012-09-07 15:44:30
|
Revision: 10981 http://octave.svn.sourceforge.net/octave/?rev=10981&view=rev Author: carandraug Date: 2012-09-07 15:44:24 +0000 (Fri, 07 Sep 2012) Log Message: ----------- image: now dependent on >=3.6.0 due to nthargout on regionprops Modified Paths: -------------- trunk/octave-forge/main/image/DESCRIPTION trunk/octave-forge/main/image/NEWS Modified: trunk/octave-forge/main/image/DESCRIPTION =================================================================== --- trunk/octave-forge/main/image/DESCRIPTION 2012-09-07 15:24:49 UTC (rev 10980) +++ trunk/octave-forge/main/image/DESCRIPTION 2012-09-07 15:44:24 UTC (rev 10981) @@ -9,7 +9,7 @@ The package also provides functions for feature extraction, image statistics, spatial and geometric transformations, morphological operations, linear filtering, and much more. -Depends: octave (>= 3.4.0), signal +Depends: octave (>= 3.6.0), signal Autoload: no License: GPLv3+, simplified BSD Url: http://octave.sf.net Modified: trunk/octave-forge/main/image/NEWS =================================================================== --- trunk/octave-forge/main/image/NEWS 2012-09-07 15:24:49 UTC (rev 10980) +++ trunk/octave-forge/main/image/NEWS 2012-09-07 15:44:24 UTC (rev 10981) @@ -76,4 +76,6 @@ and return a matrix of the values found. Its documentation has been expanded (as well as an explanation of TIFF structure on the source) + ** Package is now dependent on GNU Octave version 3.6.0 or later. + ** Package is no longer automatically loaded. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2012-09-07 15:24:55
|
Revision: 10980 http://octave.svn.sourceforge.net/octave/?rev=10980&view=rev Author: jordigh Date: 2012-09-07 15:24:49 +0000 (Fri, 07 Sep 2012) Log Message: ----------- bwlabeln.cc: Add a few comments about the union-find data structure. Modified Paths: -------------- trunk/octave-forge/main/image/src/bwlabeln.cc trunk/octave-forge/main/image/src/union-find.h++ Modified: trunk/octave-forge/main/image/src/bwlabeln.cc =================================================================== --- trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-07 15:21:39 UTC (rev 10979) +++ trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-07 15:24:49 UTC (rev 10980) @@ -282,6 +282,9 @@ the pixel belong to object number 2, etc. The total number of objects\n\ is @var{num}.\n\ \n\ +The algorithm used is a disjoint-set data structure, a.k.a. union-find.\n\ +See, for example, http://en.wikipedia.org/wiki/Union-find\n\ +\n\ @seealso{bwconncomp, bwlabel, regionprops}\n\ @end deftypefn\n\ ") Modified: trunk/octave-forge/main/image/src/union-find.h++ =================================================================== --- trunk/octave-forge/main/image/src/union-find.h++ 2012-09-07 15:21:39 UTC (rev 10979) +++ trunk/octave-forge/main/image/src/union-find.h++ 2012-09-07 15:24:49 UTC (rev 10980) @@ -24,6 +24,8 @@ class union_find { + // Union-find data structure, see e.g. + // http://en.wikipedia.org/wiki/Union-find private: std::vector<voxel*> voxels; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2012-09-07 15:21:46
|
Revision: 10979 http://octave.svn.sourceforge.net/octave/?rev=10979&view=rev Author: jordigh Date: 2012-09-07 15:21:39 +0000 (Fri, 07 Sep 2012) Log Message: ----------- bwlabeln.cc: Remove dead code, reformat copyright, fix typo in mask8 Modified Paths: -------------- trunk/octave-forge/main/image/src/bwlabeln.cc Modified: trunk/octave-forge/main/image/src/bwlabeln.cc =================================================================== --- trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-07 15:13:33 UTC (rev 10978) +++ trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-07 15:21:39 UTC (rev 10979) @@ -1,17 +1,18 @@ -// Copyright (C) 2011 Jordi Gutiérrez Hermoso <jo...@oc...> +// Copyright (C) 2011-2012 Jordi Gutiérrez Hermoso <jo...@oc...> // -// This program 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 3 of the License, or (at your option) any later -// version. +// This program 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 3 of the +// License, or (at your option) any later version. // -// This program 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. +// This program 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 -// this program; if not, see <http://www.gnu.org/licenses/>. +// You should have received a copy of the GNU General Public License +// along with this program; if not, see +// <http://www.gnu.org/licenses/>. // bwlabeln.cc --- @@ -88,20 +89,6 @@ inline coord -operator+ (const coord& a, const coord& b) -{ - octave_idx_type na = a.nelem (); - coord retval( dim_vector(na,1) ); - for (octave_idx_type i = 0; i < na; i++) - { - retval(i) = a(i) + b(i); - } - return retval; -} - - -inline -coord operator- (const coord& a, const coord& b) { octave_idx_type na = a.nelem (); @@ -169,7 +156,7 @@ static bool mask8[] = {1, 1, 1, 1, 0, 1, - 1, 0, 1}; + 1, 1, 1}; static bool mask6[] = {0, 0, 0, 0, 1, 0, @@ -264,6 +251,11 @@ get_padded_index (octave_idx_type r, const dim_vector& dv) { + // This function converts a linear index from the unpadded array + // into a linear index of the array with zero padding around it. I + // worked it out on paper, but if you want me to explain this, I'd + // have to work it out again. ;-) --jgh + octave_idx_type mult = 1; octave_idx_type padded = 0; for (octave_idx_type j = 0; j < dv.length (); j++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2012-09-07 15:13:42
|
Revision: 10978 http://octave.svn.sourceforge.net/octave/?rev=10978&view=rev Author: jordigh Date: 2012-09-07 15:13:33 +0000 (Fri, 07 Sep 2012) Log Message: ----------- bwlabeln: Fix type checking of inputs Modified Paths: -------------- trunk/octave-forge/main/image/src/bwlabeln.cc Modified: trunk/octave-forge/main/image/src/bwlabeln.cc =================================================================== --- trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-07 14:52:03 UTC (rev 10977) +++ trunk/octave-forge/main/image/src/bwlabeln.cc 2012-09-07 15:13:33 UTC (rev 10978) @@ -304,9 +304,9 @@ return rval; } - if (!args(0).is_bool_type ()) + if (!args(0).is_numeric_type () && !args(0).is_bool_type ()) { - error ("bwlabeln: first input argument must be a 'logical' ND-array"); + error ("bwlabeln: first input argument must be an ND array"); return rval; } @@ -331,7 +331,7 @@ else conn_mask = get_mask (N); } - else if (args(2).is_bool_type() ) + else if (args(2).is_numeric_type () || args(2).is_bool_type ()) { conn_mask = args(2).bool_array_value (); dim_vector conn_mask_dims = conn_mask.dims (); @@ -349,7 +349,7 @@ } else error ("bwlabeln: second input argument must be a real scalar " - "or a 'logical' connectivity array"); + "or a connectivity array"); } else // Get the maximal mask that has same number of dims as BW. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2012-09-07 14:52:11
|
Revision: 10977 http://octave.svn.sourceforge.net/octave/?rev=10977&view=rev Author: jordigh Date: 2012-09-07 14:52:03 +0000 (Fri, 07 Sep 2012) Log Message: ----------- Overhaul regionprops for Nd images Modified Paths: -------------- trunk/octave-forge/main/image/inst/regionprops.m Modified: trunk/octave-forge/main/image/inst/regionprops.m =================================================================== --- trunk/octave-forge/main/image/inst/regionprops.m 2012-09-07 14:21:03 UTC (rev 10976) +++ trunk/octave-forge/main/image/inst/regionprops.m 2012-09-07 14:52:03 UTC (rev 10977) @@ -1,4 +1,5 @@ ## Copyright (C) 2010 Soren Hauberg <so...@ha...> +## Copyright (C) 2012 Jordi Gutiérrez Hermoso <jo...@oc...> ## ## This program 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 @@ -95,45 +96,72 @@ if (nargin < 1) error ("regionprops: not enough input arguments"); endif - - if (!ismatrix (bw) || ndims (bw) != 2) - error ("regionprops: first input argument must be a NxM matrix"); - endif if (numel (varargin) == 0) - properties = "basic"; - elseif (numel (varargin) == 1 && iscellstr (varargin {1})) - properties = varargin {1}; + properties = {"basic"}; + elseif (numel (varargin) == 1 && iscellstr (varargin{1})) + properties = varargin{1}; elseif (iscellstr (varargin)) properties = varargin; else error ("regionprops: properties must be a cell array of strings"); endif + + properties = lower (properties); + + all_props = {"Area", "EulerNumber", "BoundingBox", "Extent", "Perimeter",\ + "Centroid", "PixelIdxList", "FilledArea", "PixelList",\ + "FilledImage", "Image", "MaxIntensity", "MinIntensity",\ + "WeightedCentroid", "MeanIntensity", "PixelValues",\ + "Orientation"}; - if (ischar (properties) && strcmpi (properties, "basic")) - properties = {"Area", "Centroid", "BoundingBox"}; - elseif (ischar (properties) && strcmpi (properties, "all")) - properties = {"area", "eulernumber", "boundingbox", "extent", "perimeter", ... - "centroid", "pixelidxlist", "filledarea", "pixellist", ... - "filledimage", "image", "maxintensity", "minintensity", ... - "weightedcentroid", "meanintensity", "pixelvalues"}; - elseif (!iscellstr (properties)) + if (ismember ("basic", properties)) + properties = union (properties, {"Area", "Centroid", "BoundingBox"}); + properties = setdiff (properties, "basic"); + endif + + if (ismember ("all", properties)) + properties = all_props; + endif + + if (!iscellstr (properties)) error ("%s %s", "regionprops: properties must be specified as a list of", "strings or a cell array of strings"); endif + ## Fix capitalisation, underscores of user-supplied properties... + for k = 1:numel (properties) + property = lower (strrep(properties{k}, "_", "")); + [~, idx] = ismember (property, lower (all_props)); + if (!idx) + error ("regionprops: unsupported property: %s", property); + endif + properties(k) = all_props{idx}; + endfor + + N = ndims (bw); + ## Get a labelled image if (!islogical (bw) && all (bw >= 0) && all (bw == round (bw))) L = bw; # the image was already labelled num_labels = max (L (:)); + elseif (N > 2) + [L, num_labels] = bwlabeln (bw); else [L, num_labels] = bwlabel (bw); endif + ## Return an empty struct with specified properties if there are no labels + if num_labels == 0 + retval = struct ([properties; repmat({{}}, size(properties))]{:}); + return; + endif + ## Compute the properties retval = struct (); - for k = 1:numel (properties) - switch (lower (properties {k})) + for property = lower(properties) + property = property{:}; + switch (property) case "area" for k = 1:num_labels retval (k).Area = local_area (L == k); @@ -153,18 +181,23 @@ for k = 1:num_labels bb = local_boundingbox (L == k); area = local_area (L == k); - retval (k).Extent = area / (bb (3) * bb (4)); + idx = length (bb)/2 + 1; + retval (k).Extent = area / prod (bb(idx:end)); endfor case "perimeter" - for k = 1:num_labels - retval (k).Perimeter = sum (bwperim (L == k) (:)); - endfor + if (N > 2) + warning ("regionprops: skipping perimeter for Nd image"); + else + for k = 1:num_labels + retval (k).Perimeter = sum (bwperim (L == k) (:)); + endfor + endif case "centroid" for k = 1:num_labels - [Y, X] = find (L == k); - retval (k).Centroid = [mean(X), mean(Y)]; + C = all_coords (L == k); + retval (k).Centroid = [mean(C)]; endfor case {"pixelidxlist", "pixel_idx_list"} @@ -179,8 +212,8 @@ case {"pixellist", "pixel_list"} for k = 1:num_labels - [Y, X] = find (L == k); - retval (k).PixelList = [X, Y]; + C = all_coords (L == k, true, true); + retval (k).PixelList = C; endfor case {"filledimage", "filled_image"} @@ -191,8 +224,10 @@ case "image" for k = 1:num_labels tmp = (L == k); - [R, C] = find (tmp); - retval (k).Image = tmp (min (R):max (R), min (C):max (C)); + C = all_coords (tmp, false); + idx = arrayfun (@(x,y) x:y, min (C), max (C), "unif", 0); + idx = substruct ("()", idx); + retval (k).Image = subsref (tmp, idx); endfor case {"maxintensity", "max_intensity"} @@ -202,20 +237,20 @@ case {"minintensity", "min_intensity"} for k = 1:num_labels - retval (k).MaxIntensity = min (bw (L == k) (:)); + retval (k).MinIntensity = min (bw (L == k) (:)); endfor case {"weightedcentroid", "weighted_centroid"} for k = 1:num_labels - [Y, X] = find (L == k); + C = all_coords (L == k, true, true); vals = bw (L == k) (:); vals /= sum (vals); - retval (k).WeightedCentroid = [dot(X, vals), dot(Y, vals)]; + retval (k).WeightedCentroid = [dot(C, repmat(vals, 1, columns(C)))]; endfor case {"meanintensity", "mean_intensity"} for k = 1:num_labels - retval (k).MaxIntensity = mean (bw (L == k) (:)); + retval (k).MeanIntensity = mean (bw (L == k) (:)); endfor case {"pixelvalues", "pixel_values"} @@ -224,6 +259,11 @@ endfor case "orientation" + if (N > 2) + warning ("regionprops: skipping orientation for Nd image"); + break + endif + for k = 1:num_labels [Y, X] = find (L == k); if (numel (Y) > 1) @@ -273,7 +313,7 @@ #case "equivdiameter" otherwise - error ("regionprops: unsupported property '%s'", properties {k}); + error ("regionprops: unsupported property '%s'", property); endswitch endfor endfunction @@ -283,6 +323,26 @@ endfunction function retval = local_boundingbox (bw) - [Y, X] = find (bw); - retval = [min(X)-0.5, min(Y)-0.5, max(X)-min(X)+1, max(Y)-min(Y)+1]; + C = all_coords (bw); + retval = [min(C) - 0.5, max(C) - min(C) + 1]; endfunction + +function C = all_coords (bw, flip = true, singleton = false) + N = ndims (bw); + idx = find (bw); + C = cell2mat (nthargout (1:N, @ind2sub, size(bw), idx)); + + ## Coordinate convention for 2d images is to flip the X and Y axes + ## relative to matrix indexing. Nd images inherit this for the first + ## two dimensions. + if (flip) + [C(2), C(1)] = deal (C(1), C(2)); + endif + + ## Some functions above expect to work columnwise, so don't return a + ## vector + if (rows (C) == 1 && !singleton) + C = [C; C]; + endif +endfunction + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-09-07 14:21:12
|
Revision: 10976 http://octave.svn.sourceforge.net/octave/?rev=10976&view=rev Author: prnienhuis Date: 2012-09-07 14:21:03 +0000 (Fri, 07 Sep 2012) Log Message: ----------- debug stmt removed Modified Paths: -------------- trunk/octave-forge/main/io/PKG_ADD Modified: trunk/octave-forge/main/io/PKG_ADD =================================================================== --- trunk/octave-forge/main/io/PKG_ADD 2012-09-07 14:15:24 UTC (rev 10975) +++ trunk/octave-forge/main/io/PKG_ADD 2012-09-07 14:21:03 UTC (rev 10976) @@ -3,7 +3,6 @@ pkglist = pkg ("list"); javapkgind = find (cellfun (@(x) strcmp(x.name, "java"), pkglist), 1, "first"); if (! isempty (javapkgind)) - keyboard javapkg = pkglist{javapkgind}; if (javapkg.loaded) # Assume jar files are in /lib/java and let chk_spreadsheet_support sort it out This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-09-07 14:15:31
|
Revision: 10975 http://octave.svn.sourceforge.net/octave/?rev=10975&view=rev Author: prnienhuis Date: 2012-09-07 14:15:24 +0000 (Fri, 07 Sep 2012) Log Message: ----------- version bumped to 1.0.20 Modified Paths: -------------- trunk/octave-forge/main/io/DESCRIPTION trunk/octave-forge/main/io/NEWS Modified: trunk/octave-forge/main/io/DESCRIPTION =================================================================== --- trunk/octave-forge/main/io/DESCRIPTION 2012-09-07 14:14:41 UTC (rev 10974) +++ trunk/octave-forge/main/io/DESCRIPTION 2012-09-07 14:15:24 UTC (rev 10975) @@ -1,6 +1,6 @@ Name: io -Version: 1.0.19 -Date: 2012-06-08 +Version: 1.0.20 +Date: 2012-09-07 Author: various authors Maintainer: Philip Nienhuis <prn...@us...> Title: Input/Output Modified: trunk/octave-forge/main/io/NEWS =================================================================== --- trunk/octave-forge/main/io/NEWS 2012-09-07 14:14:41 UTC (rev 10974) +++ trunk/octave-forge/main/io/NEWS 2012-09-07 14:15:24 UTC (rev 10975) @@ -1,146 +1,147 @@ -Summary of important user-visible changes for releases of the io package - -=============================================================================== -io-1.0.20 Release Date: 2012-TBA Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixes: ---- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call - with make_absolute_filename for non-windows systems (canonicalize_file_name - doesn't work with non-existent (new) files on *nix) (bug #36677); - Web addresses (URLs) only need two rather than three slashes; ---- xlsopen: matching .jar names to javaclasspath entries worked the wrong way ---- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to - avoid lock-ups with recent LibreOffice (3.6.x) - -** The annoying flashing LibreOffice splash screens have been fixed upstream; - with LibreOffice 3.6.1 I didn't see them anymore - -** Extended file rename section in odsclose similar to that in xlsclose - -=============================================================================== -io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixes: ---- getusedrange subfunc getusedrange_jod: str2num applied to indices rather - than the substring. Must have been there for > 2 years, only surfaced - with jopendocument v 1.3b1 ---- oct2xls, oct2ods: cast all numeric types in input array to double as - spreadsheets have only double, boolean or character string type. This bug - has been there from the very beginning of the spreadsheet functions >8-O - ---- Support for reading back formulas from .xls spreadsheets using ActiveX/COM - -** Compatible with jOpenDocument version 1.3b1 - getUsedRange() method added (MUCH faster than the old hack) - -** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) - -** Compatible with Apache POI 3.8 final - -=============================================================================== -io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis -=============================================================================== - -** The following functions have been imported from the miscellaneous package: - cell2csv csvconcat xmlread - csv2cell csvexplode xmlwrite - Their error messages and help messages have been cleaned up a bit. - -** Bug fixes: ---- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. ---- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. ---- csv2cell: checks if file is empty and if so, return an empty cell. ---- xlsopen: better Java detection logic, more informative error messages - -** Adapted to internal LibreOffice-3.5-final changes. - Some bugs (flashing LO screens) still have to be fixed upstream - see here: - https://bugs.freedesktop.org/show_bug.cgi?id=42470 - -** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. - -=============================================================================== -io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixes: ---- oct2ods, oct2xls, odswrite default range input arg. These functions may not - have worked properly for two years (!) - -** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works - well with xercesImpl.jar 2.9.1 (Sep 14, 2009) - -** Many small bug fixes & documentation updated to actual functionality. - -** Fixed "seealso" texinfo header string in almost all functions. - -** Added formal test scripts to "internal functions" section. - -=============================================================================== -io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis -=============================================================================== - -** Bug fixing release - -** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java - (for MinGW) - -=============================================================================== -io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis -=============================================================================== - -io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current - development status (some still a bit experimental). It mainly comprises: - -** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); - -** Some mainly cosmetic improvements to existing code; less verbosity; - -** pch2mat (reading & transforming Nastran PCH files, contributed by - B. Oytun Peksel); - -** object2json.m (creating a json description string of objects, contributed - by Daniel Torre). This was already silently introduced in io-1.0.14; - -** A scripted troubleshooting / classpath setup tool for spreadsheet I/O - support (chk_spreadsheet_support.m); - -** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). - OpenXLS is -let's say- a little bit lacking: For reading it is faster than - JXL. However, while OXS write support has been coded (and works) I had to - disable it as the OXS Java classes won't release the file handle so Octave - will hang upon closing :-( I'm stuck with this so I just release it as-is; - -** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like - LibreOffice) behind the scenes to read spreadsheet files, much like - ActiveX/COM for MS-Excel. This is also based on Java. The first time you - use UNO, OOo has to be loaded and you'll have to be patient, but once loaded - (and in the OS cache) you'll see the pros: - --* Very fast; - --* Much lower Java memory usage as OOo loads the spreadsheet in its own - memory chunk (not Octave's) => much bigger spreadsheet capacity; - --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, - .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter - whether xlsopen of odsopen is used. - Of course all this wonderful stuff comes at a prize: - --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo - invocations will be closed, also those started outside Octave. This is - due to "the way OpenOffice works" (quoted from OOo dev forum), especially - through Java. There are other ways to close OOo but they'll hang Octave; - --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite - up-to-date with the main program. As a consequence, with e.g., - LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I - filed a bug report for this - (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen - it being picked up yet. Another example: while LO 3.3.1's row capacity - was already > 10^6, it took until LO 3.4 before this capacity was - implemented in the Java UNO classes. - Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. - -Hint: -for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps - flag. You'll then loose the old and buggy textread and csv/dlm-read/write - functions but I'd consider that as no big loss. - - <please scroll up/back to see rest of io NEWS> +Summary of important user-visible changes for releases of the io package + + =============================================================================== + io-1.0.20 Release Date: 2012-09-07 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixes: + --- xlsopen, xlsclose, odsopen, odsclose: replaced canonicalize_file_name call + with make_absolute_filename for non-windows systems (canonicalize_file_name + doesn't work with non-existent (new) files on *nix) (bug #36677); + Web addresses (URLs) only need two rather than three slashes; + --- xlsopen: matching .jar names to javaclasspath entries worked the wrong way + --- io_xls_testscript / io_ods_testscript: added small delay for UNO calls to + avoid lock-ups with recent LibreOffice (3.6.x) + + ** The annoying flashing LibreOffice splash screens have been fixed upstream; + with LibreOffice 3.6.1 I didn't see them anymore + + ** Extended file rename section in odsclose similar to that in xlsclose + + =============================================================================== + io-1.0.19 Release Date: 2012-06-08 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixes: + --- getusedrange subfunc getusedrange_jod: str2num applied to indices rather + than the substring. Must have been there for > 2 years, only surfaced + with jopendocument v 1.3b1 + --- oct2xls, oct2ods: cast all numeric types in input array to double as + spreadsheets have only double, boolean or character string type. This bug + has been there from the very beginning of the spreadsheet functions >8-O + + --- Support for reading back formulas from .xls spreadsheets using ActiveX/COM + + ** Compatible with jOpenDocument version 1.3b1 + getUsedRange() method added (MUCH faster than the old hack) + + ** Compatible with odfdom-java-0.8.8-incubator.jar (ODF Toolkit 0.5-incubating) + + ** Compatible with Apache POI 3.8 final + + =============================================================================== + io-1.0.18 Release Date: 2012-03-22 Release Manager: Philip Nienhuis + =============================================================================== + + ** The following functions have been imported from the miscellaneous package: + cell2csv csvconcat xmlread + csv2cell csvexplode xmlwrite + Their error messages and help messages have been cleaned up a bit. + + ** Bug fixes: + --- odsfinfo: fixed "wrong type argument `cell'" bug when run interactively. + --- xlsopen, odsopen: fixed messed up screen output due to UNO usage warning. + --- csv2cell: checks if file is empty and if so, return an empty cell. + --- xlsopen: better Java detection logic, more informative error messages + + ** Adapted to internal LibreOffice-3.5-final changes. + Some bugs (flashing LO screens) still have to be fixed upstream - see here: + https://bugs.freedesktop.org/show_bug.cgi?id=42470 + + ** Tried OpenXLS-6.0.7.jar. Reads OK, still unusable for writing .xls files. + + =============================================================================== + io-1.0.17 Release Date: 2012-02-27 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixes: + --- oct2ods, oct2xls, odswrite default range input arg. These functions may not + have worked properly for two years (!) + + ** Fixed support for odfdom v.0.8.7 (ODS). Note: the OTK interface only works + well with xercesImpl.jar 2.9.1 (Sep 14, 2009) + + ** Many small bug fixes & documentation updated to actual functionality. + + ** Fixed "seealso" texinfo header string in almost all functions. + + ** Added formal test scripts to "internal functions" section. + + =============================================================================== + io-1.0.16 Release Date: 2012-01-19 Release Manager: Philip Nienhuis + =============================================================================== + + ** Bug fixing release + + ** PKG_ADD now expects Java spreadsheet class libs (.jars) in /lib/java + (for MinGW) + + =============================================================================== + io-1.0.15 Release Date: 2011-10-02 Release Manager: Philip Nienhuis + =============================================================================== + + io-1.0.15 is primarily a bug fix release and a snapshot / wrap-up of current + development status (some still a bit experimental). It mainly comprises: + + ** A number of bug fixes (incl. some serious ones, notably with .ods/OOo Calc); + + ** Some mainly cosmetic improvements to existing code; less verbosity; + + ** pch2mat (reading & transforming Nastran PCH files, contributed by + B. Oytun Peksel); + + ** object2json.m (creating a json description string of objects, contributed + by Daniel Torre). This was already silently introduced in io-1.0.14; + + ** A scripted troubleshooting / classpath setup tool for spreadsheet I/O + support (chk_spreadsheet_support.m); + + ** Experimental OXS support (OpenXLS) for reading Excel xls (BIFF8). + OpenXLS is -let's say- a little bit lacking: For reading it is faster than + JXL. However, while OXS write support has been coded (and works) I had to + disable it as the OXS Java classes won't release the file handle so Octave + will hang upon closing :-( I'm stuck with this so I just release it as-is; + + ** Experimental UNO support, i.e. invoking OpenOffice.org (or clones like + LibreOffice) behind the scenes to read spreadsheet files, much like + ActiveX/COM for MS-Excel. This is also based on Java. The first time you + use UNO, OOo has to be loaded and you'll have to be patient, but once loaded + (and in the OS cache) you'll see the pros: + --* Very fast; + --* Much lower Java memory usage as OOo loads the spreadsheet in its own + memory chunk (not Octave's) => much bigger spreadsheet capacity; + --* You can read *all* formats supported by OOo: .ods, .xls, .csv, .xlsx, + .sxc, .dbf, Lotus wk1, Quattro Pro, ......; and it doesn't really matter + whether xlsopen of odsopen is used. + Of course all this wonderful stuff comes at a prize: + --* After closing the spreadsheet file (odsclose, xlsclose) ALL OOo + invocations will be closed, also those started outside Octave. This is + due to "the way OpenOffice works" (quoted from OOo dev forum), especially + through Java. There are other ways to close OOo but they'll hang Octave; + --* The Java UNO classes supplied with e.g. LibreOffice aren't kept quite + up-to-date with the main program. As a consequence, with e.g., + LibreOffice 3.4 the main LO window will pop up (it can't be hidden). I + filed a bug report for this + (https://bugs.freedesktop.org/show_bug.cgi?id=40991) but I haven't seen + it being picked up yet. Another example: while LO 3.3.1's row capacity + was already > 10^6, it took until LO 3.4 before this capacity was + implemented in the Java UNO classes. + Like with OXS, I'm a bit stuck here - all this has to be fixed upstream. + + Hint: + for older Octave versions (< 3.4.0) you can install io-1.0.15 using the -nodeps + flag. You'll then loose the old and buggy textread and csv/dlm-read/write + functions but I'd consider that as no big loss. + + <please scroll up/back to see rest of io NEWS> + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <prn...@us...> - 2012-09-07 14:14:55
|
Revision: 10974 http://octave.svn.sourceforge.net/octave/?rev=10974&view=rev Author: prnienhuis Date: 2012-09-07 14:14:41 +0000 (Fri, 07 Sep 2012) Log Message: ----------- CRLF to LF Modified Paths: -------------- trunk/octave-forge/main/io/doc/READ-ODS.html trunk/octave-forge/main/io/doc/READ-XLS.html Modified: trunk/octave-forge/main/io/doc/READ-ODS.html =================================================================== --- trunk/octave-forge/main/io/doc/READ-ODS.html 2012-09-07 14:14:16 UTC (rev 10973) +++ trunk/octave-forge/main/io/doc/READ-ODS.html 2012-09-07 14:14:41 UTC (rev 10974) @@ -1,17 +1,17 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<html><head> - <meta http-equiv="CONTENT-TYPE" content="text/html; charset=windows-1252"> - - <title></title><meta name="GENERATOR" content="OpenOffice.org 3.2 (Win32)"> - <meta name="AUTHOR" content="Philip Nienhuis"> - <meta name="CREATED" content="20091229;22213000"> - <meta name="CHANGEDBY" content="Philip Nienhuis"> - <meta name="CHANGED" content="20120226;18275600"> - <meta name="Info 1" content=""> - <meta name="CHANGEDBY" content="Philip Nienhuis"></head> - -<body dir="ltr" lang="en-US"> -<p align="center"><u><font face="Arial, sans-serif"><font size="4"> +<html><head> + <meta http-equiv="CONTENT-TYPE" content="text/html; charset=windows-1252"> + + <title></title><meta name="GENERATOR" content="OpenOffice.org 3.2 (Win32)"> + <meta name="AUTHOR" content="Philip Nienhuis"> + <meta name="CREATED" content="20091229;22213000"> + <meta name="CHANGEDBY" content="Philip Nienhuis"> + <meta name="CHANGED" content="20120226;18275600"> + <meta name="Info 1" content=""> + <meta name="CHANGEDBY" content="Philip Nienhuis"></head> + + <body dir="ltr" lang="en-US"> + <p align="center"><u><font face="Arial, sans-serif"><font size="4"> <b>ODS support for Octave</b></font></font></u> </p> <p align="center"><font face="Arial, sans-serif"><font size="2"> @@ -19,8 +19,8 @@ </p> <p align="center"><font face="Arial, sans-serif"><font size="2"> This version September 7, 2012</font></font> -</p> -<p><font face="Arial, sans-serif"><font size="2"> +</p> + <p><font face="Arial, sans-serif"><font size="2"> <i>(ODS = Open Document Format spreadsheet data format, used by e.g., OpenOffice.org.)</i></font></font> </p> <dl><dt> @@ -43,8 +43,8 @@ <p><font face="Arial, sans-serif"><font size="2"><i><b>oct2ods.m</b></i> <br>Write data to an ODS spreadsheet file using the file pointer handed by odsopen.</font></font></p></dt><dt> <p><font face="Arial, sans-serif"><font size="2"><i><b>odsclose.m</b></i> - <br>Close file handle made by odsopen and -if data have been transfered to a spreadsheet- save - data.</font></font></p></dt><dt> + <br>Close file handle made by odsopen and -if data have been transfered to a spreadsheet- save + data.</font></font></p></dt><dt> <p><font face="Arial, sans-serif"><font size="2"><i><b>odsfinfo.m</b></i> <br>Explore sheet names and optionally estimated data size of ods files with unknown content.</font></font></p></dt><dt> <p><font face="Arial, sans-serif"><font size="2"><i><b>calccelladdress.m</b></i> @@ -56,41 +56,41 @@ not specifically meant for direct invocation from the Octave prompt (it is more useful during initialization of Octave itself) it can be very helpful when hunting down issues with spreadsheet support in Octave.</font></font></p></dt> - <dt style="font-style: italic;"><font face="Arial, sans-serif"><font size="2"><b>spsh_chkrange.m</b></font></font></dt><dt style="font-style: italic;"> - <font face="Arial, sans-serif"><font size="2"><b>spsh_prstype.m</b></font></font></dt><dt style="font-style: italic;"> - <font face="Arial, sans-serif"><font size="2"><b>getusedrange.m</b></font></font></dt><dt style="font-style: italic;"> - <font face="Arial, sans-serif"><font size="2"><b>calccelladdress.m</b></font></font></dt><dt style="font-style: italic;"> - <font face="Arial, sans-serif"><font size="2"><b>parse_sp_range.m</b></font></font></dt><dt> - <font face="Arial, sans-serif"><font size="2">Support files called by - the scripts and not meant for direct invocation by users.</font></font></dt><dt> + <dt style="font-style: italic;"><font face="Arial, sans-serif"><font size="2"><b>spsh_chkrange.m</b></font></font></dt><dt style="font-style: italic;"> + <font face="Arial, sans-serif"><font size="2"><b>spsh_prstype.m</b></font></font></dt><dt style="font-style: italic;"> + <font face="Arial, sans-serif"><font size="2"><b>getusedrange.m</b></font></font></dt><dt style="font-style: italic;"> + <font face="Arial, sans-serif"><font size="2"><b>calccelladdress.m</b></font></font></dt><dt style="font-style: italic;"> + <font face="Arial, sans-serif"><font size="2"><b>parse_sp_range.m</b></font></font></dt><dt> + <font face="Arial, sans-serif"><font size="2">Support files called by + the scripts and not meant for direct invocation by users.</font></font></dt><dt> <p><font face="Arial, sans-serif"><font size="2"><i><b>io_ods_testscript.m</b></i> <br>Script for testing basic operation of ODS spreadsheet functions.</font></font></p><br></dt> -</dl> -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>REQUIRED -SUPPORT SOFTWARE</b></u></font></font></p><dl> - </dl><font style="font-weight: bold; font-style: italic;" face="Arial, sans-serif"><font size="2">For - Windows (MingW):</font></font> -<ul> - <li><p align="left"> - <font face="Arial, sans-serif"><font size="2">Octave with Java package - (preferrably >= 1.2.8, although 1.2.6 will do for most functionality)</font></font></p></li></ul> -<dl style="font-style: italic; font-weight: bold;"> - <dt><p><font face="Arial, sans-serif"><font size="2">For Linux:</font></font></p></dt></dl> -<ul> - <li><p align="left"> - <font face="Arial, sans-serif"><font size="2">Octave with Java package - (preferrably >= 1.2.8, although 1.2.5 will do for most functionality)</font></font></p></li></ul> - <p><font face="Arial, sans-serif"><font size="2">For ODS access, - you'll need to choose at least one of the following java class files - collections:</font></font></p> -<ul> - <li> +</dl> + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>REQUIRED + SUPPORT SOFTWARE</b></u></font></font></p><dl> + </dl><font style="font-weight: bold; font-style: italic;" face="Arial, sans-serif"><font size="2">For + Windows (MingW):</font></font> + <ul> + <li><p align="left"> + <font face="Arial, sans-serif"><font size="2">Octave with Java package + (preferrably >= 1.2.8, although 1.2.6 will do for most functionality)</font></font></p></li></ul> + <dl style="font-style: italic; font-weight: bold;"> + <dt><p><font face="Arial, sans-serif"><font size="2">For Linux:</font></font></p></dt></dl> + <ul> + <li><p align="left"> + <font face="Arial, sans-serif"><font size="2">Octave with Java package + (preferrably >= 1.2.8, although 1.2.5 will do for most functionality)</font></font></p></li></ul> + <p><font face="Arial, sans-serif"><font size="2">For ODS access, + you'll need to choose at least one of the following java class files + collections:</font></font></p> + <ul> + <li> <p align="left"><font face="Arial, sans-serif"><font size="2"> <b>odfdom.jar</b> currently the preferred option)<br> - (<u>only</u> versions <b>0.7.5</b>, - <b>0.8.6</b>, <b>0.8.7</b> and <b>0.8.8</b> (the latter from incubator v. 0.5, see download URL below) work OK!) & <b>xercesImpl.jar</b> (watch out here too! only version 2.9.1 (2007-sep-14) works OK with odfdom). Get them here: + (<u>only</u> versions <b>0.7.5</b>, + <b>0.8.6</b>, <b>0.8.7</b> and <b>0.8.8</b> (the latter from incubator v. 0.5, see download URL below) work OK!) & <b>xercesImpl.jar</b> (watch out here too! only version 2.9.1 (2007-sep-14) works OK with odfdom). Get them here: </font></font></p> </li> <ul> @@ -101,15 +101,15 @@ </li><li><p align="left"><a href="http://www.google.com/search?ie=UTF-8&oe=utf-8&q=xerces-2.9.1+download"><font face="Arial, sans-serif"><font size="2">Google for xerces-2.9.1 download</a></p> </li> </ul> -</ul> -<dl><dt><p> +</ul> + <dl><dt><p> <br><font face="Arial, sans-serif"><font size="2">and/or</font></font> -</p></dt></dl> -<ul> - <li> - <p align="left"><font face="Arial, sans-serif"><font size="2"><b>jopendocument</b></font></font><font face="Arial, sans-serif"><font size="2"><version></font></font><font face="Arial, sans-serif"><font size="2"><b>.jar</b></font></font><font face="Arial, sans-serif"><font size="2">. - Get it from <a href="http://www.jopendocument.org/">http://www.jopendocument.org</a></font></font></p><p align="left"> - <font face="Arial, sans-serif"><font size="2">(jOpenDocument 1.2 (final) is the most recent one and recommended for Octave)</font></font> +</p></dt></dl> + <ul> + <li> + <p align="left"><font face="Arial, sans-serif"><font size="2"><b>jopendocument</b></font></font><font face="Arial, sans-serif"><font size="2"><version></font></font><font face="Arial, sans-serif"><font size="2"><b>.jar</b></font></font><font face="Arial, sans-serif"><font size="2">. + Get it from <a href="http://www.jopendocument.org/">http://www.jopendocument.org</a></font></font></p><p align="left"> + <font face="Arial, sans-serif"><font size="2">(jOpenDocument 1.2 (final) is the most recent one and recommended for Octave)</font></font> </p> </li> </ul> @@ -127,231 +127,231 @@ </li> </ul> <dl><dt> - <p><font face="Arial, sans-serif"><font size="2">These class libs must be referenced with - full pathnames in your javaclasspath.<br> + <p><font face="Arial, sans-serif"><font size="2">These class libs must be referenced with + full pathnames in your javaclasspath.<br> Except for the UNO (OOo) classes, the jar files had best be put in /<libdir>/java where <libdir> on Linux is usually /usr/lib; on MinGW it is usually /lib. The PKG_ADD command expects the class libs there; if they are elsewhere, add them in ./share/octave/<version>/m/startup/octaverc using appropriate - javaaddpath statements or a chk_spreadsheet_support() call.</font></font> - </p></dt><dt><p><br> -</p></dt></dl> -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>USAGE</b></u></font></font></p> - <p><font face="Arial, sans-serif"><font size="2">(see \x93help - ods<function_filename>\x94 in octave terminal.)</font></font></p><p><font face="Arial, sans-serif"><font size="2"><b>odsread</b></font></font> - <font face="Arial, sans-serif"><font size="2">is a sort of analog to - xlsread and works more or less the same. </font></font><font face="Arial, sans-serif"><font size="2"><b>odsread - </b></font></font><font face="Arial, sans-serif"><font size="2">is a - mere wrapper for the functions </font></font><font face="Arial, sans-serif"><font size="2"><b>odsopen</b></font></font><font face="Arial, sans-serif"><font size="2">, - </font></font><font face="Arial, sans-serif"><font size="2"><b>ods2oct,</b></font></font> - <font face="Arial, sans-serif"><font size="2">and </font></font><font face="Arial, sans-serif"><font size="2"><b>odsclose</b></font></font> - <font face="Arial, sans-serif"><font size="2">that do file access and - the actual reading, plus </font></font><font face="Arial, sans-serif"><font size="2"><b>parsecell</b></font></font> - <font face="Arial, sans-serif"><font size="2">for post-processing.</font></font></p><p><font face="Arial, sans-serif"><font size="2"><b>odswrite</b></font></font> - <font face="Arial, sans-serif"><font size="2">works similar to - xlswrite. It too is a wrapper for scripts which do the actual work - and invoke other scripts, a.o. </font></font><font face="Arial, sans-serif"><font size="2"><b>oct2ods</b></font></font><font face="Arial, sans-serif"><font size="2">.</font></font></p><p><font face="Arial, sans-serif"><font size="2"><b>odsfinfo</b></font></font> - <font face="Arial, sans-serif"><font size="2">can be used to explore - odsfiles with unknown content for sheet names and to get an - impression of the data content sizes.</font></font></p><font face="Arial, sans-serif"><font size="2">When you need - data from just one sheet, <b>odsread</b> is for you.</font></font><font face="Arial, sans-serif"><font size="2"> But when you need - data from multiple sheets in the same spreadsheet file, or if you - want to process spreadsheet data by limited-size chunks at a time, - <b>odsopen</b> / <b>ods2oct</b> [/<b>parsecell</b>] / \x85 / - <b>odsclose</b> sequences provides for much more speed and - flexibility as the spreadsheet needs to be read just once rather - than repeatedly for each call to <b>odsread</b>.</font></font><dl><dt><p> - <font face="Arial, sans-serif"><font size="2">Same reasoning goes for - <b>odswrite</b>.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Also, if you use - <b>odsopen</b> / \x85../, you can process multiple spreadsheets - simultaneously \x96 just use <b>odsopen</b> repeatedly to get - multiple spreadsheet file pointers.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Moreover, after - adding data to an existing spreadsheet file, you can fiddle with the - filename in the ods file pointer struct to save the data into - another, possibly new spreadsheet file.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">If you use - <b>odsopen</b> / <b>ods2oct</b> / \x85 / <b>oct2ods</b> / \x85. - / <b>odsclose</b>, <b><u><i>DO NOT FORGET</i></u></b> to invoke <b>odsclose</b> in the - end. The file pointers can contain an enormous amount of data and - may needlessly keep precious memory allocated. In case of the UNO interface, the + javaaddpath statements or a chk_spreadsheet_support() call.</font></font> + </p></dt><dt><p><br> + </p></dt></dl> + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>USAGE</b></u></font></font></p> + <p><font face="Arial, sans-serif"><font size="2">(see \x93help + ods<function_filename>\x94 in octave terminal.)</font></font></p><p><font face="Arial, sans-serif"><font size="2"><b>odsread</b></font></font> + <font face="Arial, sans-serif"><font size="2">is a sort of analog to + xlsread and works more or less the same. </font></font><font face="Arial, sans-serif"><font size="2"><b>odsread + </b></font></font><font face="Arial, sans-serif"><font size="2">is a + mere wrapper for the functions </font></font><font face="Arial, sans-serif"><font size="2"><b>odsopen</b></font></font><font face="Arial, sans-serif"><font size="2">, + </font></font><font face="Arial, sans-serif"><font size="2"><b>ods2oct,</b></font></font> + <font face="Arial, sans-serif"><font size="2">and </font></font><font face="Arial, sans-serif"><font size="2"><b>odsclose</b></font></font> + <font face="Arial, sans-serif"><font size="2">that do file access and + the actual reading, plus </font></font><font face="Arial, sans-serif"><font size="2"><b>parsecell</b></font></font> + <font face="Arial, sans-serif"><font size="2">for post-processing.</font></font></p><p><font face="Arial, sans-serif"><font size="2"><b>odswrite</b></font></font> + <font face="Arial, sans-serif"><font size="2">works similar to + xlswrite. It too is a wrapper for scripts which do the actual work + and invoke other scripts, a.o. </font></font><font face="Arial, sans-serif"><font size="2"><b>oct2ods</b></font></font><font face="Arial, sans-serif"><font size="2">.</font></font></p><p><font face="Arial, sans-serif"><font size="2"><b>odsfinfo</b></font></font> + <font face="Arial, sans-serif"><font size="2">can be used to explore + odsfiles with unknown content for sheet names and to get an + impression of the data content sizes.</font></font></p><font face="Arial, sans-serif"><font size="2">When you need + data from just one sheet, <b>odsread</b> is for you.</font></font><font face="Arial, sans-serif"><font size="2"> But when you need + data from multiple sheets in the same spreadsheet file, or if you + want to process spreadsheet data by limited-size chunks at a time, + <b>odsopen</b> / <b>ods2oct</b> [/<b>parsecell</b>] / \x85 / + <b>odsclose</b> sequences provides for much more speed and + flexibility as the spreadsheet needs to be read just once rather + than repeatedly for each call to <b>odsread</b>.</font></font><dl><dt><p> + <font face="Arial, sans-serif"><font size="2">Same reasoning goes for + <b>odswrite</b>.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Also, if you use + <b>odsopen</b> / \x85../, you can process multiple spreadsheets + simultaneously \x96 just use <b>odsopen</b> repeatedly to get + multiple spreadsheet file pointers.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Moreover, after + adding data to an existing spreadsheet file, you can fiddle with the + filename in the ods file pointer struct to save the data into + another, possibly new spreadsheet file.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">If you use + <b>odsopen</b> / <b>ods2oct</b> / \x85 / <b>oct2ods</b> / \x85. + / <b>odsclose</b>, <b><u><i>DO NOT FORGET</i></u></b> to invoke <b>odsclose</b> in the + end. The file pointers can contain an enormous amount of data and + may needlessly keep precious memory allocated. In case of the UNO interface, the hidden OpenOffice.org invocation (soffice.bin) can even block proper closing of - Octave.</font></font></p></dt><dt><br> -</dt></dl> -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>SPREADSHEET -FORMULA SUPPORT</b></u></font></font></p><dl> - <dt> - <font face="Arial, sans-serif"><font size="2">When using the OTK or UNO - interface you can:</font></font></dt></dl> -<ul> - <li> - <font face="Arial, sans-serif"><font size="2">(When reading, <b>ods2oct</b>) - either read spreadsheet formula results, or the literal formula text - strings;</font></font></li><li> - <font face="Arial, sans-serif"><font size="2">(When writing, <b>oct2ods</b>) - either enter formulas in the worksheet as formulas, or enter them as - literal text strings.</font></font></li></ul> - <font face="Arial, sans-serif"><font size="2">In short, you can - enter spreadsheet formulas and in a later stage read them back, - change them and re-enter them in the worksheet.</font></font><font face="Arial, sans-serif"><font size="2"> The behaviour is - controlled by an option structure </font></font><font face="Arial, sans-serif"><font size="2"><b>options</b></font></font> - <font face="Arial, sans-serif"><font size="2">(as last argument to - </font></font><font face="Arial, sans-serif"><font size="2"><b>oct2ods</b></font></font><font face="Arial, sans-serif"><font size="2">.m - and </font></font><font face="Arial, sans-serif"><font size="2"><b>ods2oct</b></font></font><font face="Arial, sans-serif"><font size="2">.m) - which for now has only one (logical) field:</font></font><ul><li> - <font face="Arial, sans-serif"><font size="2"><b>options.formulas_as_text</b></font></font> - <font face="Arial, sans-serif"><font size="2">= 0 (the default) - implies enter formulas as formulas and read back formula results</font></font></li><li> - <font face="Arial, sans-serif"><font size="2"><b>options.formulas_as_text - </b></font></font><font face="Arial, sans-serif"><font size="2">=1 (or - any positive integer) means enter formulas as text strings and read - them back as text strings.</font></font></li></ul><dl><dt><font face="Arial, sans-serif"><font size="2">Be aware that - there's no formula evaluator in ODS java, not even a formula - validator. So if you create formulas in your spreadsheet using - </font></font><font face="Arial, sans-serif"><font size="2"><b>oct2ods</b></font></font><font face="Arial, sans-serif"><font size="2"> - or </font></font><font face="Arial, sans-serif"><font size="2"><b>odswrite</b></font></font><font face="Arial, sans-serif"><font size="2">, - do not expect meaningful results when reading those files later on - </font></font><font face="Arial, sans-serif"><font size="2"><b>unless</b></font></font> - <font face="Arial, sans-serif"><font size="2">you open them in - OpenOffice.org Calc and write them back to disk.</font></font></dt><dt> - <font face="Arial, sans-serif"><font size="2">You can write all kind - of junk as a formula into a spreadsheet cell. There's not much - validity checking built into odfdom.jar. I didn't bother to try - OpenOffice.org Calc to read such faulty spreadsheets, so I don't - know what will happen with spreadsheets containing invalid formulas. - But using the above options, you can at least repair them using - octave....<br> + Octave.</font></font></p></dt><dt><br> + </dt></dl> + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>SPREADSHEET + FORMULA SUPPORT</b></u></font></font></p><dl> + <dt> + <font face="Arial, sans-serif"><font size="2">When using the OTK or UNO + interface you can:</font></font></dt></dl> + <ul> + <li> + <font face="Arial, sans-serif"><font size="2">(When reading, <b>ods2oct</b>) + either read spreadsheet formula results, or the literal formula text + strings;</font></font></li><li> + <font face="Arial, sans-serif"><font size="2">(When writing, <b>oct2ods</b>) + either enter formulas in the worksheet as formulas, or enter them as + literal text strings.</font></font></li></ul> + <font face="Arial, sans-serif"><font size="2">In short, you can + enter spreadsheet formulas and in a later stage read them back, + change them and re-enter them in the worksheet.</font></font><font face="Arial, sans-serif"><font size="2"> The behaviour is + controlled by an option structure </font></font><font face="Arial, sans-serif"><font size="2"><b>options</b></font></font> + <font face="Arial, sans-serif"><font size="2">(as last argument to + </font></font><font face="Arial, sans-serif"><font size="2"><b>oct2ods</b></font></font><font face="Arial, sans-serif"><font size="2">.m + and </font></font><font face="Arial, sans-serif"><font size="2"><b>ods2oct</b></font></font><font face="Arial, sans-serif"><font size="2">.m) + which for now has only one (logical) field:</font></font><ul><li> + <font face="Arial, sans-serif"><font size="2"><b>options.formulas_as_text</b></font></font> + <font face="Arial, sans-serif"><font size="2">= 0 (the default) + implies enter formulas as formulas and read back formula results</font></font></li><li> + <font face="Arial, sans-serif"><font size="2"><b>options.formulas_as_text + </b></font></font><font face="Arial, sans-serif"><font size="2">=1 (or + any positive integer) means enter formulas as text strings and read + them back as text strings.</font></font></li></ul><dl><dt><font face="Arial, sans-serif"><font size="2">Be aware that + there's no formula evaluator in ODS java, not even a formula + validator. So if you create formulas in your spreadsheet using + </font></font><font face="Arial, sans-serif"><font size="2"><b>oct2ods</b></font></font><font face="Arial, sans-serif"><font size="2"> + or </font></font><font face="Arial, sans-serif"><font size="2"><b>odswrite</b></font></font><font face="Arial, sans-serif"><font size="2">, + do not expect meaningful results when reading those files later on + </font></font><font face="Arial, sans-serif"><font size="2"><b>unless</b></font></font> + <font face="Arial, sans-serif"><font size="2">you open them in + OpenOffice.org Calc and write them back to disk.</font></font></dt><dt> + <font face="Arial, sans-serif"><font size="2">You can write all kind + of junk as a formula into a spreadsheet cell. There's not much + validity checking built into odfdom.jar. I didn't bother to try + OpenOffice.org Calc to read such faulty spreadsheets, so I don't + know what will happen with spreadsheets containing invalid formulas. + But using the above options, you can at least repair them using + octave....<br> The only exception is if you select the UNO interface, as that invokes OpenOffice.org behind the scenes, and OOo obviously has a validator and evaluator built-in.</font></font></dt><dd></dd></dl> - -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>GOTCHAS</b></u></font></font></p><dl> - <dt><p><font face="Arial, sans-serif"><font size="2">I know of one big - gotcha: i.e. reading dates (& time). A less obvious one is Java - memory pool allocation size.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2"><b>Date and time - in ODS</b></font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">Octave (as does Matlab) - stores dates as a number representing the number of days since - January 1, 0 (and as an aside ignores a.o. Pope Gregorius' - intervention in 1582 when 10 days were simply skipped).</font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">OpenOffice.org stores - dates as text strings like \x93yyyy-mm-dd\x94.</font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">MS-Excel stores dates as - a number representing the number of days since January 1, 1900 (and - as an aside, erroneously assumes 1900 to be a leap year).</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Now, converting - OpenOffice.org date cell values (actually, character strings flagged - by \x93date\x94 attributes) into Octave looks pretty - straightforward. But when the ODS spreadsheet was originally an - Excel spreadsheet converted by OpenOffice.org, the date cells can - either be OOo date values (i.e.,strings) OR old numerical values - from the Excel spreadsheet. </font></font> - </p></dt><dt><p><font face="Arial, sans-serif"><font size="2">So: you should - carefully check what happens to date cells.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">As octave has no - \x94date\x94 or \x93time\x94 data type, octave date - values (usually numerical data) are simply transferred as \x93floats\x94 - to ODS spreadsheets. You'll have to convert the values into dates - yourself from within OpenOffice.org.</font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">While adding data and - time values has been implemented in the write scripts, the wait is - for clever solutions to distinguish dates from floats in octave cell - arrays.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2"><b>Java memory - pool allocation size</b></font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">The Java virtual machine - (JVM) initializes one big chunk of your computer's RAM in which all - Java classes and methods etc. are to be loaded: the Java memory - pool. It does this because Java has a very sophisticated \x93garbage - collection\x94 system. At least on Windows, the initial size is - 2MB and the maximum size is 64MB. On Linux this allocated size is - much bigger. This part of memory is where the Java-based ODS octave - routines (and the Java-based ods routines) live and keep their - variables etc.</font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">For transferring large - pieces of information to and from spreadsheets you might hit the - limits of this pool. E.g. to be able to handle I/O of an array of - around 50,000 cells I needed a memory pool size of 512 MB.</font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">The memory size can be - increased by inserting a file called \x93java.opts\x94 - (without quotes) in the directory - ./share/octave/packages/java-<version> (where the script file - javaclasspath.m is located), containing just the following lines:</font></font></p></dt><dt><p> - <font face="Courier New, monospace"><font size="2"><b>-Xms16m<br>-Xmx512m</b></font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">(where 16 = initial - size, 512 = maximum size (in this example), m stands for Megabyte. - This number is system-dependent).</font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">After processing a large - chunk of spreadsheet information you might notice that octave's - memory footprint does not shrink so it looks like Java's memory pool - does not shrink back; but rest assured, the memory footprint is the - <i>allocated</i> (reserved) memory size, not the actual used size. - After the JVM has done its garbage collection, only the so-called - \x93working set\x94 of the memory allocation is really in use - and that is a trimmed-down part of the memory allocation pool. On - Windows systems it often suffices to minimize the octave terminal - for a few seconds to get a more reasonable memory footprint.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2"><b>Reading cells - containing errors</b></font></font></p></dt><dt><p> - <font face="Arial, sans-serif"><font size="2">Spreadsheet cells - containing erroneous stuff are transferred to Octave as NaNs. But - not all errors can be catched. Cells showing #Value# in - OpenOffice.org Calc often contain invalid formulas but may have a 0 - (null) value stored in the value fields. It is impossible to catch - this as there is no run-time formula evaluator (yet) in ODF Toolkit - nor jOpenDocument (like there is in Apache POI for Excel).</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Smaller gotcha's - (only with jOpenDocument 1.2b2, <b>fixed</b> in <b>1.2b3+</b> and - <b>1.2 final</b>):</font></font></p></dt></dl> -<ul> - <li><p align="left"> - <font face="Arial, sans-serif"><font size="2">While reading, empty - cells are sometimes not skipped but interpreted with numerical value - 0 (zero).</font></font></p></li><li><p align="left"> - <font face="Arial, sans-serif"><font size="2">A valid range MUST be - specified, I haven't found a way to discover the actual occupied - rows and columns (jOpenDocument can give the physical ones (= - capacity) but that doesn't help).</font></font></p></li></ul> -<dl> - <dt><p><font face="Arial, sans-serif"><font size="2">NOT fixed in - version 1.2 final nor 1.3b1:</font></font></p></dt></dl> -<ul> - <li><p align="left"> - <font face="Arial, sans-serif"><font size="2">jOpenDocument doesn't - set the so-called <office:value-type='string'> attribute in - cells containing text; as a consequence ODF Toolkit will treat them - as empty cells. Ooo will read them OK.</font></font></p></li></ul> - <p><br> -</p> -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>MATLAB -COMPATIBILITY</b></u></font></font></p> - <p><font face="Arial, sans-serif"><font size="2">AFAIK there's no - similar functionality in Matlab (yet?), only for reading and then - very limited.<br>o<b>dsread</b> is fairly - function-compatible to <b>xlsread</b>, however.</font></font></p><p><font face="Arial, sans-serif"><font size="2">Same goes for <b>odswrite</b>, - <b>odsfinfo</b> and <b>xlsfinfo</b> \x96 however <b>ods</b><b>f</b><b>info</b> - has better functionality IMO.</font></font></p><br> - -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>COMPARISON -OF INTERFACES</b></u></font></font></p> - <p><font face="Arial, sans-serif"><font size="2">The <b>ODFtoolkit</b> is - the one that gives the best (but slow) results at present. However, - parsing xml trees into rectangular arrays is not quite - straightforward and the other way round is a real nightmare; - odftoolkit up til 0.7.5. did little to hide the gory details for the - developers.</font></font></p><dl><dt><p> - <font face="Arial, sans-serif"><font size="2">While reading ODS is - still OK, writing implies checking whether cells already exist - explicitly (in table:table-cells) or implicitly (in - number-columns-repeated or number-rows-repeated nodes) or not at all - yet in which case you'll need to add various types of parent nodes. - Inserting new cells (\x93nodes\x94) or deleting nodes implies - rebuilding possibly large parts of the tree in memory - nothing for - the faint-of-heart. Only with ODFToolkit (odfdom) 0.8.6 and 0.8.7 things have - been simplified for developers.</font></font></p></dt> -<dt><p><font face="Arial, sans-serif"><font size="2">The <b>jOpenDocument</b> - interface is more promising, as it does shield the xml tree - details and presents developers something which looks like a - spreadsheet model.<br>However, unfortunately - the developers decided to shield essential methods by making them - 'protected' (e.g. the vital getCellType). JopenDocument does support - writing. But OTOH many obvious methods are still lacking and formula - support is absent.<br>And last (but not least) - the jOpenDocument developers state that their development is - primarily driven by requests from customers who pay for support. I - do sympathize with this business model but for octave needs this may - hamper progress for a while.<br> + + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>GOTCHAS</b></u></font></font></p><dl> + <dt><p><font face="Arial, sans-serif"><font size="2">I know of one big + gotcha: i.e. reading dates (& time). A less obvious one is Java + memory pool allocation size.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2"><b>Date and time + in ODS</b></font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">Octave (as does Matlab) + stores dates as a number representing the number of days since + January 1, 0 (and as an aside ignores a.o. Pope Gregorius' + intervention in 1582 when 10 days were simply skipped).</font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">OpenOffice.org stores + dates as text strings like \x93yyyy-mm-dd\x94.</font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">MS-Excel stores dates as + a number representing the number of days since January 1, 1900 (and + as an aside, erroneously assumes 1900 to be a leap year).</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Now, converting + OpenOffice.org date cell values (actually, character strings flagged + by \x93date\x94 attributes) into Octave looks pretty + straightforward. But when the ODS spreadsheet was originally an + Excel spreadsheet converted by OpenOffice.org, the date cells can + either be OOo date values (i.e.,strings) OR old numerical values + from the Excel spreadsheet. </font></font> + </p></dt><dt><p><font face="Arial, sans-serif"><font size="2">So: you should + carefully check what happens to date cells.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">As octave has no + \x94date\x94 or \x93time\x94 data type, octave date + values (usually numerical data) are simply transferred as \x93floats\x94 + to ODS spreadsheets. You'll have to convert the values into dates + yourself from within OpenOffice.org.</font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">While adding data and + time values has been implemented in the write scripts, the wait is + for clever solutions to distinguish dates from floats in octave cell + arrays.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2"><b>Java memory + pool allocation size</b></font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">The Java virtual machine + (JVM) initializes one big chunk of your computer's RAM in which all + Java classes and methods etc. are to be loaded: the Java memory + pool. It does this because Java has a very sophisticated \x93garbage + collection\x94 system. At least on Windows, the initial size is + 2MB and the maximum size is 64MB. On Linux this allocated size is + much bigger. This part of memory is where the Java-based ODS octave + routines (and the Java-based ods routines) live and keep their + variables etc.</font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">For transferring large + pieces of information to and from spreadsheets you might hit the + limits of this pool. E.g. to be able to handle I/O of an array of + around 50,000 cells I needed a memory pool size of 512 MB.</font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">The memory size can be + increased by inserting a file called \x93java.opts\x94 + (without quotes) in the directory + ./share/octave/packages/java-<version> (where the script file + javaclasspath.m is located), containing just the following lines:</font></font></p></dt><dt><p> + <font face="Courier New, monospace"><font size="2"><b>-Xms16m<br>-Xmx512m</b></font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">(where 16 = initial + size, 512 = maximum size (in this example), m stands for Megabyte. + This number is system-dependent).</font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">After processing a large + chunk of spreadsheet information you might notice that octave's + memory footprint does not shrink so it looks like Java's memory pool + does not shrink back; but rest assured, the memory footprint is the + <i>allocated</i> (reserved) memory size, not the actual used size. + After the JVM has done its garbage collection, only the so-called + \x93working set\x94 of the memory allocation is really in use + and that is a trimmed-down part of the memory allocation pool. On + Windows systems it often suffices to minimize the octave terminal + for a few seconds to get a more reasonable memory footprint.</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2"><b>Reading cells + containing errors</b></font></font></p></dt><dt><p> + <font face="Arial, sans-serif"><font size="2">Spreadsheet cells + containing erroneous stuff are transferred to Octave as NaNs. But + not all errors can be catched. Cells showing #Value# in + OpenOffice.org Calc often contain invalid formulas but may have a 0 + (null) value stored in the value fields. It is impossible to catch + this as there is no run-time formula evaluator (yet) in ODF Toolkit + nor jOpenDocument (like there is in Apache POI for Excel).</font></font></p></dt><dt><p><font face="Arial, sans-serif"><font size="2">Smaller gotcha's + (only with jOpenDocument 1.2b2, <b>fixed</b> in <b>1.2b3+</b> and + <b>1.2 final</b>):</font></font></p></dt></dl> + <ul> + <li><p align="left"> + <font face="Arial, sans-serif"><font size="2">While reading, empty + cells are sometimes not skipped but interpreted with numerical value + 0 (zero).</font></font></p></li><li><p align="left"> + <font face="Arial, sans-serif"><font size="2">A valid range MUST be + specified, I haven't found a way to discover the actual occupied + rows and columns (jOpenDocument can give the physical ones (= + capacity) but that doesn't help).</font></font></p></li></ul> + <dl> + <dt><p><font face="Arial, sans-serif"><font size="2">NOT fixed in + version 1.2 final nor 1.3b1:</font></font></p></dt></dl> + <ul> + <li><p align="left"> + <font face="Arial, sans-serif"><font size="2">jOpenDocument doesn't + set the so-called <office:value-type='string'> attribute in + cells containing text; as a consequence ODF Toolkit will treat them + as empty cells. Ooo will read them OK.</font></font></p></li></ul> + <p><br> + </p> + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>MATLAB + COMPATIBILITY</b></u></font></font></p> + <p><font face="Arial, sans-serif"><font size="2">AFAIK there's no + similar functionality in Matlab (yet?), only for reading and then + very limited.<br>o<b>dsread</b> is fairly + function-compatible to <b>xlsread</b>, however.</font></font></p><p><font face="Arial, sans-serif"><font size="2">Same goes for <b>odswrite</b>, + <b>odsfinfo</b> and <b>xlsfinfo</b> \x96 however <b>ods</b><b>f</b><b>info</b> + has better functionality IMO.</font></font></p><br> + + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>COMPARISON + OF INTERFACES</b></u></font></font></p> + <p><font face="Arial, sans-serif"><font size="2">The <b>ODFtoolkit</b> is + the one that gives the best (but slow) results at present. However, + parsing xml trees into rectangular arrays is not quite + straightforward and the other way round is a real nightmare; + odftoolkit up til 0.7.5. did little to hide the gory details for the + developers.</font></font></p><dl><dt><p> + <font face="Arial, sans-serif"><font size="2">While reading ODS is + still OK, writing implies checking whether cells already exist + explicitly (in table:table-cells) or implicitly (in + number-columns-repeated or number-rows-repeated nodes) or not at all + yet in which case you'll need to add various types of parent nodes. + Inserting new cells (\x93nodes\x94) or deleting nodes implies + rebuilding possibly large parts of the tree in memory - nothing for + the faint-of-heart. Only with ODFToolkit (odfdom) 0.8.6 and 0.8.7 things have + been simplified for developers.</font></font></p></dt> +<dt><p><font face="Arial, sans-serif"><font size="2">The <b>jOpenDocument</b> + interface is more promising, as it does shield the xml tree + details and presents developers something which looks like a + spreadsheet model.<br>However, unfortunately + the developers decided to shield essential methods by making them + 'protected' (e.g. the vital getCellType). JopenDocument does support + writing. But OTOH many obvious methods are still lacking and formula + support is absent.<br>And last (but not least) + the jOpenDocument developers state that their development is + primarily driven by requests from customers who pay for support. I + do sympathize with this business model but for octave needs this may + hamper progress for a while.<br> In addition, jOpenDocument 1.2 and 1.3b1 still have bugs here and there. For one, it doesn't write appropriate OfficeValueType attributes to the cells, so there's no way to reliably read and distinguish boolean, string and integer @@ -386,83 +386,83 @@ <font face="Arial, sans-serif"><font size="2">However, UNO is not stable yet (see below).</font>. </p></dt> </dl> - -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>TROUBLESHOOTING</b></u></font></font></p><dl> - <dt><p><font face="Arial, sans-serif"><font size="2">Some hints for - troubleshooting ODS support are given here.<br> + + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>TROUBLESHOOTING</b></u></font></font></p><dl> + <dt><p><font face="Arial, sans-serif"><font size="2">Some hints for + troubleshooting ODS support are given here.<br> Since April 2011 the function chk_spreadsheet_support() has been included in the io package. Calling it with arguments ('', 3) (empty string and debug level 3) will echo a lot of diagnostics to the screen. Large parts of the steps outlined below have been automated in this script.<br> Problems with UNO are too complicated to treat them here; most of the troubleshooting has been implemented in chk_spreadsheet_support.m, only some general guidelines are - given below.</font></font> - </p></dt></dl> -<ol> - <li><p align="left"><font face="Arial, sans-serif"><font size="2">Check - if </font></font><font face="Arial, sans-serif"><font size="2">J</font></font><font face="Arial, sans-serif"><font size="2">ava - works. Do a </font></font><font face="Courier New, monospace"><font size="2">pkg - list </font></font><font face="Arial, sans-serif"><font size="2">and - see</font></font></p><p> - a. <font face="Arial, sans-serif"><font size="2">If there's a </font></font><font face="Arial, sans-serif"><font size="2">J</font></font><font face="Arial, sans-serif"><font size="2">ava - package mentioned (then it's installed). If not, install it.</font></font></p> - <p><font face="Arial, sans-serif"><font size="2">b. If there's an - asterisk on the java package line (then the package is loaded). If - not, do a </font></font><font face="Courier New, monospace"><font size="2">pkg - rebuild-auto java</font></font></p> -</li></ol> - -<ol start="2"> - <li><p align="left"><font face="Arial, sans-serif"><font size="2">Check - </font></font><font face="Arial, sans-serif"><font size="2">J</font></font><font face="Arial, sans-serif"><font size="2">ava - memory settings. Try </font></font><font face="Courier New, monospace"><font size="2">javamem</font></font></p><p> - <font face="Arial, sans-serif"><font size="2">a. If it works, check if - it reports sufficiently large max memory (had better be 200 MiB, the - bigger the better)</font></font></p> - <p align="left"><font face="Arial, sans-serif"><font size="2">b. If it - doesn't work, do:</font></font> - </p><ol type="a"><p align="left"> - <font face="Courier New, monospace"><font size="2">rt = java_invoke - ('java.lang.Runtime', 'getRuntime')</font></font></p><p align="left"> - <font face="Courier New, monospace"><font size="2">rt.gc</font></font></p><p align="left"> - <font face="Courier New, monospace"><font size="2">rt.maxMemory - ().doubleValue () / 1024 / 1024</font></font></p><p align="left"> - <font face="Arial, sans-serif"><font size="2">The last command will - show MaxMemory in MiB.</font></font></p></ol> - <p align="left"><font face="Arial, sans-serif"><font size="2">c. In case - you have insufficient memory, see in \x93GOTCHAS\x94, \x93Java - memory pool allocation size\x94, how to increase java's memory - pre-reservation.</font></font></p></li> - <li><p align="left"><font face="Arial, sans-serif"><font size="2">Check if all classes - (.jarfiles) are in class path. Do a '</font></font><font face="Courier New, monospace"><font size="2">jcp = javaclasspath</font></font><font face="Arial, sans-serif"><font size="2"> (-all)' (under unix/linux, do '</font></font><font face="Courier New, monospace"><font size="2">jcp - = javaclasspath; strsplit (jcp,\x94:\x94)</font></font><font face="Arial, sans-serif"><font size="2">' - (w/o quotes). See above under \x93REQUIRED SUPPORT SOFTWARE\x94 - what classes should be mentioned.</font></font></p> - <p align="left"><font face="Arial, sans-serif"><font size="2">If classes (.jar files) - ar</font></font><font face="Arial, sans-serif"><font size="2">e</font></font><font face="Arial, sans-serif"><font size="2"> - missing, download and put them somewhere and add them to the - javaclass path with their fully qualified pathname (in quotes) using - </font></font><font face="Courier New, monospace"><font size="2">javaaddpath()</font></font><font face="Arial, sans-serif"><font size="2">.</font></font></p></li></ol> - <p><font face="Arial, sans-serif"><font size="2">Once all classes - are present and in the javaclasspath, the ods interfaces should just - work. The only remaining showstoppers are insufficient write - privileges for the working directory, a wrecked up octave or some - other problems outside octave.</font></font></p> -<ol start="4"> - <li><p align="left"><font face="Arial, sans-serif"><font size="2">Try - opening an ods file: </font></font> - </p><p align="left"><font face="Courier New, monospace"><font size="2">ods1 - = odsopen ('test.ods', 1, 'otk')</font></font><font face="Arial, sans-serif"><font size="2">. - If this works and ods1 is a struct with various fields containing - objects, ODF toolkit interface (OTK) works. Do an </font></font><font face="Courier New, monospace"><font size="2">ods1 - = odsclose (ods1)</font></font> <font face="Arial, sans-serif"><font size="2">to - close the file.</font></font></p><p align="left"> - <font face="Courier New, monospace"><font size="2">ods2 = odsopen - ('test.ods', 1, 'jod')</font></font><font face="Arial, sans-serif"><font size="2">. - If this works and ods2 is a struct with various fields containing - objects, jOpenDocument interface (JOD) works as well. Do </font></font><font face="Courier New, monospace"><font size="2">ods2 - = odsclose (ods2)</font></font> <font face="Arial, sans-serif"><font size="2">to - close the file.</font></font></p></li> + given below.</font></font> + </p></dt></dl> + <ol> + <li><p align="left"><font face="Arial, sans-serif"><font size="2">Check + if </font></font><font face="Arial, sans-serif"><font size="2">J</font></font><font face="Arial, sans-serif"><font size="2">ava + works. Do a </font></font><font face="Courier New, monospace"><font size="2">pkg + list </font></font><font face="Arial, sans-serif"><font size="2">and + see</font></font></p><p> + a. <font face="Arial, sans-serif"><font size="2">If there's a </font></font><font face="Arial, sans-serif"><font size="2">J</font></font><font face="Arial, sans-serif"><font size="2">ava + package mentioned (then it's installed). If not, install it.</font></font></p> + <p><font face="Arial, sans-serif"><font size="2">b. If there's an + asterisk on the java package line (then the package is loaded). If + not, do a </font></font><font face="Courier New, monospace"><font size="2">pkg + rebuild-auto java</font></font></p> + </li></ol> + + <ol start="2"> + <li><p align="left"><font face="Arial, sans-serif"><font size="2">Check + </font></font><font face="Arial, sans-serif"><font size="2">J</font></font><font face="Arial, sans-serif"><font size="2">ava + memory settings. Try </font></font><font face="Courier New, monospace"><font size="2">javamem</font></font></p><p> + <font face="Arial, sans-serif"><font size="2">a. If it works, check if + it reports sufficiently large max memory (had better be 200 MiB, the + bigger the better)</font></font></p> + <p align="left"><font face="Arial, sans-serif"><font size="2">b. If it + doesn't work, do:</font></font> + </p><ol type="a"><p align="left"> + <font face="Courier New, monospace"><font size="2">rt = java_invoke + ('java.lang.Runtime', 'getRuntime')</font></font></p><p align="left"> + <font face="Courier New, monospace"><font size="2">rt.gc</font></font></p><p align="left"> + <font face="Courier New, monospace"><font size="2">rt.maxMemory + ().doubleValue () / 1024 / 1024</font></font></p><p align="left"> + <font face="Arial, sans-serif"><font size="2">The last command will + show MaxMemory in MiB.</font></font></p></ol> + <p align="left"><font face="Arial, sans-serif"><font size="2">c. In case + you have insufficient memory, see in \x93GOTCHAS\x94, \x93Java + memory pool allocation size\x94, how to increase java's memory + pre-reservation.</font></font></p></li> + <li><p align="left"><font face="Arial, sans-serif"><font size="2">Check if all classes + (.jarfiles) are in class path. Do a '</font></font><font face="Courier New, monospace"><font size="2">jcp = javaclasspath</font></font><font face="Arial, sans-serif"><font size="2"> (-all)' (under unix/linux, do '</font></font><font face="Courier New, monospace"><font size="2">jcp + = javaclasspath; strsplit (jcp,\x94:\x94)</font></font><font face="Arial, sans-serif"><font size="2">' + (w/o quotes). See above under \x93REQUIRED SUPPORT SOFTWARE\x94 + what classes should be mentioned.</font></font></p> + <p align="left"><font face="Arial, sans-serif"><font size="2">If classes (.jar files) + ar</font></font><font face="Arial, sans-serif"><font size="2">e</font></font><font face="Arial, sans-serif"><font size="2"> + missing, download and put them somewhere and add them to the + javaclass path with their fully qualified pathname (in quotes) using + </font></font><font face="Courier New, monospace"><font size="2">javaaddpath()</font></font><font face="Arial, sans-serif"><font size="2">.</font></font></p></li></ol> + <p><font face="Arial, sans-serif"><font size="2">Once all classes + are present and in the javaclasspath, the ods interfaces should just + work. The only remaining showstoppers are insufficient write + privileges for the working directory, a wrecked up octave or some + other problems outside octave.</font></font></p> + <ol start="4"> + <li><p align="left"><font face="Arial, sans-serif"><font size="2">Try + opening an ods file: </font></font> + </p><p align="left"><font face="Courier New, monospace"><font size="2">ods1 + = odsopen ('test.ods', 1, 'otk')</font></font><font face="Arial, sans-serif"><font size="2">. + If this works and ods1 is a struct with various fields containing + objects, ODF toolkit interface (OTK) works. Do an </font></font><font face="Courier New, monospace"><font size="2">ods1 + = odsclose (ods1)</font></font> <font face="Arial, sans-serif"><font size="2">to + close the file.</font></font></p><p align="left"> + <font face="Courier New, monospace"><font size="2">ods2 = odsopen + ('test.ods', 1, 'jod')</font></font><font face="Arial, sans-serif"><font size="2">. + If this works and ods2 is a struct with various fields containing + objects, jOpenDocument interface (JOD) works as well. Do </font></font><font face="Courier New, monospace"><font size="2">ods2 + = odsclose (ods2)</font></font> <font face="Arial, sans-serif"><font size="2">to + close the file.</font></font></p></li> <li><p align="left"><font face="Arial, sans-serif"><font size="2">For the UNO interface, at least version 1.2.8 of the Java package is needed plus the following @@ -479,20 +479,20 @@ to add one or more of these these classes manually to the javaclasspath. </font></font></font></p></li> </ol> -<p><br> -</p> -<p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>DEVELOPMENT</b></u></font></font></p> - <p><font face="Arial, sans-serif"><font size="2">As with the Excel - r/w stuff, adding new interfaces should be easy and straightforward. - Add relevant stanzas in <b>odsopen</b>, <b>odsclose, odsfinfo</b> & - <b>getusedrange</b> and add new subfunctions (for the real work) to - <b>getusedrange_</b><INTF>, <b>oct2ods</b> and <b>ods2oct</b>.</font></font></p><p><font face="Arial, sans-serif"><font size="2">Suggestions for - future development:</font></font></p> - <ul><li><font face="Arial, sans-serif"><font size="2">Reliable and easy ODS - write support (maybe when jOpenDocument is more mature)</font></font></li></ul><ul><li><p align="left"> - <font face="Arial, sans-serif"><font size="2">Speeding up (ODS is 10 X - slower than e.g. OOXML !!!). jOpenDocument is much faster but still - immature.<br> +<p><br> + </p> + <p align="center"><font face="Arial, sans-serif"><font size="4"><u><b>DEVELOPMENT</b></u></font></font></p> + <p><font face="Arial, sans-serif"><font size="2">As with the Excel + r/w stuff, adding new interfaces should be easy and straightforward. + Add relevant stanzas in <b>odsopen</b>, <b>odsclose, odsfinfo</b> & + <b>getusedrange</b> and add new subfunctions (for the real work) to + <b>getusedrange_</b><INTF>, <b>oct2ods</b> and <b>ods2oct</b>.</font></font></p><p><font face="Arial, sans-serif"><font size="2">Suggestions for + future development:</font></font></p> + <ul><li><font face="Arial, sans-serif"><font size="2">Reliable and easy ODS + write support (maybe when jOpenDocument is more mature)</font></font></li></ul><ul><li><p align="left"> + <font face="Arial, sans-serif"><font size="2">Speeding up (ODS is 10 X + slower than e.g. OOXML !!!). jOpenDocument is much faster but still + immature.<br> <b>UNO</b> *is* MUCH faster than jOpenDocument but starting up OpenOffice.org for the first time can take tens of seconds...<br> Note that UNO is still experimental. The issue is that odsclose() will simply @@ -503,66 +503,66 @@ wait for OOo to shut down before it can terminate itself. So Octave must kill OOo to be able to terminate.<br> A way out hasn't been found yet. - </font></font></p></li><li><p align="left"> - \x93<font face="Arial, sans-serif"><font size="2">Passing function - handle\x94 a la Matlab's </font></font><font face="Arial, sans-serif"><font size="2"><b>xlsread</b></font></font></p></li><li><p align="left"> - <font face="Arial, sans-serif"><font size="2">Adding styles (borders, - cell lay-out, font, etc.)</font></font></p></li></ul> - <font face="Arial, sans-serif"><font size="2">Some notes on the - choice for Java:</font></font> -<ol> - <li> - <font face="Arial, sans-serif"><font size="2">It saves a LOT of - development time to use ready-baked Java classes rather than - developing your own routines and thus effectively reinvent the - wheel.</font></font></li><li> - <font face="Arial, sans-serif"><font size="2">A BIG advantage is that - a Java-based solution is platform-independent (\x93portable\x94).</font></font></li><li> - <font face="Arial, sans-serif"><font size="2">But Java is known to be - not very conservative with resources, especially not when processing - XML-based formats.</font></font></li></ol> -<dl> - <dt><font face="Arial, sans-serif"><font size="2">So Java is a - compromise between portability and rapid development time versus - capacity (and speed).</font></font></dt><dt> - <font face="Arial, sans-serif"><font size="2">But IMO data sets larger - than 5.10<sup>5</sup> cells should not be kept in spreadsheets - anyway. Use real databases for such data sets.</font></font></dt><dt> - <br> - </dt><dt><font face="Arial, sans-serif"><font size="2"><b>ODFDOM versions</b></font></font></dt><dt> - <br> - </dt><dt><font face="Arial, sans-serif"><font size="2">I have tried various - odfdom version. As to 0.8 & 0.8.5, while the API has been - simplified enormously (finally one can address cells by spreadsheet - address rather than find out yourself by parsing the - table-column/-row/-cell structure), many irrecoverable bugs have - been introduced :-(( </font></font> - </dt><dt><font face="Arial, sans-serif"><font size="2">In addition - processing ODS files became significantly slower (up to 7 times!).</font></font></dt><dt> - <br> - </dt><dt><font face="Arial, sans-serif"><font size="2">End of August 2010 I - have implemented support for odfdom-0.8.6.jar \x96 that version - is at last sufficiently reliable to use. The few remaining bugs and - limitations could easily be worked around by diving in the older - TableTable API. Later on (early 2011) version 0.8.7 has been tested + </font></font></p></li><li><p align="left"> + \x93<font face="Arial, sans-serif"><font size="2">Passing function + handle\x94 a la Matlab's </font></font><font face="Arial, sans-serif"><font size="2"><b>xlsread</b></font></font></p></li><li><p align="left"> + <font face="Arial, sans-serif"><font size="2">Adding styles (borders, + cell lay-out, font, etc.)</font></font></p></li></ul> + <font face="Arial, sans-serif"><font size="2">Some notes on the + choice for Java:</font></font> + <ol> + <li> + <font face="Arial, sans-serif"><font size="2">It saves a LOT of + development time to use ready-baked Java classes rather than + developing your own routines and thus effectively reinvent the + wheel.</font></font></li><li> + <font face="Arial, sans-serif"><font size="2">A BIG advantage is that + a Java-based solution is platform-independent (\x93portable\x94).</font></font></li><li> + <font face="Arial, sans-serif"><font size="2">But Java is known to be + not very conservative with resources, especially not when processing + XML-based formats.</font></font></li></ol> + <dl> + <dt><font face="Arial, sans-serif"><font size="2">So Java is a + compromise between portability and rapid development time versus + capacity (and speed).</font></font></dt><dt> + <font face="Arial, sans-serif"><font size="2">But IMO data sets larger + than 5.10<sup>5</sup... [truncated message content] |