From octavemaintainersrequest@bevo.che.wisc.edu Fri Mar 6 02:42:02 1998
Received: (from slist@localhost) by bevo.che.wisc.edu (8.6.12/8.6.12) id CAA08788 for octavemaintainersdist@bevo.che.wisc.edu; Fri, 6 Mar 1998 02:42:02 0600
ResentDate: Fri, 6 Mar 1998 02:42:02 0600
Date: Fri, 6 Mar 1998 02:42:15 0600
MessageId: <199803060842.CAA02363@tillamooksharp.bogus.domain>
From: "John W. Eaton"
MIMEVersion: 1.0
ContentType: text/plain; charset=usascii
ContentTransferEncoding: 7bit
To: Andy Adler
Cc: octavemaintainers@bevo.che.wisc.edu
Subject: Sparse Matrices
InReplyTo:
References:
XMailer: VM 6.33 under Emacs 19.34.1
ResentMessageID: <"U9wdjA86tyI.A.g4G.ab7_0"@bevo.che.wisc.edu>
ResentFrom: octavemaintainers@bevo.che.wisc.edu
XMailingList:
XLoop: octavemaintainers@bevo.che.wisc.edu
Precedence: list
ResentSender: octavemaintainersrequest@bevo.che.wisc.edu
Sender: octavemaintainersrequest@bevo.che.wisc.edu
On 12Feb1998, Andy Adler wrote:
 I'm moving the discussion of Sparse Matrix support to here from
 helpoctave. After several people suggested different sparse matrix
 libraries from which to build sparse matrix routines for octave,
OK. Sorry for the delay in responding. I am interested in having
Octave handle sparse matrices.
 I took a look at the SuperLU package


 The package is fairly large
 rwrwr 1 andy andy 1579843 Feb 2 16:57 superlu.tar.gz
 but contains demos and other extras.
The copy I got also had a 1.6MB executable in the EXAMPLE directory.
Just without that, it was less than 1MB tarred and compressed.
 The compressed source is
 rwrwr 1 andy andy 347648 Feb 12 08:58 superlu_src.zip

 It's written in C++,
Looks more like just C to me, but if it works, that's not a big
problem.
 and has code for sequential and multithreaded
 calculation (I suspect multithreading would not be easy to implement in
 octave). It contains code to
 Factor: [L,U,p]= superlu(A) unit lower triangular L, upper triangular U,
 and permutation vector p with A(p,:) = L*U.
 Solve: x = lusolve(A, b) solution to the linear system A*x = b,
 Estimate condition number:
 Equilibrate:
 Refine Solution:
OK. I'm not an expert here, but this seems like a reasonable start.
What about other functions, like SVD? I think Matlab offers that,
doesn't it?
 The license is:
Probably OK for use with Octave.
 The package includes *.mex files for linking to Matlab. I tried this on a
 Sparc10 under Solaris and ran the test routines which showed that SuperLU
 is 3.0 times faster than Matlab's sparse routines for large matrices
 (4720x4720, nnz(A)=32164).

 QUESTION: Is this a good package to link to octave?
 Does anyone have oppinions/better ideas?
I don't know what is the best code to use. I hope that we can provide
a relatively generic internal interface for this sort of thing so that
it won't be difficult to switch later, if necessary.
 PROPOSAL: A first try link to octave.

 Initially it's probably best to write *.m and *.oct files to do sparse
 math. If these work well, jwe can probably be convinced to add a
 sparse matrix data format internally, as well as exending the operators
 to deal with sparse matrices.
Yes, though it might happen faster if someone else did the work.
 SPARSE MATRIX FORMAT: SuperLU uses the HarwellBoeing or (compressed
 column) format. This is different to the Matlab internal sparse format.
 The HB format should probably be used internally.

 Thus a sparse matrix S would be S.nrow > number of rows
 S.ncol > number of cols
 S.nnz > number of nonzero elements
 S.nzval > vector of nonzero elements
 S.rowind> vector index to rows
 S.colptr> vector pointer to rows
OK.
In Matlab, if I have an NxM sparse matrix S and I do something like
S(i,j) = x;
with either i>N, or j>M, is S automatically resized (as happens
for dense matrices)? Do range/vector indices work? What about
assignment of an empty matrix to delete rows or columns?
 FUNCTIONS TO WRITE:

 sparse > *.m file based on Matlab's sparse
Please don't say `based on' if what you really mean is `compatible
with'. To me, `based on' sounds like `derived from', which is no good
for Octave.
 S= sparse(i,j,s,m,n,nzmax) uses the rows of [i,j,s] to generate an
 mbyn sparse matrix with space allocated for nzmax nonzeros.
 S= sparse(A) generates sparse matrix S from full matrix A
OK.
 sp_add > corresponds to A+B
 sp_subtract > corresponds to AB
 sp_dot_times > corresponds to A.*B
 sp_multiply > corresponds to A*B
 sp_dot_divide > corresponds to A./B
 sp_divide > corresponds to A/B
