Skip to content

Commit b996466

Browse files
committed
Octave API: Added support for interval arithmetic libraries
1 parent a9d0a69 commit b996466

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

client-api/Octave/DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Description: VIBes is a visualization system that aims at providing people
1717
program to communicate with the viewer in order to draw figures.
1818

1919
This package integrates the VIBes API into Octave. The VIBes application
20-
is required for operation and must be installed seperately.
20+
is required for operation and must be installed seperately. Data types from
21+
third-party interval arithmetic libraries for Octave are also supportd.
2122
Depends: octave (>= 4.0.0)
2223
License: GPLv3+

client-api/Octave/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ run: $(INSTALLED_PACKAGE)
115115
.PHONY: clean
116116

117117
clean:
118-
rm -f \
118+
rm -rf \
119119
"$(PACKAGE)-*.tar" \
120120
"$(PACKAGE)-*.tar.gz" \
121121
"$(HTML_DIR)" \

client-api/Octave/inst/+vibes/drawBox.m

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
## -*- texinfo -*-
2020
## @documentencoding UTF-8
2121
## @deftypefn {Function File} {} vibes.drawBox (@var{box})
22-
## Plot a single box with pairs of lower bounds and upper bounds. The matrix
23-
## @var{box} must be of size either @option{[2 @var{n}]} or
22+
## Plot a single box with pairs of lower bounds and upper bounds.
23+
##
24+
## The matrix @var{box} must be of size either @option{[2 @var{n}]} or
2425
## @option{[@var{n} 2]}, where @var{n} is the number of axes.
26+
##
27+
## Alternatively @var{box} may be an interval vector.
2528
## @end deftypefn
2629
##
2730
## @deftypefn {Function File} {} vibes.drawBox (@var{x_lb}, @var{x_ub}, @var{y_lb}, @var{y_ub})
@@ -42,6 +45,22 @@ function drawBox (varargin)
4245
print_usage ();
4346
endif
4447

48+
if (any (isa (varargin{1}, {'infsup', 'intval'})))
49+
varargin{1} = horzcat (vec (inf (varargin{1})), ...
50+
vec (sup (varargin{1})));
51+
## Stack multiple intervals into a common box
52+
for i = 2 : nargin
53+
if (any (isa (varargin{2}, {'infsup', 'intval'})))
54+
varargin = {vertcat(varargin{1}, ...
55+
horzcat (vec (inf (varargin{2})), ...
56+
vec (sup (varargin{2})))), ...
57+
varargin{3:end}};
58+
else
59+
break
60+
endif
61+
endfor
62+
endif
63+
4564
__vibes__ ('drawBox', varargin{:});
4665

4766
endfunction

0 commit comments

Comments
 (0)