Do we really need the sp_* forms here? Does Matlab provide those
functions? Once you have the data type, it is fairly simple to make
the operator overloading work within Octave for either sametype or
mixedtype operations.
 full > like Matlab

 superlu > *.oct file from *.mex file with SuperLU
 lusolve > *.oct file from *.mex file with SuperLU
OK.
Any suggestions on what to do next?
Thanks,
jwe
From octavemaintainersrequest@bevo.che.wisc.edu Sat Mar 7 15:21:21 1998
Received: (from slist@localhost) by bevo.che.wisc.edu (8.6.12/8.6.12) id PAA13810 for octavemaintainersdist@bevo.che.wisc.edu; Sat, 7 Mar 1998 15:21:21 0600
ResentDate: Sat, 7 Mar 1998 15:21:21 0600
Date: Sat, 7 Mar 1998 12:21:16 0900 (AKST)
From: Britton
To: octavemaintainers@bevo.che.wisc.edu
Subject: bug in audio 'record' function?
MessageId:
MimeVersion: 1.0
ContentType: TEXT/PLAIN; charset=USASCII
ResentMessageID: <"Sv0GuCvHCQH.A.yR.QpbA1"@bevo.che.wisc.edu>
ResentFrom: octavemaintainers@bevo.che.wisc.edu
XMailingList:
XLoop: octavemaintainers@bevo.che.wisc.edu
Precedence: list
ResentSender: octavemaintainersrequest@bevo.che.wisc.edu
Sender: octavemaintainersrequest@bevo.che.wisc.edu
I have noticed the following odd behavior in the record function:
1. At recording frequencies other than 8000 (44100 in my case) the record
function doesn't seem to obey the length parameter correctly. For 8000:
octave:7> samp1=record(10,8000)
Please hit ENTER and speak afterwards!
10+0 records in
10+0 records out
warning: connection to external pager (pid = 21260) lost 
warning: attempting to finish pending computations...
warning: broken pipe
octave:8> ls
pws_dsp test_for_octave.raw utility
octave:9> playaudio(samp1)
which appears to play and record perfectly over a ten second interval.
When I try 44100, it looks the same:
octave:11> samp2=record(10,44100)
Please hit ENTER and speak afterwards!
10+0 records in
10+0 records out
warning: connection to external pager (pid = 21265) lost 
warning: attempting to finish pending computations...
warning: broken pipe
octave:12> playaudio(samp2)
octave:13> playaudio(samp2)
except about 55 seconds are recorded and played back (suspiciously close
to 10*(44100/8000)=55.125). This was only measured by the 'date' command
in a seperate xterm. Perhaps I have misinterpreted this command?
Anyway, thanks for the excellent program octave. I have used it with a
bunch of third party MATLAB functions that came with my DSP course text
with almost no modification (mostly stripping wierd characters at the end
of lines :). It is a terrific piece of work.
Britton Kerin
__
GNU GPL: "The Source will be with you... always."
From octavemaintainersrequest@bevo.che.wisc.edu Wed Mar 11 12:46:23 1998
Received: (from slist@localhost)
by bevo.che.wisc.edu (8.8.8/8.8.8) id MAA21102
for octavemaintainersdist@bevo.che.wisc.edu; Wed, 11 Mar 1998 12:46:23 0600 (CST)
ResentDate: Wed, 11 Mar 1998 12:46:23 0600 (CST)
From: hopfgartner@rolmail.net
MessageID: <3506EB28.2DA22874@rolmail.net>
Date: Wed, 11 Mar 1998 20:51:04 +0100
XMailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.32 i586)
MIMEVersion: 1.0
To: octavemaintainers@bevo.che.wisc.edu
Subject: Matlablike view() function
ContentType: multipart/mixed; boundary="92C04D14D4B2853BCD7E9FE5"
ResentMessageID: <"iC7oE_c5ATB.A.oyE._vtB1"@bevo.che.wisc.edu>
ResentFrom: octavemaintainers@bevo.che.wisc.edu
XMailingList:
XLoop: octavemaintainers@bevo.che.wisc.edu
Precedence: list
ResentSender: octavemaintainersrequest@bevo.che.wisc.edu
Sender: octavemaintainersrequest@bevo.che.wisc.edu
This is a multipart message in MIME format.
92C04D14D4B2853BCD7E9FE5
ContentType: text/plain; charset=usascii
ContentTransferEncoding: 7bit
Hi,
I've attached the the mfilr that implements and a modified (from 2.1.5)
mesh.m file where the gnuplot gsets have been substituted with view();
It implements a subset of the MatLab view function, but it was just that
what I needed.
For JWE: I started looking into gtk to see if we could get a nice GUI
for the plotting, but I'm very slow since I'm a lot at work these days,
sorry.
Suggestion: should we take the spline function that comes with
plotutils?
Question: Have you had a look at gsl0.3a.tar.gz on alpha.gnu.org, seems
to be a junior Octavelib!
Regards,
Peter
92C04D14D4B2853BCD7E9FE5
ContentType: text/plain; charset=usascii; name="mesh.m"
ContentTransferEncoding: 7bit
ContentDisposition: inline; filename="mesh.m"
## Copyright (C) 1996, 1997 John W. Eaton
##
## This file is part of Octave.
##
## Octave is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## Octave is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING. If not, write to the Free
## Software Foundation, 59 Temple Place  Suite 330, Boston, MA
## 021111307, USA.
## usage: mesh (x, y, z)
##
## Surface plot. If x, y, and z are matrices with the same dimensions,
## then corresponding elements represent vertices of the plot. If x and
## y are vectors, then a typical vertex is (x(j), y(i), z(i,j)). Thus,
## columns of z correspond to different x values and rows of z correspond
## to different y values.
##
## See also: plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom,
## contour, bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title
## Author: jwe
function mesh (x, y, z)
## XXX FIXME XXX  the plot states should really just be set
## temporarily, probably inside an unwind_protect block, but there is
## no way to determine their current values.
if (nargin == 1)
z = x;
if (is_matrix (z))
gset hidden3d;
gset data style lines;
gset surface;
gset nocontour;
gset noparametric;
view();
gsplot (z');
else
error ("mesh: argument must be a matrix");
endif
elseif (nargin == 3)
if (is_vector (x) && is_vector (y) && is_matrix (z))
xlen = length (x);
ylen = length (y);
if (xlen == columns (z) && ylen == rows (z))
if (rows (y) == 1)
y = y';
endif
len = 3 * xlen;
zz = zeros (ylen, len);
k = 1;
for i = 1:3:len
zz(:,i) = x(k) * ones (ylen, 1);
zz(:,i+1) = y;
zz(:,i+2) = z(:,k);
k++;
endfor
gset hidden3d;
gset data style lines;
gset surface;
gset nocontour;
gset parametric;
view();
gsplot (zz);
gset noparametric;
else
msg = "mesh: rows (z) must be the same as length (x) and";
msg = sprintf ("%s\ncolumns (z) must be the same as length (y)", msg);
error (msg);
endif
elseif (is_matrix (x) && is_matrix (y) && is_matrix (z))
xlen = columns (z);
ylen = rows (z);
if (xlen == columns (x) && xlen == columns (y) &&
ylen == rows (x) && ylen == rows(y))
len = 3 * xlen;
zz = zeros (ylen, len);
k = 1;
for i = 1:3:len
zz(:,i) = x(:,k);
zz(:,i+1) = y(:,k);
zz(:,i+2) = z(:,k);
k++;
endfor
gset hidden3d;
gset data style lines;
gset surface;
gset nocontour;
gset parametric;
view();
gsplot (zz);
gset noparametric;
else
error ("mesh: x, y, and z must have same dimensions");
endif
else
error ("mesh: x and y must be vectors and z must be a matrix");
endif
else
usage ("mesh (z)");
endif
endfunction
92C04D14D4B2853BCD7E9FE5
ContentType: text/plain; charset=usascii; name="view.m"
ContentTransferEncoding: 7bit
ContentDisposition: inline; filename="view.m"
## Copyright (C) 1996 John W. Eaton
##
## This file is part of Octave.
##
## Octave is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## Octave is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING. If not, write to the Free
## Software Foundation, 59 Temple Place  Suite 330, Boston, MA
## 021111307, USA.
## usage: view(azimuth, elevation)
##
## Sets the viewpoint for a 3D surface plot.
##
## view([azimuth, elevation]) same as above
##
## [ret_az, ret_el] = view() sends the actual viewpoint to
## gnuplot and places it in [ret_az, ret_el].
##
## view(2) sets the viewpoint along the x axis
## view(3) sets the azimuth = 360  37.5 and elevation = 30
##
## NOTE: Doesn't implement the full functionality of the Matlab
## equivalent yet.
##
## Input:
## azimuth : Rotation around zaxis
## elevation : Rotation around xaxis
##
## Author: Peter Hopfgartner (hopfgartner@rolmail.net)
function [ret_az, ret_el] = view (azimuth, elevation)
## global variables to keep track of view options
global __view_azimuth__ =  37.5 + 360;
global __view_elevation__ = 30;
if (nargin == 0)
elseif (nargin == 1 && azimuth == 2)
__view_azimuth__ = 0;
__view_elevation__ = 90;
elseif (nargin == 1 && azimuth == 3)
__view_azimuth__ = 37.5 + 360;
__view_elevation__ = 30;
elseif (nargin == 1 && size(azimuth) == [1,2])
__view_azimuth__ = azimuth(1);
__view_elevation__ = azimuth(2);
elseif (nargin == 2 && is_scalar(azimuth) && is_scalar(elevation))
__view_azimuth__ = azimuth;
__view_elevation__ = elevation;
else
usage ("view (azimuth, elevation) or view ([azimuth, elevation])");
endif
if (__view_azimuth__ < 0  __view_azimuth__ > 360)
error ("azimuth must be in [0, 360]");
elseif (__view_elevation__ < 0  __view_elevation__ > 180)
error ("elevation must be in [0, 180]");
endif
eval (sprintf("gset view %4.1f, %4.1f", __view_elevation__, \
__view_azimuth__ ));
ret_az = __view_azimuth__;
ret_el = __view_elevation__;
endfunction
92C04D14D4B2853BCD7E9FE5