<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-1901</id>
	<title>Nabble - Octave - Sources</title>
	<updated>2009-12-23T06:59:33Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/Octave---Sources-f1901.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Octave---Sources-f1901.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26903233</id>
	<title>How to read .oct files</title>
	<published>2009-12-23T06:59:33Z</published>
	<updated>2009-12-23T06:59:33Z</updated>
	<author>
		<name>Alberto Frigerio</name>
	</author>
	<content type="html">Hi everyone, I've installed Octave 3.2.2 on Windows and I'm using as editor Notepad++.
&lt;br&gt;&lt;br&gt;I've found a .oct file ... how can I read it?
&lt;br&gt;&lt;br&gt;Thanks everyone, season greetings.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;Alberto</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-read-.oct-files-tp26903233p26903233.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-24291376</id>
	<title>R shuts down when using convhulln</title>
	<published>2009-07-01T08:02:11Z</published>
	<updated>2009-07-01T08:02:11Z</updated>
	<author>
		<name>aschle</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&amp;nbsp;
&lt;br&gt;I am using the convhulln function of the geometry package in R to calculate the area or volume of a set of points. The coordinates originate from a principal coordinate analysis.
&lt;br&gt;Unfortunately, R is reporting a bug and shuts down in some cases and I have no clue why.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;I am using the following commands and this is an example of an input that causes collapsing of R&lt;a href=&quot;http://old.nabble.com/file/p24291376/error_data.csv&quot; target=&quot;_top&quot;&gt;error_data.csv&lt;/a&gt;:
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;gt; tr.FRic
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A2
&lt;br&gt;agrostol 0.6173727 -0.3677336
&lt;br&gt;festrubr 1.3954408 -0.3376593
&lt;br&gt;holclana 1.6402562 -0.3281966
&lt;br&gt;lolipere 2.7853389 -0.2839363
&lt;br&gt;poa_comp 0.7604766 -0.3622022
&lt;br&gt;vicicrac 1.2000460 -0.3452118
&lt;br&gt;&amp;gt; str(tr.FRic)
&lt;br&gt;'data.frame': &amp;nbsp; 6 obs. of &amp;nbsp;2 variables:
&lt;br&gt;&amp;nbsp;$ A1: num &amp;nbsp;0.617 1.395 1.64 2.785 0.76 ...
&lt;br&gt;&amp;nbsp;$ A2: num &amp;nbsp;-0.368 -0.338 -0.328 -0.284 -0.362 ...
&lt;br&gt;&lt;br&gt;&amp;gt;convhulln(tr.FRic,&amp;quot;FA&amp;quot;)
&lt;br&gt;&lt;br&gt;Thanks for any advice!
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Andrea Schleicher
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/R-shuts-down-when-using-convhulln-tp24291376p24291376.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-21724008</id>
	<title>Robust fit as Matlab</title>
	<published>2009-01-29T02:10:10Z</published>
	<updated>2009-01-29T02:10:10Z</updated>
	<author>
		<name>cristiano74</name>
	</author>
	<content type="html">Dear lister,
&lt;br&gt;&amp;nbsp;there is in octave a clone of Matlab &lt;b&gt;robustfit&lt;/b&gt;&amp;nbsp;funtion ?
&lt;br&gt;&lt;br&gt;Thanks in advance.
&lt;br&gt;&lt;br&gt;Cristiano</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Robust-fit-as-Matlab-tp21724008p21724008.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-21589096</id>
	<title>How to print from the shell??</title>
	<published>2009-01-21T10:21:51Z</published>
	<updated>2009-01-21T10:21:51Z</updated>
	<author>
		<name>Adriana Cardozo</name>
	</author>
	<content type="html">Hello all,
&lt;br&gt;&lt;br&gt;Sorry for my basic question but I am new in the octave world.
&lt;br&gt;&lt;br&gt;I would like to know how can I print from the shell?? I run my program and see my results in the black screen. How can I print those results?
&lt;br&gt;&lt;br&gt;Thank you for your help.</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/How-to-print-from-the-shell---tp21589096p21589096.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-21565669</id>
	<title>clabel function for Octave</title>
	<published>2009-01-20T07:06:34Z</published>
	<updated>2009-01-20T07:06:34Z</updated>
	<author>
		<name>Tim King-2</name>
	</author>
	<content type="html">Hi There,&lt;br&gt;&lt;br&gt;I&amp;#39;ve attached the clabel function that I wrote for Octave. It doesn&amp;#39;t do everything that the MATLAB version does but it&amp;#39;ll do the basics.&lt;br&gt;Constructive criticism is welcome.&lt;br&gt;&lt;br&gt;Hope it helps,&lt;br&gt;
Tim King&lt;br&gt;
&lt;br /&gt; &lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=21565669&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www-old.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www-old.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;clabel.m&lt;/strong&gt; (1K) &lt;a href=&quot;http://old.nabble.com/attachment/21565669/0/clabel.m&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/clabel-function-for-Octave-tp21565669p21565669.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-16431110</id>
	<title>Re: sosfilt.cc</title>
	<published>2008-03-31T13:47:18Z</published>
	<updated>2008-03-31T13:47:18Z</updated>
	<author>
		<name>Eric Chassande-Mottin</name>
	</author>
	<content type="html">&amp;gt; &amp;nbsp;This will prevent the code running after an error in reading the
&lt;br&gt;&amp;gt; &amp;nbsp;argument list. Do you want to commit this to the octave-forge signal
&lt;br&gt;&amp;gt; &amp;nbsp;toolbox?
&lt;br&gt;&lt;br&gt;hi, I already committed this code (among other things) about a month ago.
&lt;br&gt;the code now complies the coding rules you mention.
&lt;br&gt;regarding dataread.m, i think that textread.oct in octave-forge does the job
&lt;br&gt;much better and faster than the code I sent. note that matlab has several
&lt;br&gt;functions for reading ascii data files. they are redundant. I don't
&lt;br&gt;think it is worth
&lt;br&gt;to have and maintain all of them in octave. cheers, eric.
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16431110&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/sosfilt.cc-tp16401392p16431110.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-16430840</id>
	<title>Re: dataread.m</title>
	<published>2008-03-31T08:20:59Z</published>
	<updated>2008-03-31T08:20:59Z</updated>
	<author>
		<name>David Bateman</name>
	</author>
	<content type="html">Eric Chassande-Mottin wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; here is an implementation of dataread.m. it does not
&lt;br&gt;&amp;gt; include all features of the original matlab function but
&lt;br&gt;&amp;gt; in many case, it does the job.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; eric.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Octave-sources mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16430840&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;This is a matlab core function and so should go into the Octave core as
&lt;br&gt;well. You need to follow the Octave coding style to fix this function
&lt;br&gt;before it might be included.. See the layout of some of the other
&lt;br&gt;m-files in Octave.
&lt;br&gt;&lt;br&gt;D.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;David Bateman &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16430840&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;David.Bateman@...&lt;/a&gt;
&lt;br&gt;Motorola Labs - Paris &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 48 04 (Ph) 
&lt;br&gt;Parc Les Algorithmes, Commune de St Aubin &amp;nbsp; &amp;nbsp;+33 6 72 01 06 33 (Mob) 
&lt;br&gt;91193 Gif-Sur-Yvette FRANCE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 77 01 (Fax) 
&lt;br&gt;&lt;br&gt;The information contained in this communication has been classified as: 
&lt;br&gt;&lt;br&gt;[x] General Business Information 
&lt;br&gt;[ ] Motorola Internal Use Only 
&lt;br&gt;[ ] Motorola Confidential Proprietary
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16430840&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/dataread.m-tp16401645p16430840.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-16430558</id>
	<title>Re: sosfilt.cc</title>
	<published>2008-03-31T08:18:42Z</published>
	<updated>2008-03-31T08:18:42Z</updated>
	<author>
		<name>David Bateman</name>
	</author>
	<content type="html">Eric Chassande-Mottin wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; here is a possible implementation for sosfilt().
&lt;br&gt;&amp;gt; I have checked that it gives consistent results
&lt;br&gt;&amp;gt; as compared to matlab's version.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; eric
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Octave-sources mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16430558&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;/div&gt;This is a signal processing toolbox function. It should go into
&lt;br&gt;octave-forge instead. You also need to check error_state after
&lt;br&gt;initializing the variables to see that a matrix has been read.
&lt;br&gt;&lt;br&gt;&amp;nbsp; Matrix sos( args(0).matrix_value() );
&lt;br&gt;&amp;nbsp; ColumnVector x( args(1).vector_value() );
&lt;br&gt;&amp;nbsp; if (error_state)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// The rest of the code
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&lt;br&gt;This will prevent the code running after an error in reading the
&lt;br&gt;argument list. Do you want to commit this to the octave-forge signal
&lt;br&gt;toolbox?
&lt;br&gt;&lt;br&gt;D.
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;David Bateman &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16430558&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;David.Bateman@...&lt;/a&gt;
&lt;br&gt;Motorola Labs - Paris &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 48 04 (Ph) 
&lt;br&gt;Parc Les Algorithmes, Commune de St Aubin &amp;nbsp; &amp;nbsp;+33 6 72 01 06 33 (Mob) 
&lt;br&gt;91193 Gif-Sur-Yvette FRANCE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 77 01 (Fax) 
&lt;br&gt;&lt;br&gt;The information contained in this communication has been classified as: 
&lt;br&gt;&lt;br&gt;[x] General Business Information 
&lt;br&gt;[ ] Motorola Internal Use Only 
&lt;br&gt;[ ] Motorola Confidential Proprietary
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16430558&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/sosfilt.cc-tp16401392p16430558.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-16401645</id>
	<title>dataread.m</title>
	<published>2008-02-25T03:24:23Z</published>
	<updated>2008-02-25T03:24:23Z</updated>
	<author>
		<name>Eric Chassande-Mottin</name>
	</author>
	<content type="html">here is an implementation of dataread.m. it does not
&lt;br&gt;include all features of the original matlab function but
&lt;br&gt;in many case, it does the job.
&lt;br&gt;&lt;br&gt;eric.
&lt;br&gt;&lt;br /&gt; &lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16401645&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;dataread.m&lt;/strong&gt; (1K) &lt;a href=&quot;http://old.nabble.com/attachment/16401645/0/dataread.m&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/dataread.m-tp16401645p16401645.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-16401392</id>
	<title>sosfilt.cc</title>
	<published>2008-02-25T03:13:04Z</published>
	<updated>2008-02-25T03:13:04Z</updated>
	<author>
		<name>Eric Chassande-Mottin</name>
	</author>
	<content type="html">here is a possible implementation for sosfilt().
&lt;br&gt;I have checked that it gives consistent results
&lt;br&gt;as compared to matlab's version.
&lt;br&gt;&lt;br&gt;eric
&lt;br&gt;&lt;br /&gt;&lt;tt&gt;[sosfilt.cc]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;&lt;br&gt;// sosfilt.cc -- Second order IIR filtering
&lt;br&gt;&lt;br&gt;// This file may be used under the terms defined by the GNU 
&lt;br&gt;// General Public License [write to the Free Software Foundation, 
&lt;br&gt;// 59 Temple Place - Suite 330, Boston, MA &amp;nbsp;02111-1307, USA]
&lt;br&gt;//
&lt;br&gt;// WITHOUT ANY WARRANTY; without even the implied warranty 
&lt;br&gt;// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &amp;nbsp;
&lt;br&gt;//
&lt;br&gt;// Copyright (C) 2008 Eric Chassande-Mottin, CNRS (France)
&lt;br&gt;&lt;br&gt;//
&lt;br&gt;&lt;br&gt;#include &amp;lt;octave/config.h&amp;gt;
&lt;br&gt;&lt;br&gt;#include &amp;lt;iostream&amp;gt;
&lt;br&gt;#include &amp;lt;sstream&amp;gt;
&lt;br&gt;using namespace std;
&lt;br&gt;#include &amp;lt;string&amp;gt;
&lt;br&gt;&lt;br&gt;#include &amp;lt;octave/defun-dld.h&amp;gt;
&lt;br&gt;#include &amp;lt;octave/error.h&amp;gt;
&lt;br&gt;#include &amp;lt;octave/oct-obj.h&amp;gt;
&lt;br&gt;#include &amp;lt;octave/pager.h&amp;gt;
&lt;br&gt;#include &amp;lt;octave/symtab.h&amp;gt;
&lt;br&gt;#include &amp;lt;octave/variables.h&amp;gt;
&lt;br&gt;&lt;br&gt;#include &amp;lt;vector&amp;gt;
&lt;br&gt;using namespace std;
&lt;br&gt;&lt;br&gt;&lt;br&gt;DEFUN_DLD (sosfilt, args,,
&lt;br&gt;&amp;nbsp; &amp;quot;Second order IIR filtering\n&amp;quot;)
&lt;br&gt;{
&lt;br&gt;&amp;nbsp; octave_value_list retval;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; int nargin = args.length ();
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; if (nargin &amp;lt; 2)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; error(&amp;quot;Usage: &amp;nbsp;y = sosfilt(sos,x)&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; Matrix sos( args(0).matrix_value() );
&lt;br&gt;&lt;br&gt;&amp;nbsp; ColumnVector x( args(1).vector_value() );
&lt;br&gt;&amp;nbsp; int n=x.length();
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (sos.columns()!=6)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; error(&amp;quot;Second-order matrix must be a non-empty Lx6 matrix&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; ColumnVector y(n,0.0);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; for (int j=0; j&amp;lt;sos.rows(); j++)
&lt;br&gt;&amp;nbsp; &amp;nbsp; {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; double v0=0.0, v1=0.0, v2=0.0;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; double b0=sos(j,0);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; double b1=sos(j,1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; double b2=sos(j,2);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; double a1=sos(j,4);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; double a2=sos(j,5);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i=0; i&amp;lt;n; i++)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; v0=x(i)-a1*v1-a2*v2;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; y(i)=b0*v0+b1*v1+b2*v2;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; v2=v1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; v1=v0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; x=y;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; retval(0)=y;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; return retval;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=16401392&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/sosfilt.cc-tp16401392p16401392.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-14516297</id>
	<title>function for Octave</title>
	<published>2007-12-27T08:35:11Z</published>
	<updated>2007-12-27T08:35:11Z</updated>
	<author>
		<name>ELHIDRI ZYED</name>
	</author>
	<content type="html">&lt;br&gt;&amp;nbsp;&amp;nbsp; I would like to say thank you very much for all your &lt;br&gt;effort in conceiving Octave,and&amp;nbsp; I must say it's a pleasure&lt;br&gt;to share this function with others.&lt;br&gt;&lt;br&gt;&lt;p&gt;&amp;#32;
      &lt;hr size=1&gt;Looking for last minute shopping deals? &lt;a href=&quot;http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt; 
Find them fast with Yahoo! Search.&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=14516297&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;unitfeedback.m&lt;/strong&gt; (2K) &lt;a href=&quot;http://old.nabble.com/attachment/14516297/0/unitfeedback.m&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/function-for-Octave-tp14516297p14516297.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-14496654</id>
	<title>Symmetric block Toeplitz solver</title>
	<published>2007-12-23T15:38:33Z</published>
	<updated>2007-12-23T15:38:33Z</updated>
	<author>
		<name>Keenan Pepper</name>
	</author>
	<content type="html">The attached function solves equations involving symmetric block
&lt;br&gt;Toeplitz matrices. It uses a block version of Levinson-Durbin
&lt;br&gt;recursion. I needed it for computing multiple-input-channel Wiener
&lt;br&gt;filters; maybe someone else will find it useful.
&lt;br&gt;&lt;br&gt;Keenan Pepper
&lt;br&gt;&lt;br /&gt;&lt;tt&gt;[block_levinson.m]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;function x = block_levinson(y, L)
&lt;br&gt;%BLOCK_LEVINSON Block Levinson recursion for efficiently solving 
&lt;br&gt;%symmetric block Toeplitz matrix equations.
&lt;br&gt;% &amp;nbsp; BLOCK_LEVINSON(Y, L) solves the matrix equation T * x = y, where T 
&lt;br&gt;% &amp;nbsp; is a symmetric matrix with block Toeplitz structure, and returns the 
&lt;br&gt;% &amp;nbsp; solution vector x. The matrix T is never stored in full (because it 
&lt;br&gt;% &amp;nbsp; is large and mostly redundant), so the input parameter L is actually 
&lt;br&gt;% &amp;nbsp; the leftmost &amp;quot;block column&amp;quot; of T (the leftmost d columns where d is 
&lt;br&gt;% &amp;nbsp; the block dimension).
&lt;br&gt;&lt;br&gt;% &amp;nbsp; Author: Keenan Pepper
&lt;br&gt;% &amp;nbsp; Last modified: 2007-12-23
&lt;br&gt;&lt;br&gt;% &amp;nbsp; References:
&lt;br&gt;% &amp;nbsp; &amp;nbsp; [1] Akaike, Hirotugu (1973). &amp;quot;Block Toeplitz Matrix Inversion&amp;quot;.
&lt;br&gt;% &amp;nbsp; &amp;nbsp; SIAM J. Appl. Math. 24 (2): 234-241
&lt;br&gt;&lt;br&gt;s = size(L);
&lt;br&gt;d = s(2); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % Block dimension
&lt;br&gt;N = s(1) / d; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % Number of blocks
&lt;br&gt;&lt;br&gt;B = reshape(L, [d,N,d]); &amp;nbsp;% This is just to get the bottom block row B
&lt;br&gt;B = permute(B, [1,3,2]); &amp;nbsp;% from the left block column L
&lt;br&gt;B = flipdim(B, 3);
&lt;br&gt;B = reshape(B, [d,N*d]);
&lt;br&gt;&lt;br&gt;f = L(1:d,:)^-1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;% &amp;quot;Forward&amp;quot; block vector
&lt;br&gt;b = f; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;% &amp;quot;Backward&amp;quot; block vector
&lt;br&gt;x = f * y(1:d); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % Solution vector
&lt;br&gt;&lt;br&gt;for n = 2:N
&lt;br&gt;&amp;nbsp; &amp;nbsp; ef = B(:,(N-n)*d+1:N*d) * [f;zeros(d)];
&lt;br&gt;&amp;nbsp; &amp;nbsp; eb = L(1:n*d,:)' * [zeros(d);b];
&lt;br&gt;&amp;nbsp; &amp;nbsp; ex = B(:,(N-n)*d+1:N*d) * [x;zeros(d,1)];
&lt;br&gt;&amp;nbsp; &amp;nbsp; A = [eye(d),eb;ef,eye(d)]^-1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; fn = [[f;zeros(d)],[zeros(d);b]] * A(:,1:d);
&lt;br&gt;&amp;nbsp; &amp;nbsp; bn = [[f;zeros(d)],[zeros(d);b]] * A(:,d+1:end);
&lt;br&gt;&amp;nbsp; &amp;nbsp; f = fn;
&lt;br&gt;&amp;nbsp; &amp;nbsp; b = bn;
&lt;br&gt;&amp;nbsp; &amp;nbsp; x = [x;zeros(d,1)] + b * (y((n-1)*d+1:n*d) - ex);
&lt;br&gt;end
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=14496654&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Symmetric-block-Toeplitz-solver-tp14496654p14496654.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-14496627</id>
	<title>Re: K-sample Anderson-Darling test</title>
	<published>2007-11-29T05:28:49Z</published>
	<updated>2007-11-29T05:28:49Z</updated>
	<author>
		<name>Eric Chassande-Mottin</name>
	</author>
	<content type="html">&amp;gt; Maybe these should be added to Octave-Forge in the statistics toolbox.
&lt;br&gt;&amp;gt; How do they compare to the similar functions on mathworks file exchange?
&lt;br&gt;&lt;br&gt;the code might have to be adapted to the standards of the statistic
&lt;br&gt;toolbox (the present code doesn't produce a p-value). I just had a
&lt;br&gt;look to the function in the mathworks file exchange. my implementation
&lt;br&gt;is different (I used the method of kolmogorov_smirnov_test.m to get
&lt;br&gt;the distribution function of the pooled set whereas they use hist.m)
&lt;br&gt;however both functions should give the same result.
&lt;br&gt;their input data structure is kind of complicated. cell array of
&lt;br&gt;vectors is the natural choice. I see that they implemented the
&lt;br&gt;discrete case (with ties).
&lt;br&gt;i hope I answer your question.
&lt;br&gt;&lt;br&gt;eric.
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=14496627&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/K-sample-Anderson-Darling-test-tp14496559p14496627.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-14496609</id>
	<title>Re: K-sample Anderson-Darling test</title>
	<published>2007-11-29T02:22:57Z</published>
	<updated>2007-11-29T02:22:57Z</updated>
	<author>
		<name>dbateman3</name>
	</author>
	<content type="html">Eric Chassande-Mottin wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I have sent this message to the octave-sources mailing list twice yesterday
&lt;br&gt;&amp;gt; but somehow the two copies haven't gone through. I send it one more time
&lt;br&gt;&amp;gt; with a copy to help-octave.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ----------------------------------------------------------------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; hi,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I have coded the K-sample Anderson-Darling test [*].
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; It tests if the populations of several (more than two) random samples
&lt;br&gt;&amp;gt; are drawned from the same distribution. This test is an extension of
&lt;br&gt;&amp;gt; the Kolmogorov-Smirnov test and it is known to be more sensitive
&lt;br&gt;&amp;gt; to discrepancies in the tails of the distribution.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; The implementation follows exactly [*] and it only provides the &amp;quot;continuous&amp;quot;
&lt;br&gt;&amp;gt; distribution case. Note that the compensation given in [*] for the discrete case
&lt;br&gt;&amp;gt; (with ties), is not provided here.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; adt.m execute three basic checks of ad.m
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Ref: [*] K-sample Anderson-Darling tests, Schotz and Stephens
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Journal of American Statistical Association, p 918, 1987.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; cheers,
&lt;br&gt;&amp;gt; eric.
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;Maybe these should be added to Octave-Forge in the statistics toolbox.
&lt;br&gt;How do they compare to the similar functions on mathworks file exchange?
&lt;br&gt;&lt;br&gt;D.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=14496609&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/K-sample-Anderson-Darling-test-tp14496559p14496609.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-14496559</id>
	<title>K-sample Anderson-Darling test</title>
	<published>2007-11-28T06:32:26Z</published>
	<updated>2007-11-28T06:32:26Z</updated>
	<author>
		<name>Eric Chassande-Mottin</name>
	</author>
	<content type="html">hi,
&lt;br&gt;&lt;br&gt;I have coded the K-sample Anderson-Darling test [*].
&lt;br&gt;&lt;br&gt;It tests if the populations of several (more than two) random samples
&lt;br&gt;are drawned from the same distribution. This test is an extension of
&lt;br&gt;the Kolmogorov-Smirnov test and it is known to be more sensitive
&lt;br&gt;to discrepancies in the tails of the distribution.
&lt;br&gt;&lt;br&gt;The implementation follows exactly [*] and it only provides the &amp;quot;continuous&amp;quot;
&lt;br&gt;distribution case. Note that the compensation given in [*] for the discrete case
&lt;br&gt;(with ties), is not provided here.
&lt;br&gt;&lt;br&gt;adt.m execute three basic checks of ad.m
&lt;br&gt;&lt;br&gt;Ref: [*] K-sample Anderson-Darling tests, Schotz and Stephens
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Journal of American Statistical Association, p 918, 1987.
&lt;br&gt;&lt;br&gt;cheers,
&lt;br&gt;eric.
&lt;br&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=14496559&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;ad.m&lt;/strong&gt; (3K) &lt;a href=&quot;http://old.nabble.com/attachment/14496559/0/ad.m&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;br/&gt;&lt;img src=&quot;http://old.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;adt.m&lt;/strong&gt; (1K) &lt;a href=&quot;http://old.nabble.com/attachment/14496559/1/adt.m&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/K-sample-Anderson-Darling-test-tp14496559p14496559.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13901402</id>
	<title>Re: rcond, condest, and a block 1-norm estimator</title>
	<published>2007-11-22T01:29:58Z</published>
	<updated>2007-11-22T01:29:58Z</updated>
	<author>
		<name>David Bateman</name>
	</author>
	<content type="html">Jason Riedy wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; And David Bateman writes:
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; I believe the rcond function should take rcond from the LAPACK
&lt;br&gt;&amp;gt;&amp;gt; factorization, at least I believe is what matlab does. [...]
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; For various reasons, I'm not referring to MATLAB(tm) itself or
&lt;br&gt;&amp;gt; any docs other than what is on-line and trivially findable. &amp;nbsp;I
&lt;br&gt;&amp;gt; have no idea if MATLAB's rcond applies to sparse matrices. &amp;nbsp;I
&lt;br&gt;&amp;gt; know LAPACK's does not.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; help rcond
&lt;/div&gt;&amp;nbsp;RCOND &amp;nbsp;LAPACK reciprocal condition estimator.
&lt;br&gt;&amp;nbsp; &amp;nbsp; RCOND(X) is an estimate for the reciprocal of the
&lt;br&gt;&amp;nbsp; &amp;nbsp; condition of X in the 1-norm obtained by the LAPACK
&lt;br&gt;&amp;nbsp; &amp;nbsp; condition estimator. If X is well conditioned, RCOND(X)
&lt;br&gt;&amp;nbsp; &amp;nbsp; is near 1.0. If X is badly conditioned, RCOND(X) is
&lt;br&gt;&amp;nbsp; &amp;nbsp; near EPS.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; See also COND, NORM, CONDEST, NORMEST.
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; rcond(speye(1024))
&lt;br&gt;??? Error using ==&amp;gt; rcond
&lt;br&gt;Use rcond(full(S)) or condest(S).
&lt;br&gt;&lt;br&gt;So the matlab rcond function works only for full matrices and uses the
&lt;br&gt;lapack rcond estimation from the factorization.. There needs to be a
&lt;br&gt;little reorganization to get this to work optimally in Octave. Till then
&lt;br&gt;a minimal rcond implementation for Octave is
&lt;br&gt;&lt;br&gt;function &amp;nbsp;rc = rcond (x)
&lt;br&gt;&amp;nbsp; [dummy, rc] = inv (x);
&lt;br&gt;endfunction
&lt;br&gt;&lt;br&gt;As Octave also calculates the condition number for inverse of sparse
&lt;br&gt;matrices if requested, this works also for sparse matrices, though
&lt;br&gt;forming the inverse of a sparse matrix is always a bad idea..
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; That said, I have been losing the argument to use the block
&lt;br&gt;&amp;gt; estimator in LAPACK... &amp;nbsp;We may weaken the routine slightly
&lt;br&gt;&amp;gt; instead. &amp;nbsp;For &amp;quot;small&amp;quot; problems, computing RCOND is very, very
&lt;br&gt;&amp;gt; expensive right now. &amp;nbsp;The current norm estimator uses a very safe
&lt;br&gt;&amp;gt; but very slow triangular solve. &amp;nbsp;We likely will replace that with
&lt;br&gt;&amp;gt; the fast solve, followed by a check for overflow and re-running
&lt;br&gt;&amp;gt; with the slow solve if necessary. &amp;nbsp;That will catch and re-scale
&lt;br&gt;&amp;gt; overflows, but it won't catch possibly avoidable underflows
&lt;br&gt;&amp;gt; during estimation.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; So it's up to y'all what rcond() should be. &amp;nbsp;The routine I
&lt;br&gt;&amp;gt; included computes the inverse of the 1-norm condition number of A
&lt;br&gt;&amp;gt; (iirc), and LAPACK's RCOND returned by xyySVX is the inverse of
&lt;br&gt;&amp;gt; the inf-norm condition number of the matrix that actually is
&lt;br&gt;&amp;gt; factored. &amp;nbsp;That matrix may have been equilibrated, so determining
&lt;br&gt;&amp;gt; how LAPACK's RCOND relates to your original matrix requires
&lt;br&gt;&amp;gt; examining a bunch of parameters MATLAB's rcond() doesn't return.
&lt;br&gt;&amp;gt; Without experimenting, I can't tell what MATLAB's rcond() really
&lt;br&gt;&amp;gt; does.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;I believe its simpler than that.. I think matlab uses the xGETRF
&lt;br&gt;functions of lapack that return an estimate of rcond, and matlab just
&lt;br&gt;returns that estimate..
&lt;br&gt;&amp;gt; The only use for LAPACK's RCOND directly is to see if the
&lt;br&gt;&amp;gt; factorization algorithm came close to solving with a nearly a
&lt;br&gt;&amp;gt; singular matrix when forming a Schur complement. &amp;nbsp;It tells you
&lt;br&gt;&amp;gt; very little about the actual problem you are trying to solve or
&lt;br&gt;&amp;gt; even about any errors when using the factorization; RCOND may be
&lt;br&gt;&amp;gt; measured with an entirely different norm (scaled by
&lt;br&gt;&amp;gt; equilibration) than your problem.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;xGETRF scales the inverse norm estimation by the 1-norm and so I don't
&lt;br&gt;think this is the case. You're certainly right for the xGESVX LAPACK
&lt;br&gt;routines though. The result is that if the matrix is near singular then
&lt;br&gt;the rcond extimate will be incorrect. However, as rcond is only supposed
&lt;br&gt;to be used to estimate if a matrix is singular, then this error probably
&lt;br&gt;isn't an issue.
&lt;br&gt;&lt;br&gt;&amp;gt; And if you pick up our extra-precise refinement drivers (once we
&lt;br&gt;&amp;gt; actually ship the damned things, see LAWN 165), you will have
&lt;br&gt;&amp;gt; more and more relevant condition numbers from which to chose.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;Choice is good for a developer, though how to hide it from the user
&lt;br&gt;behind simple driver routines is always an issue.
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; Matlab calls the normest1 function, that is basically your
&lt;br&gt;&amp;gt;&amp;gt; block_onenorm_est, and then multiples the estimated inverse
&lt;br&gt;&amp;gt;&amp;gt; norm by norm(A,1) to get the condition number estimate.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;From MathWorks' pages, it seems normest has a very different
&lt;br&gt;&amp;gt; interface. &amp;nbsp;Hence the cumbersome block_onenorm_est name.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;normest is a 2-norm estimate using the power method to find the largest
&lt;br&gt;singular value. Octave has that routine. No your block_onenorm_est is
&lt;br&gt;like the normest1 routine from Matlab. The interface to normest1 has a
&lt;br&gt;function handle to the solver passed as the first argument, whereas your
&lt;br&gt;code has a solver and a solver for the conjugate transpose. Frankly I
&lt;br&gt;don't think normest1 in itself is a useful function and so if its not
&lt;br&gt;implemented who cares. We just need a matlab compatible interface to
&lt;br&gt;condest..
&lt;br&gt;&lt;br&gt;&amp;gt; But your description is not the RCOND returned from LAPACK's
&lt;br&gt;&amp;gt; linear system drivers. &amp;nbsp;;)
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;No, I was trying in my non-mathematicians manner to describe your code :-)
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; condest is one of the annoying missing sparse functions in
&lt;br&gt;&amp;gt;&amp;gt; Octave...
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Amen. &amp;nbsp;Limits Octave's applicability for many colleagues.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;Well, I definitely want condest and your code gives it. I see if I can
&lt;br&gt;convert it to Octave style and sent it back to you for your comments..
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt;&amp;gt; I'd hesitate to include it though with the rcond function with
&lt;br&gt;&amp;gt;&amp;gt; its current name...
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I have little ego about these things. &amp;nbsp;Use, change, and rename as
&lt;br&gt;&amp;gt; you see fit. &amp;nbsp;Just thought I should send along my good-enough
&lt;br&gt;&amp;gt; versions as a starting point.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I'm not in a position to get into the copyright assignment
&lt;br&gt;&amp;gt; argument here right now, so feel free to make sufficient,
&lt;br&gt;&amp;gt; copyrightable changes that are assigned and licensed
&lt;br&gt;&amp;gt; appropriately. &amp;nbsp;;) These are just the routines I'm using right
&lt;br&gt;&amp;gt; now.
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;If I used the BSD license you've chosen it allows relicensing under a
&lt;br&gt;GPL, so I would suggest doing that and keeping you as the author..
&lt;br&gt;&lt;br&gt;Cheers, and thanks for the code.
&lt;br&gt;D.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; Jason
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;David Bateman &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13901402&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;David.Bateman@...&lt;/a&gt;
&lt;br&gt;Motorola Labs - Paris &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 48 04 (Ph) 
&lt;br&gt;Parc Les Algorithmes, Commune de St Aubin &amp;nbsp; &amp;nbsp;+33 6 72 01 06 33 (Mob) 
&lt;br&gt;91193 Gif-Sur-Yvette FRANCE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 77 01 (Fax) 
&lt;br&gt;&lt;br&gt;The information contained in this communication has been classified as: 
&lt;br&gt;&lt;br&gt;[x] General Business Information 
&lt;br&gt;[ ] Motorola Internal Use Only 
&lt;br&gt;[ ] Motorola Confidential Proprietary
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13901402&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/rcond%2C-condest%2C-and-a-block-1-norm-estimator-tp13886035p13901402.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13900905</id>
	<title>Re: rcond, condest, and a block 1-norm estimator</title>
	<published>2007-11-21T19:18:11Z</published>
	<updated>2007-11-21T19:18:11Z</updated>
	<author>
		<name>Jason Riedy-2</name>
	</author>
	<content type="html">And David Bateman writes:
&lt;br&gt;&amp;gt; I believe the rcond function should take rcond from the LAPACK
&lt;br&gt;&amp;gt; factorization, at least I believe is what matlab does. [...]
&lt;br&gt;&lt;br&gt;For various reasons, I'm not referring to MATLAB(tm) itself or
&lt;br&gt;any docs other than what is on-line and trivially findable. &amp;nbsp;I
&lt;br&gt;have no idea if MATLAB's rcond applies to sparse matrices. &amp;nbsp;I
&lt;br&gt;know LAPACK's does not.
&lt;br&gt;&lt;br&gt;That said, I have been losing the argument to use the block
&lt;br&gt;estimator in LAPACK... &amp;nbsp;We may weaken the routine slightly
&lt;br&gt;instead. &amp;nbsp;For &amp;quot;small&amp;quot; problems, computing RCOND is very, very
&lt;br&gt;expensive right now. &amp;nbsp;The current norm estimator uses a very safe
&lt;br&gt;but very slow triangular solve. &amp;nbsp;We likely will replace that with
&lt;br&gt;the fast solve, followed by a check for overflow and re-running
&lt;br&gt;with the slow solve if necessary. &amp;nbsp;That will catch and re-scale
&lt;br&gt;overflows, but it won't catch possibly avoidable underflows
&lt;br&gt;during estimation.
&lt;br&gt;&lt;br&gt;So it's up to y'all what rcond() should be. &amp;nbsp;The routine I
&lt;br&gt;included computes the inverse of the 1-norm condition number of A
&lt;br&gt;(iirc), and LAPACK's RCOND returned by xyySVX is the inverse of
&lt;br&gt;the inf-norm condition number of the matrix that actually is
&lt;br&gt;factored. &amp;nbsp;That matrix may have been equilibrated, so determining
&lt;br&gt;how LAPACK's RCOND relates to your original matrix requires
&lt;br&gt;examining a bunch of parameters MATLAB's rcond() doesn't return.
&lt;br&gt;Without experimenting, I can't tell what MATLAB's rcond() really
&lt;br&gt;does.
&lt;br&gt;&lt;br&gt;The only use for LAPACK's RCOND directly is to see if the
&lt;br&gt;factorization algorithm came close to solving with a nearly a
&lt;br&gt;singular matrix when forming a Schur complement. &amp;nbsp;It tells you
&lt;br&gt;very little about the actual problem you are trying to solve or
&lt;br&gt;even about any errors when using the factorization; RCOND may be
&lt;br&gt;measured with an entirely different norm (scaled by
&lt;br&gt;equilibration) than your problem.
&lt;br&gt;&lt;br&gt;And if you pick up our extra-precise refinement drivers (once we
&lt;br&gt;actually ship the damned things, see LAWN 165), you will have
&lt;br&gt;more and more relevant condition numbers from which to chose.
&lt;br&gt;&lt;br&gt;&amp;gt; Matlab calls the normest1 function, that is basically your
&lt;br&gt;&amp;gt; block_onenorm_est, and then multiples the estimated inverse
&lt;br&gt;&amp;gt; norm by norm(A,1) to get the condition number estimate.
&lt;br&gt;&lt;br&gt;&amp;gt;From MathWorks' pages, it seems normest has a very different
&lt;br&gt;interface. &amp;nbsp;Hence the cumbersome block_onenorm_est name.
&lt;br&gt;&lt;br&gt;But your description is not the RCOND returned from LAPACK's
&lt;br&gt;linear system drivers. &amp;nbsp;;)
&lt;br&gt;&lt;br&gt;&amp;gt; condest is one of the annoying missing sparse functions in
&lt;br&gt;&amp;gt; Octave...
&lt;br&gt;&lt;br&gt;Amen. &amp;nbsp;Limits Octave's applicability for many colleagues.
&lt;br&gt;&lt;br&gt;&amp;gt; I'd hesitate to include it though with the rcond function with
&lt;br&gt;&amp;gt; its current name...
&lt;br&gt;&lt;br&gt;I have little ego about these things. &amp;nbsp;Use, change, and rename as
&lt;br&gt;you see fit. &amp;nbsp;Just thought I should send along my good-enough
&lt;br&gt;versions as a starting point.
&lt;br&gt;&lt;br&gt;I'm not in a position to get into the copyright assignment
&lt;br&gt;argument here right now, so feel free to make sufficient,
&lt;br&gt;copyrightable changes that are assigned and licensed
&lt;br&gt;appropriately. &amp;nbsp;;) These are just the routines I'm using right
&lt;br&gt;now.
&lt;br&gt;&lt;br&gt;Jason
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13900905&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/rcond%2C-condest%2C-and-a-block-1-norm-estimator-tp13886035p13900905.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13900712</id>
	<title>Re: rcond, condest, and a block 1-norm estimator</title>
	<published>2007-11-21T16:39:51Z</published>
	<updated>2007-11-21T16:39:51Z</updated>
	<author>
		<name>dbateman3</name>
	</author>
	<content type="html">I believe the rcond function should take rcond from the LAPACK
&lt;br&gt;factorization, at least I believe is what matlab does. Matlab calls the
&lt;br&gt;normest1 function, that is basically your block_onenorm_est, and then
&lt;br&gt;multiples the estimated inverse norm by norm(A,1) to get the condition
&lt;br&gt;number estimate.
&lt;br&gt;&lt;br&gt;condest is one of the annoying missing sparse functions in Octave and I
&lt;br&gt;appreciate that your code treats sparse matrices as a special case. I'd
&lt;br&gt;hesitate to include it though with the rcond function with its current
&lt;br&gt;name...
&lt;br&gt;&lt;br&gt;D.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Jason Riedy wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Appended are the rcond(), condest(), and block_onenorm_est()
&lt;br&gt;&amp;gt; routines I've been using. I don't think they exactly match the
&lt;br&gt;&amp;gt; MATLAB(tm) routines, but I also don't care. ;) The files also
&lt;br&gt;&amp;gt; are living at
&lt;br&gt;&amp;gt; &amp;nbsp; &lt;a href=&quot;http://www.cs.berkeley.edu/~ejr/dev/linalg/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.berkeley.edu/~ejr/dev/linalg/&lt;/a&gt;&lt;br&gt;&amp;gt; for now.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; They have been moderately beaten around, but there still may be
&lt;br&gt;&amp;gt; bugs lurking. I'm not 100% sure I'm handling complex matrices
&lt;br&gt;&amp;gt; correctly, but I also haven't run into any noticable problems.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Improvements and bug fixes gleefully accepted.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Jason
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Copyright (C) 2007, Regents of the University of California
&lt;br&gt;&amp;gt; ## -*- mode: octave; -*-
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## This program is free software distributed under the &amp;quot;modified&amp;quot; or
&lt;br&gt;&amp;gt; ## 3-clause BSD license appended to this file.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; function [est, v, w] = rcond (varargin)
&lt;br&gt;&amp;gt; &amp;nbsp; ## -*- texinfo -*-
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefn {Function File} {[@var{est}, @var{v}] = } rcond (@var{A}, @var{t} = min (size (A, 1), 5)) 
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } rcond (@var{A}, @var{SOLVE}, @var{SOVLE_T}, @var{t} = min (n, 5))
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } rcond (@var{APPLY}, @var{APPLY_T}, @var{SOLVE}, @var{SOVLE_T}, @var{n}, @var{t} = min (n, 5))
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## Estimate the inverse of the 1-norm condition number of a matrix
&lt;br&gt;&amp;gt; &amp;nbsp; ## matrix @var{A} using @var{t} test vectors pusing the randomized
&lt;br&gt;&amp;gt; &amp;nbsp; ## 1-norm estimator in block_onenorm_est. &amp;nbsp;If the matrix is not
&lt;br&gt;&amp;gt; &amp;nbsp; ## explicit, e.g. when estimating the condition number of @var{A}
&lt;br&gt;&amp;gt; &amp;nbsp; ## given an LU factorization, rcond uses the following functions:
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @table @var
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item APPLY
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item APPLY_T
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A'*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item SOLVE
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item SOLVE_T
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A' \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @end table
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## The implicit version requires an explicit dimension @var{n}.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{rcond} uses a randomized algorithm to approximate
&lt;br&gt;&amp;gt; &amp;nbsp; ## the 1-norms.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{rcond} returns the inverse of the 1-norm condition estimate
&lt;br&gt;&amp;gt; &amp;nbsp; ## @var{est} and a vector @var{v} satisfying @code{norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## (@var{A}*@var{v}, 1) == norm (@var{A}, 1) * norm (@var{v}, 1) *
&lt;br&gt;&amp;gt; &amp;nbsp; ## @var{est}}. When @var{est} is large, @var{v} is an approximate null
&lt;br&gt;&amp;gt; &amp;nbsp; ## vector.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## References: 
&lt;br&gt;&amp;gt; &amp;nbsp; ## @itemize
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;gt; &amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## Pseudospectra.&amp;quot; SIMAX vol 21, no 4, pp 1185-1201.
&lt;br&gt;&amp;gt; &amp;nbsp; ## &lt;a href=&quot;http://dx.doi.org/10.1137/S0895479899356080&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1137/S0895479899356080&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;gt; &amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## Pseudospectra.&amp;quot; &lt;a href=&quot;http://citeseer.ist.psu.edu/223007.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://citeseer.ist.psu.edu/223007.html&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; ## @end itemize
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @seealso{block_onenorm_est, condest, norm, cond}
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @end deftypefn
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; ## Author: Jason Riedy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13900712&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ejr@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; ## Keywords: linear-algebra norm estimation
&lt;br&gt;&amp;gt; &amp;nbsp; ## Version: 0.2
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!demo
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 100;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = randn (N) + eye (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;rcond (A)
&lt;br&gt;&amp;gt; %! &amp;nbsp;[L,U,P] = lu (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;rcond (A, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)))
&lt;br&gt;&amp;gt; %! &amp;nbsp;rcond (@(x) A*x, @(x) A'*x, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)), N)
&lt;br&gt;&amp;gt; %! &amp;nbsp;1 / (norm (inv (A), 1) * norm (A, 1))
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; if size (varargin, 2) &amp;lt; 1 || size (varargin, 2) &amp;gt; 5,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; usage(&amp;quot;rcond: Incorrect arguments.&amp;quot;);
&lt;br&gt;&amp;gt; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; DEFAULT_T = 5;
&lt;br&gt;&amp;gt; &amp;nbsp; ITMAX = 10;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; if ismatrix (varargin{1}),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; n = size (varargin{1}, 1);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if n != size (varargin{1}, 2),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; usage(&amp;quot;Matrix must be square.&amp;quot;);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; A = varargin{1};
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;gt; 1,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; if isscalar (varargin{2}),
&lt;br&gt;&amp;gt; 	t = varargin{2};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;gt; 	if size (varargin, 2) &amp;lt; 3,
&lt;br&gt;&amp;gt; 	 &amp;nbsp;usage(&amp;quot;Must supply both SOLVE and SOLVE_T.&amp;quot;);
&lt;br&gt;&amp;gt; 	else
&lt;br&gt;&amp;gt; 	 &amp;nbsp;SOLVE = varargin{2};
&lt;br&gt;&amp;gt; 	 &amp;nbsp;SOLVE_T = varargin{3};
&lt;br&gt;&amp;gt; 	 &amp;nbsp;if size (varargin, 2) &amp;gt; 3,
&lt;br&gt;&amp;gt; 	 &amp;nbsp; &amp;nbsp;t = varargin{4};
&lt;br&gt;&amp;gt; 	 &amp;nbsp;endif
&lt;br&gt;&amp;gt; 	endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; else
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;lt; 5,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; usage(&amp;quot;Implicit form of rcond requires at least 5 arguments.&amp;quot;);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; APPLY = varargin{1};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; APPLY_T = varargin{2};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; SOLVE = varargin{3};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; SOLVE_T = varargin{4};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; n = varargin{5};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if !isscalar (n),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; usage(&amp;quot;Dimension argument of implicit form must be scalar.&amp;quot;);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;gt; 5,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{6};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; if !exist (&amp;quot;t&amp;quot;, &amp;quot;var&amp;quot;),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; t = min (n, DEFAULT_T);
&lt;br&gt;&amp;gt; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; if !exist (&amp;quot;SOLVE&amp;quot;, &amp;quot;var&amp;quot;),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if issparse (A),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; colord = colamd(A);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pc = speye(n);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pc(:,colord) = Pc;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; [L,U,P] = lu(A(:,Pc));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE = @(x) Pc' * (U\ (L\ (P*x)));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE_T = @(x) P'*(L'\ (U'\ (Pc*x)));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; [L,U,P] = lu(A);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE = @(x) U\ (L\ (P*x));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE_T = @(x) P' * (L'\ (U'\x));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; if exist (&amp;quot;A&amp;quot;, &amp;quot;var&amp;quot;),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Anorm = norm(A, 1);
&lt;br&gt;&amp;gt; &amp;nbsp; else
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Anorm = block_onenorm_est(APPLY, APPLY_T, n, t);
&lt;br&gt;&amp;gt; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; [Ainv_norm, v, w] = block_onenorm_est(SOLVE, SOLVE_T, n, t);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; est = 1/Anorm;
&lt;br&gt;&amp;gt; &amp;nbsp; est /= Ainv_norm;
&lt;br&gt;&amp;gt; &amp;nbsp; v = w / norm (w, 1);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; endfunction
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Yes, these test bounds are really loose. &amp;nbsp;There's
&lt;br&gt;&amp;gt; ## enough randomization to trigger odd cases with hilb().
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 6;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = hilb (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;cA = 1 / rcond (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;cA_test = norm (inv (A), 1) * norm (A, 1);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (cA, cA_test, 2**-12);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 6;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = hilb (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;SOLVE = @(x) A\x; SOLVE_T = @(x) A'\x;
&lt;br&gt;&amp;gt; %! &amp;nbsp;cA = 1 / rcond (A, SOLVE, SOLVE_T);
&lt;br&gt;&amp;gt; %! &amp;nbsp;cA_test = norm (inv (A), 1) * norm (A, 1);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (cA, cA_test, 2**-12);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 6;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = hilb (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;APPLY = @(x) A*x; APPLY_T = @(x) A'*x;
&lt;br&gt;&amp;gt; %! &amp;nbsp;SOLVE = @(x) A\x; SOLVE_T = @(x) A'\x;
&lt;br&gt;&amp;gt; %! &amp;nbsp;cA = 1 / rcond (APPLY, APPLY_T, SOLVE, SOLVE_T, N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;cA_test = norm (inv (A), 1) * norm (A, 1);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (cA, cA_test, 2**-6);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 12;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = hilb (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[rcondA, v] = rcond (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;x = A*v;
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm(x, inf), 0, eps);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Copyright (c) 2007, Regents of the University of California
&lt;br&gt;&amp;gt; ## All rights reserved.
&lt;br&gt;&amp;gt; ## Redistribution and use in source and binary forms, with or without
&lt;br&gt;&amp;gt; ## modification, are permitted provided that the following conditions are met:
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Redistributions of source code must retain the above copyright
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer.
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Redistributions in binary form must reproduce the above copyright
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer in the
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; documentation and/or other materials provided with the distribution.
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Neither the name of the University of California, Berkeley nor the
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; names of its contributors may be used to endorse or promote products
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; derived from this software without specific prior written permission.
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
&lt;br&gt;&amp;gt; ## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
&lt;br&gt;&amp;gt; ## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
&lt;br&gt;&amp;gt; ## DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
&lt;br&gt;&amp;gt; ## DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
&lt;br&gt;&amp;gt; ## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
&lt;br&gt;&amp;gt; ## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
&lt;br&gt;&amp;gt; ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
&lt;br&gt;&amp;gt; ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
&lt;br&gt;&amp;gt; ## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Copyright (C) 2007, Regents of the University of California
&lt;br&gt;&amp;gt; ## -*- mode: octave; -*-
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## This program is free software distributed under the &amp;quot;modified&amp;quot; or
&lt;br&gt;&amp;gt; ## 3-clause BSD license appended to this file.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; function [est, v, w, iter] = block_onenorm_est (varargin)
&lt;br&gt;&amp;gt; &amp;nbsp; ## -*- texinfo -*-
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefn {Function File} {[@var{est}, @var{v}, @var{w}, @var{iter}] = } block_onenorm_est (@var{A}, @var{t} = min (size (A, 1), 5)) 
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}, @var{w}, @var{iter}] = } block_onenorm_est (@var{APPLY}, @var{APPLY_T}, @var{n}, @var{t} = min (n, 5))
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## Apply Higham and Tisseur's randomized block 1-norm estimator to
&lt;br&gt;&amp;gt; &amp;nbsp; ## matrix @var{A} using @var{t} test vectors. &amp;nbsp;If the matrix is not
&lt;br&gt;&amp;gt; &amp;nbsp; ## explicit, e.g. when estimating the norm of @code{inv(@var{A})} given an
&lt;br&gt;&amp;gt; &amp;nbsp; ## LU factorization, block_onenorm_est applies @var{A} and its conjugate
&lt;br&gt;&amp;gt; &amp;nbsp; ## transpose through a pair of functions @var{APPLY} and @var{APPLY_T},
&lt;br&gt;&amp;gt; &amp;nbsp; ## respectively, to a dense matrix of size @var{n} by @var{t}. The
&lt;br&gt;&amp;gt; &amp;nbsp; ## implicit version requires an explicit dimension @var{n}.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## Returns the norm estimate @var{est}, two vectors @var{v} and
&lt;br&gt;&amp;gt; &amp;nbsp; ## @var{w} related by norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{(@var{w}, 1) = @var{est} * norm (@var{v}, 1)},
&lt;br&gt;&amp;gt; &amp;nbsp; ## and the number of iterations @var{iter}. &amp;nbsp;The number of
&lt;br&gt;&amp;gt; &amp;nbsp; ## iterations is limited to 10 and is at least 2.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## References: 
&lt;br&gt;&amp;gt; &amp;nbsp; ## @itemize
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;gt; &amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## Pseudospectra.&amp;quot; SIMAX vol 21, no 4, pp 1185-1201.
&lt;br&gt;&amp;gt; &amp;nbsp; ## &lt;a href=&quot;http://dx.doi.org/10.1137/S0895479899356080&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1137/S0895479899356080&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;gt; &amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## Pseudospectra.&amp;quot; &lt;a href=&quot;http://citeseer.ist.psu.edu/223007.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://citeseer.ist.psu.edu/223007.html&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; ## @end itemize
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @seealso{condest, norm, cond}
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @end deftypefn
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; ## Author: Jason Riedy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13900712&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ejr@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; ## Keywords: linear-algebra norm estimation
&lt;br&gt;&amp;gt; &amp;nbsp; ## Version: 0.2
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!demo
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 100;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = randn(N) + eye(N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[L,U,P] = lu(A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;nm1inv = block_onenorm_est(@(x) U\(L\(P*x)), @(x) P'*(L'\(U'\x)), \
&lt;br&gt;&amp;gt; %! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N, 30)
&lt;br&gt;&amp;gt; %! &amp;nbsp;norm(inv(A), 1)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; if size (varargin, 2) &amp;lt; 1 || size (varargin, 2) &amp;gt; 4,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; print_usage();
&lt;br&gt;&amp;gt; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; DEFAULT_T = 5;
&lt;br&gt;&amp;gt; &amp;nbsp; ITMAX = 10;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; if ismatrix (varargin{1}),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; n = size (varargin{1}, 1);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if n != size (varargin{1}, 2),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; error(&amp;quot;Matrix must be square.&amp;quot;);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; APPLY = @(x) varargin{1} * x;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; APPLY_T = @(x) varargin{1}' * x;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if size (varargin) &amp;gt; 1,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{2};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = min (n, DEFAULT_T);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; else
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;lt; 3,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; print_usage();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; n = varargin{3};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; APPLY = varargin{1};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; APPLY_T = varargin{2};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if size (varargin) &amp;gt; 3,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{4};
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = DEFAULT_T;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; ## Initial test vectors X.
&lt;br&gt;&amp;gt; &amp;nbsp; X = rand (n, t);
&lt;br&gt;&amp;gt; &amp;nbsp; X = X ./ (ones (n,1) * sum (abs (X), 1));
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; been_there = zeros (n, 1); # Track if a vertex has been visited.
&lt;br&gt;&amp;gt; &amp;nbsp; est_old = 0; # To check if the estimate has increased.
&lt;br&gt;&amp;gt; &amp;nbsp; S = zeros (n, t); # Normalized vector of signs. &amp;nbsp;The normalization is 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; for iter=1:ITMAX+1,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Y = feval (APPLY, X);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## Find the initial estimate as the largest A*x.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; [est, ind_best] = max (sum (abs (Y), 1));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if (est &amp;gt; est_old || iter == 2),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; w = Y(:,ind_best);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if (iter &amp;gt;= 2 &amp;&amp; est &amp;lt; est_old),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## No improvement, so stop.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; est = est_old;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; est_old = est;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; S_old = S;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if (iter &amp;gt; ITMAX),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## Gone too far. &amp;nbsp;Stop.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; S = sign (Y);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## Test if any of S are approximately parallel to previous S
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## vectors or current S vectors. &amp;nbsp;If everything is parallel,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## stop. Otherwise, replace any parallel vectors with
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## rand{-1,+1}.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; partest = any (abs (S_old' * S - n) &amp;lt; 4*eps*n);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if all (partest),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## All the current vectors are parallel to old vectors.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## We've hit a cycle, so stop.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if any (partest),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## Some vectors are parallel to old ones and are cycling,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## but not all of them. &amp;nbsp;Replace the parallel vectors with
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## rand{-1,+1}.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; numpar = sum (partest);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; replacements = 2*(rand (n,numpar) &amp;lt; 0.5) - 1;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; S(:,partest) = replacements;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## Now test for parallel vectors within S.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; partest = any ( (S' * S - eye (t)) == n );
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if any (partest),
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; numpar = sum (partest);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; replacements = 2*(rand (n,numpar) &amp;lt; 0.5) - 1;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; S(:,partest) = replacements;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Z = feval (APPLY_T, S);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## Now find the largest non-previously-visted index per
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## vector.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; h = max (abs (Z),2);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; [mh, mhi] = max (h);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if iter &amp;gt;= 2 &amp;&amp; mhi == ind_best,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## Hit a cycle, stop.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; [h, ind] = sort (h, 'descend');
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; if t &amp;gt; 1,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; firstind = ind(1:t);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; if all (been_there(firstind)),
&lt;br&gt;&amp;gt; 	## Visited all these before, so stop.
&lt;br&gt;&amp;gt; 	break;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; ind=ind(!been_there(ind));
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; if length (ind) &amp;lt; t,
&lt;br&gt;&amp;gt; 	## There aren't enough new vectors, so we're practically
&lt;br&gt;&amp;gt; 	## in a cycle. Stop.
&lt;br&gt;&amp;gt; 	break;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ## Visit the new indices.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; X = zeros (n, t);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; for zz = 1:t,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; X(ind(zz),zz) = 1;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; endfor
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; been_there(ind(1:t)) = 1;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; endfor
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; ## The estimate est and vector w are set in the loop above. The
&lt;br&gt;&amp;gt; &amp;nbsp; ## vector v selects the ind_best column of A.
&lt;br&gt;&amp;gt; &amp;nbsp; v = zeros (n, 1);
&lt;br&gt;&amp;gt; &amp;nbsp; v(ind_best) = 1;
&lt;br&gt;&amp;gt; endfunction
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 10;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = ones (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (A', 6);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nm1, N, -2*eps);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nminf, N, -2*eps);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 10;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = ones (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (@(x) A*x, @(x) A'*x, N, 3);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (@(x) A'*x, @(x) A*x, N, 3);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nm1, N, -2*eps);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nminf, N, -2*eps);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 5;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = hilb (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (A', 6);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nm1, norm (A, 1), -2*eps);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nminf, norm (A, inf), -2*eps);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Only likely to be within a factor of 10.
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 100;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = rand (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (A', 6);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nm1, norm (A, 1), -.1);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (nminf, norm (A, inf), -.1);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Copyright (c) 2007, Regents of the University of California
&lt;br&gt;&amp;gt; ## All rights reserved.
&lt;br&gt;&amp;gt; ## Redistribution and use in source and binary forms, with or without
&lt;br&gt;&amp;gt; ## modification, are permitted provided that the following conditions are met:
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Redistributions of source code must retain the above copyright
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer.
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Redistributions in binary form must reproduce the above copyright
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer in the
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; documentation and/or other materials provided with the distribution.
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Neither the name of the University of California, Berkeley nor the
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; names of its contributors may be used to endorse or promote products
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; derived from this software without specific prior written permission.
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
&lt;br&gt;&amp;gt; ## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
&lt;br&gt;&amp;gt; ## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
&lt;br&gt;&amp;gt; ## DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
&lt;br&gt;&amp;gt; ## DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
&lt;br&gt;&amp;gt; ## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
&lt;br&gt;&amp;gt; ## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
&lt;br&gt;&amp;gt; ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
&lt;br&gt;&amp;gt; ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
&lt;br&gt;&amp;gt; ## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Copyright (C) 2007, Regents of the University of California
&lt;br&gt;&amp;gt; ## -*- mode: octave; -*-
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## This program is free software distributed under the &amp;quot;modified&amp;quot; or
&lt;br&gt;&amp;gt; ## 3-clause BSD license appended to this file.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; function [est, v] = condest (varargin)
&lt;br&gt;&amp;gt; &amp;nbsp; ## -*- texinfo -*-
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefn {Function File} {[@var{est}, @var{v}] = } condest (@var{A}, @var{t} = min (size (A, 1), 5)) 
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } condest (@var{A}, @var{SOLVE}, @var{SOVLE_T}, @var{t} = min (n, 5))
&lt;br&gt;&amp;gt; &amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } condest (@var{APPLY}, @var{APPLY_T}, @var{SOLVE}, @var{SOVLE_T}, @var{n}, @var{t} = min (n, 5))
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## Estimate the 1-norm condition number of a matrix matrix @var{A}
&lt;br&gt;&amp;gt; &amp;nbsp; ## using @var{t} test vectors pusing the randomized 1-norm estimator in
&lt;br&gt;&amp;gt; &amp;nbsp; ## block_onenorm_est. &amp;nbsp;If the matrix is not explicit, e.g. when
&lt;br&gt;&amp;gt; &amp;nbsp; ## estimating the condition number of @var{A} given an LU
&lt;br&gt;&amp;gt; &amp;nbsp; ## factorization, condest uses the following functions:
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @table @var
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item APPLY
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item APPLY_T
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A'*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item SOLVE
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item SOLVE_T
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{A' \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;gt; &amp;nbsp; ## @end table
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## The implicit version requires an explicit dimension @var{n}.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{condest} uses a randomized algorithm to approximate
&lt;br&gt;&amp;gt; &amp;nbsp; ## the 1-norms.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @code{condest} returns the 1-norm condition estimate @var{est} and
&lt;br&gt;&amp;gt; &amp;nbsp; ## a vector @var{v} satisfying @code{norm (@var{A}*@var{v}, 1) == norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## (@var{A}, 1) * norm (@var{v}, 1) / @var{est}}. When @var{est} is
&lt;br&gt;&amp;gt; &amp;nbsp; ## large, @var{v} is an approximate null vector.
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## References: 
&lt;br&gt;&amp;gt; &amp;nbsp; ## @itemize
&lt;br&gt;&amp;gt; &amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;gt; &amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## Pseudospectra.&amp;quot; SIMAX vol 21, no 4, pp 1185-1201.
&lt;br&gt;&amp;gt; &amp;nbsp; ## &lt;a href=&quot;http://dx.doi.org/10.1137/S0895479899356080&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1137/S0895479899356080&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;gt; &amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;gt; &amp;nbsp; ## Pseudospectra.&amp;quot; &lt;a href=&quot;http://citeseer.ist.psu.edu/223007.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://citeseer.ist.psu.edu/223007.html&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp; ## @end itemize
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @seealso{rcond, block_onenorm_est, norm, cond}
&lt;br&gt;&amp;gt; &amp;nbsp; ##
&lt;br&gt;&amp;gt; &amp;nbsp; ## @end deftypefn
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; ## Author: Jason Riedy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13900712&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ejr@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; ## Keywords: linear-algebra norm estimation
&lt;br&gt;&amp;gt; &amp;nbsp; ## Version: 0.2
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!demo
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 100;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = randn (N) + eye (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;condest (A)
&lt;br&gt;&amp;gt; %! &amp;nbsp;[L,U,P] = lu (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;condest (A, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)))
&lt;br&gt;&amp;gt; %! &amp;nbsp;condest (@(x) A*x, @(x) A'*x, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)), N)
&lt;br&gt;&amp;gt; %! &amp;nbsp;norm (inv (A), 1) * norm (A, 1)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; [est, v] = rcond(varargin{:});
&lt;br&gt;&amp;gt; &amp;nbsp; est = 1/est;
&lt;br&gt;&amp;gt; endfunction
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## These tests are the same as in rcond().
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; %!test
&lt;br&gt;&amp;gt; %! &amp;nbsp;N = 6;
&lt;br&gt;&amp;gt; %! &amp;nbsp;A = hilb (N);
&lt;br&gt;&amp;gt; %! &amp;nbsp;cA = condest (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;rcA = 1 / rcond (A);
&lt;br&gt;&amp;gt; %! &amp;nbsp;assert (cA, rcA, 2**-12);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ## Copyright (c) 2007, Regents of the University of California
&lt;br&gt;&amp;gt; ## All rights reserved.
&lt;br&gt;&amp;gt; ## Redistribution and use in source and binary forms, with or without
&lt;br&gt;&amp;gt; ## modification, are permitted provided that the following conditions are met:
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Redistributions of source code must retain the above copyright
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer.
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Redistributions in binary form must reproduce the above copyright
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer in the
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; documentation and/or other materials provided with the distribution.
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; * Neither the name of the University of California, Berkeley nor the
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; names of its contributors may be used to endorse or promote products
&lt;br&gt;&amp;gt; ## &amp;nbsp; &amp;nbsp; &amp;nbsp; derived from this software without specific prior written permission.
&lt;br&gt;&amp;gt; ##
&lt;br&gt;&amp;gt; ## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
&lt;br&gt;&amp;gt; ## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
&lt;br&gt;&amp;gt; ## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
&lt;br&gt;&amp;gt; ## DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
&lt;br&gt;&amp;gt; ## DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
&lt;br&gt;&amp;gt; ## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
&lt;br&gt;&amp;gt; ## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
&lt;br&gt;&amp;gt; ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
&lt;br&gt;&amp;gt; ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
&lt;br&gt;&amp;gt; ## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ------------------------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Octave-sources mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13900712&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13900712&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/rcond%2C-condest%2C-and-a-block-1-norm-estimator-tp13886035p13900712.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13886035</id>
	<title>rcond, condest, and a block 1-norm estimator</title>
	<published>2007-11-19T17:56:25Z</published>
	<updated>2007-11-19T17:56:25Z</updated>
	<author>
		<name>Jason Riedy-2</name>
	</author>
	<content type="html">Appended are the rcond(), condest(), and block_onenorm_est()
&lt;br&gt;routines I've been using. I don't think they exactly match the
&lt;br&gt;MATLAB(tm) routines, but I also don't care. ;) The files also
&lt;br&gt;are living at
&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://www.cs.berkeley.edu/~ejr/dev/linalg/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.berkeley.edu/~ejr/dev/linalg/&lt;/a&gt;&lt;br&gt;for now.
&lt;br&gt;&lt;br&gt;They have been moderately beaten around, but there still may be
&lt;br&gt;bugs lurking. I'm not 100% sure I'm handling complex matrices
&lt;br&gt;correctly, but I also haven't run into any noticable problems.
&lt;br&gt;&lt;br&gt;Improvements and bug fixes gleefully accepted.
&lt;br&gt;&lt;br&gt;Jason
&lt;br&gt;&lt;br&gt;&lt;br /&gt;## Copyright (C) 2007, Regents of the University of California
&lt;br&gt;## -*- mode: octave; -*-
&lt;br&gt;##
&lt;br&gt;## This program is free software distributed under the &amp;quot;modified&amp;quot; or
&lt;br&gt;## 3-clause BSD license appended to this file.
&lt;br&gt;&lt;br&gt;function [est, v, w] = rcond (varargin)
&lt;br&gt;&amp;nbsp; ## -*- texinfo -*-
&lt;br&gt;&amp;nbsp; ## @deftypefn {Function File} {[@var{est}, @var{v}] = } rcond (@var{A}, @var{t} = min (size (A, 1), 5)) 
&lt;br&gt;&amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } rcond (@var{A}, @var{SOLVE}, @var{SOVLE_T}, @var{t} = min (n, 5))
&lt;br&gt;&amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } rcond (@var{APPLY}, @var{APPLY_T}, @var{SOLVE}, @var{SOVLE_T}, @var{n}, @var{t} = min (n, 5))
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## Estimate the inverse of the 1-norm condition number of a matrix
&lt;br&gt;&amp;nbsp; ## matrix @var{A} using @var{t} test vectors pusing the randomized
&lt;br&gt;&amp;nbsp; ## 1-norm estimator in block_onenorm_est. &amp;nbsp;If the matrix is not
&lt;br&gt;&amp;nbsp; ## explicit, e.g. when estimating the condition number of @var{A}
&lt;br&gt;&amp;nbsp; ## given an LU factorization, rcond uses the following functions:
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @table @var
&lt;br&gt;&amp;nbsp; ## @item APPLY
&lt;br&gt;&amp;nbsp; ## @code{A*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @item APPLY_T
&lt;br&gt;&amp;nbsp; ## @code{A'*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @item SOLVE
&lt;br&gt;&amp;nbsp; ## @code{A \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @item SOLVE_T
&lt;br&gt;&amp;nbsp; ## @code{A' \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @end table
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## The implicit version requires an explicit dimension @var{n}.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @code{rcond} uses a randomized algorithm to approximate
&lt;br&gt;&amp;nbsp; ## the 1-norms.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @code{rcond} returns the inverse of the 1-norm condition estimate
&lt;br&gt;&amp;nbsp; ## @var{est} and a vector @var{v} satisfying @code{norm
&lt;br&gt;&amp;nbsp; ## (@var{A}*@var{v}, 1) == norm (@var{A}, 1) * norm (@var{v}, 1) *
&lt;br&gt;&amp;nbsp; ## @var{est}}. When @var{est} is large, @var{v} is an approximate null
&lt;br&gt;&amp;nbsp; ## vector.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## References: 
&lt;br&gt;&amp;nbsp; ## @itemize
&lt;br&gt;&amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;nbsp; ## Pseudospectra.&amp;quot; SIMAX vol 21, no 4, pp 1185-1201.
&lt;br&gt;&amp;nbsp; ## &lt;a href=&quot;http://dx.doi.org/10.1137/S0895479899356080&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1137/S0895479899356080&lt;/a&gt;&lt;br&gt;&amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;nbsp; ## Pseudospectra.&amp;quot; &lt;a href=&quot;http://citeseer.ist.psu.edu/223007.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://citeseer.ist.psu.edu/223007.html&lt;/a&gt;&lt;br&gt;&amp;nbsp; ## @end itemize
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @seealso{block_onenorm_est, condest, norm, cond}
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @end deftypefn
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## Author: Jason Riedy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13886035&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ejr@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;nbsp; ## Keywords: linear-algebra norm estimation
&lt;br&gt;&amp;nbsp; ## Version: 0.2
&lt;br&gt;&lt;br&gt;%!demo
&lt;br&gt;%! &amp;nbsp;N = 100;
&lt;br&gt;%! &amp;nbsp;A = randn (N) + eye (N);
&lt;br&gt;%! &amp;nbsp;rcond (A)
&lt;br&gt;%! &amp;nbsp;[L,U,P] = lu (A);
&lt;br&gt;%! &amp;nbsp;rcond (A, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)))
&lt;br&gt;%! &amp;nbsp;rcond (@(x) A*x, @(x) A'*x, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)), N)
&lt;br&gt;%! &amp;nbsp;1 / (norm (inv (A), 1) * norm (A, 1))
&lt;br&gt;&lt;br&gt;&amp;nbsp; if size (varargin, 2) &amp;lt; 1 || size (varargin, 2) &amp;gt; 5,
&lt;br&gt;&amp;nbsp; &amp;nbsp; usage(&amp;quot;rcond: Incorrect arguments.&amp;quot;);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; DEFAULT_T = 5;
&lt;br&gt;&amp;nbsp; ITMAX = 10;
&lt;br&gt;&lt;br&gt;&amp;nbsp; if ismatrix (varargin{1}),
&lt;br&gt;&amp;nbsp; &amp;nbsp; n = size (varargin{1}, 1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; if n != size (varargin{1}, 2),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; usage(&amp;quot;Matrix must be square.&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; A = varargin{1};
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;gt; 1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if isscalar (varargin{2}),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{2};
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;lt; 3,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; usage(&amp;quot;Must supply both SOLVE and SOLVE_T.&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE = varargin{2};
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE_T = varargin{3};
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;gt; 3,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{4};
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;lt; 5,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; usage(&amp;quot;Implicit form of rcond requires at least 5 arguments.&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; APPLY = varargin{1};
&lt;br&gt;&amp;nbsp; &amp;nbsp; APPLY_T = varargin{2};
&lt;br&gt;&amp;nbsp; &amp;nbsp; SOLVE = varargin{3};
&lt;br&gt;&amp;nbsp; &amp;nbsp; SOLVE_T = varargin{4};
&lt;br&gt;&amp;nbsp; &amp;nbsp; n = varargin{5};
&lt;br&gt;&amp;nbsp; &amp;nbsp; if !isscalar (n),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; usage(&amp;quot;Dimension argument of implicit form must be scalar.&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;gt; 5,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{6};
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; if !exist (&amp;quot;t&amp;quot;, &amp;quot;var&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; t = min (n, DEFAULT_T);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; if !exist (&amp;quot;SOLVE&amp;quot;, &amp;quot;var&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; if issparse (A),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; colord = colamd(A);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Pc = speye(n);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Pc(:,colord) = Pc;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [L,U,P] = lu(A(:,Pc));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE = @(x) Pc' * (U\ (L\ (P*x)));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE_T = @(x) P'*(L'\ (U'\ (Pc*x)));
&lt;br&gt;&amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; [L,U,P] = lu(A);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE = @(x) U\ (L\ (P*x));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SOLVE_T = @(x) P' * (L'\ (U'\x));
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; if exist (&amp;quot;A&amp;quot;, &amp;quot;var&amp;quot;),
&lt;br&gt;&amp;nbsp; &amp;nbsp; Anorm = norm(A, 1);
&lt;br&gt;&amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; Anorm = block_onenorm_est(APPLY, APPLY_T, n, t);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; [Ainv_norm, v, w] = block_onenorm_est(SOLVE, SOLVE_T, n, t);
&lt;br&gt;&lt;br&gt;&amp;nbsp; est = 1/Anorm;
&lt;br&gt;&amp;nbsp; est /= Ainv_norm;
&lt;br&gt;&amp;nbsp; v = w / norm (w, 1);
&lt;br&gt;&lt;br&gt;endfunction
&lt;br&gt;&lt;br&gt;## Yes, these test bounds are really loose. &amp;nbsp;There's
&lt;br&gt;## enough randomization to trigger odd cases with hilb().
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 6;
&lt;br&gt;%! &amp;nbsp;A = hilb (N);
&lt;br&gt;%! &amp;nbsp;cA = 1 / rcond (A);
&lt;br&gt;%! &amp;nbsp;cA_test = norm (inv (A), 1) * norm (A, 1);
&lt;br&gt;%! &amp;nbsp;assert (cA, cA_test, 2**-12);
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 6;
&lt;br&gt;%! &amp;nbsp;A = hilb (N);
&lt;br&gt;%! &amp;nbsp;SOLVE = @(x) A\x; SOLVE_T = @(x) A'\x;
&lt;br&gt;%! &amp;nbsp;cA = 1 / rcond (A, SOLVE, SOLVE_T);
&lt;br&gt;%! &amp;nbsp;cA_test = norm (inv (A), 1) * norm (A, 1);
&lt;br&gt;%! &amp;nbsp;assert (cA, cA_test, 2**-12);
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 6;
&lt;br&gt;%! &amp;nbsp;A = hilb (N);
&lt;br&gt;%! &amp;nbsp;APPLY = @(x) A*x; APPLY_T = @(x) A'*x;
&lt;br&gt;%! &amp;nbsp;SOLVE = @(x) A\x; SOLVE_T = @(x) A'\x;
&lt;br&gt;%! &amp;nbsp;cA = 1 / rcond (APPLY, APPLY_T, SOLVE, SOLVE_T, N);
&lt;br&gt;%! &amp;nbsp;cA_test = norm (inv (A), 1) * norm (A, 1);
&lt;br&gt;%! &amp;nbsp;assert (cA, cA_test, 2**-6);
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 12;
&lt;br&gt;%! &amp;nbsp;A = hilb (N);
&lt;br&gt;%! &amp;nbsp;[rcondA, v] = rcond (A);
&lt;br&gt;%! &amp;nbsp;x = A*v;
&lt;br&gt;%! &amp;nbsp;assert (norm(x, inf), 0, eps);
&lt;br&gt;&lt;br&gt;## Copyright (c) 2007, Regents of the University of California
&lt;br&gt;## All rights reserved.
&lt;br&gt;## Redistribution and use in source and binary forms, with or without
&lt;br&gt;## modification, are permitted provided that the following conditions are met:
&lt;br&gt;##
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Redistributions of source code must retain the above copyright
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer.
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Redistributions in binary form must reproduce the above copyright
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer in the
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; documentation and/or other materials provided with the distribution.
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Neither the name of the University of California, Berkeley nor the
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; names of its contributors may be used to endorse or promote products
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; derived from this software without specific prior written permission.
&lt;br&gt;##
&lt;br&gt;## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
&lt;br&gt;## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
&lt;br&gt;## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
&lt;br&gt;## DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
&lt;br&gt;## DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
&lt;br&gt;## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
&lt;br&gt;## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
&lt;br&gt;## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
&lt;br&gt;## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
&lt;br&gt;## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
&lt;br&gt;&lt;br /&gt;## Copyright (C) 2007, Regents of the University of California
&lt;br&gt;## -*- mode: octave; -*-
&lt;br&gt;##
&lt;br&gt;## This program is free software distributed under the &amp;quot;modified&amp;quot; or
&lt;br&gt;## 3-clause BSD license appended to this file.
&lt;br&gt;&lt;br&gt;function [est, v, w, iter] = block_onenorm_est (varargin)
&lt;br&gt;&amp;nbsp; ## -*- texinfo -*-
&lt;br&gt;&amp;nbsp; ## @deftypefn {Function File} {[@var{est}, @var{v}, @var{w}, @var{iter}] = } block_onenorm_est (@var{A}, @var{t} = min (size (A, 1), 5)) 
&lt;br&gt;&amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}, @var{w}, @var{iter}] = } block_onenorm_est (@var{APPLY}, @var{APPLY_T}, @var{n}, @var{t} = min (n, 5))
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## Apply Higham and Tisseur's randomized block 1-norm estimator to
&lt;br&gt;&amp;nbsp; ## matrix @var{A} using @var{t} test vectors. &amp;nbsp;If the matrix is not
&lt;br&gt;&amp;nbsp; ## explicit, e.g. when estimating the norm of @code{inv(@var{A})} given an
&lt;br&gt;&amp;nbsp; ## LU factorization, block_onenorm_est applies @var{A} and its conjugate
&lt;br&gt;&amp;nbsp; ## transpose through a pair of functions @var{APPLY} and @var{APPLY_T},
&lt;br&gt;&amp;nbsp; ## respectively, to a dense matrix of size @var{n} by @var{t}. The
&lt;br&gt;&amp;nbsp; ## implicit version requires an explicit dimension @var{n}.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## Returns the norm estimate @var{est}, two vectors @var{v} and
&lt;br&gt;&amp;nbsp; ## @var{w} related by norm
&lt;br&gt;&amp;nbsp; ## @code{(@var{w}, 1) = @var{est} * norm (@var{v}, 1)},
&lt;br&gt;&amp;nbsp; ## and the number of iterations @var{iter}. &amp;nbsp;The number of
&lt;br&gt;&amp;nbsp; ## iterations is limited to 10 and is at least 2.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## References: 
&lt;br&gt;&amp;nbsp; ## @itemize
&lt;br&gt;&amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;nbsp; ## Pseudospectra.&amp;quot; SIMAX vol 21, no 4, pp 1185-1201.
&lt;br&gt;&amp;nbsp; ## &lt;a href=&quot;http://dx.doi.org/10.1137/S0895479899356080&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1137/S0895479899356080&lt;/a&gt;&lt;br&gt;&amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;nbsp; ## Pseudospectra.&amp;quot; &lt;a href=&quot;http://citeseer.ist.psu.edu/223007.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://citeseer.ist.psu.edu/223007.html&lt;/a&gt;&lt;br&gt;&amp;nbsp; ## @end itemize
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @seealso{condest, norm, cond}
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @end deftypefn
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## Author: Jason Riedy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13886035&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ejr@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;nbsp; ## Keywords: linear-algebra norm estimation
&lt;br&gt;&amp;nbsp; ## Version: 0.2
&lt;br&gt;&lt;br&gt;%!demo
&lt;br&gt;%! &amp;nbsp;N = 100;
&lt;br&gt;%! &amp;nbsp;A = randn(N) + eye(N);
&lt;br&gt;%! &amp;nbsp;[L,U,P] = lu(A);
&lt;br&gt;%! &amp;nbsp;nm1inv = block_onenorm_est(@(x) U\(L\(P*x)), @(x) P'*(L'\(U'\x)), \
&lt;br&gt;%! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N, 30)
&lt;br&gt;%! &amp;nbsp;norm(inv(A), 1)
&lt;br&gt;&lt;br&gt;&amp;nbsp; if size (varargin, 2) &amp;lt; 1 || size (varargin, 2) &amp;gt; 4,
&lt;br&gt;&amp;nbsp; &amp;nbsp; print_usage();
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; DEFAULT_T = 5;
&lt;br&gt;&amp;nbsp; ITMAX = 10;
&lt;br&gt;&lt;br&gt;&amp;nbsp; if ismatrix (varargin{1}),
&lt;br&gt;&amp;nbsp; &amp;nbsp; n = size (varargin{1}, 1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; if n != size (varargin{1}, 2),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; error(&amp;quot;Matrix must be square.&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; APPLY = @(x) varargin{1} * x;
&lt;br&gt;&amp;nbsp; &amp;nbsp; APPLY_T = @(x) varargin{1}' * x;
&lt;br&gt;&amp;nbsp; &amp;nbsp; if size (varargin) &amp;gt; 1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{2};
&lt;br&gt;&amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t = min (n, DEFAULT_T);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; if size (varargin, 2) &amp;lt; 3,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; print_usage();
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; n = varargin{3};
&lt;br&gt;&amp;nbsp; &amp;nbsp; APPLY = varargin{1};
&lt;br&gt;&amp;nbsp; &amp;nbsp; APPLY_T = varargin{2};
&lt;br&gt;&amp;nbsp; &amp;nbsp; if size (varargin) &amp;gt; 3,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t = varargin{4};
&lt;br&gt;&amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; t = DEFAULT_T;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## Initial test vectors X.
&lt;br&gt;&amp;nbsp; X = rand (n, t);
&lt;br&gt;&amp;nbsp; X = X ./ (ones (n,1) * sum (abs (X), 1));
&lt;br&gt;&lt;br&gt;&amp;nbsp; been_there = zeros (n, 1); # Track if a vertex has been visited.
&lt;br&gt;&amp;nbsp; est_old = 0; # To check if the estimate has increased.
&lt;br&gt;&amp;nbsp; S = zeros (n, t); # Normalized vector of signs. &amp;nbsp;The normalization is 
&lt;br&gt;&lt;br&gt;&amp;nbsp; for iter=1:ITMAX+1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; Y = feval (APPLY, X);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; ## Find the initial estimate as the largest A*x.
&lt;br&gt;&amp;nbsp; &amp;nbsp; [est, ind_best] = max (sum (abs (Y), 1));
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (est &amp;gt; est_old || iter == 2),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; w = Y(:,ind_best);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (iter &amp;gt;= 2 &amp;&amp; est &amp;lt; est_old),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## No improvement, so stop.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; est = est_old;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; est_old = est;
&lt;br&gt;&amp;nbsp; &amp;nbsp; S_old = S;
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (iter &amp;gt; ITMAX),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Gone too far. &amp;nbsp;Stop.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; S = sign (Y);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; ## Test if any of S are approximately parallel to previous S
&lt;br&gt;&amp;nbsp; &amp;nbsp; ## vectors or current S vectors. &amp;nbsp;If everything is parallel,
&lt;br&gt;&amp;nbsp; &amp;nbsp; ## stop. Otherwise, replace any parallel vectors with
&lt;br&gt;&amp;nbsp; &amp;nbsp; ## rand{-1,+1}.
&lt;br&gt;&amp;nbsp; &amp;nbsp; partest = any (abs (S_old' * S - n) &amp;lt; 4*eps*n);
&lt;br&gt;&amp;nbsp; &amp;nbsp; if all (partest),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## All the current vectors are parallel to old vectors.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## We've hit a cycle, so stop.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; if any (partest),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Some vectors are parallel to old ones and are cycling,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## but not all of them. &amp;nbsp;Replace the parallel vectors with
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## rand{-1,+1}.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; numpar = sum (partest);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; replacements = 2*(rand (n,numpar) &amp;lt; 0.5) - 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; S(:,partest) = replacements;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; ## Now test for parallel vectors within S.
&lt;br&gt;&amp;nbsp; &amp;nbsp; partest = any ( (S' * S - eye (t)) == n );
&lt;br&gt;&amp;nbsp; &amp;nbsp; if any (partest),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; numpar = sum (partest);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; replacements = 2*(rand (n,numpar) &amp;lt; 0.5) - 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; S(:,partest) = replacements;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; Z = feval (APPLY_T, S);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; ## Now find the largest non-previously-visted index per
&lt;br&gt;&amp;nbsp; &amp;nbsp; ## vector.
&lt;br&gt;&amp;nbsp; &amp;nbsp; h = max (abs (Z),2);
&lt;br&gt;&amp;nbsp; &amp;nbsp; [mh, mhi] = max (h);
&lt;br&gt;&amp;nbsp; &amp;nbsp; if iter &amp;gt;= 2 &amp;&amp; mhi == ind_best,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## Hit a cycle, stop.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; [h, ind] = sort (h, 'descend');
&lt;br&gt;&amp;nbsp; &amp;nbsp; if t &amp;gt; 1,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; firstind = ind(1:t);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if all (been_there(firstind)),
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## Visited all these before, so stop.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ind=ind(!been_there(ind));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if length (ind) &amp;lt; t,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## There aren't enough new vectors, so we're practically
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ## in a cycle. Stop.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; ## Visit the new indices.
&lt;br&gt;&amp;nbsp; &amp;nbsp; X = zeros (n, t);
&lt;br&gt;&amp;nbsp; &amp;nbsp; for zz = 1:t,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; X(ind(zz),zz) = 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endfor
&lt;br&gt;&amp;nbsp; &amp;nbsp; been_there(ind(1:t)) = 1;
&lt;br&gt;&lt;br&gt;&amp;nbsp; endfor
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## The estimate est and vector w are set in the loop above. The
&lt;br&gt;&amp;nbsp; ## vector v selects the ind_best column of A.
&lt;br&gt;&amp;nbsp; v = zeros (n, 1);
&lt;br&gt;&amp;nbsp; v(ind_best) = 1;
&lt;br&gt;endfunction
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 10;
&lt;br&gt;%! &amp;nbsp;A = ones (N);
&lt;br&gt;%! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (A);
&lt;br&gt;%! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (A', 6);
&lt;br&gt;%! &amp;nbsp;assert (nm1, N, -2*eps);
&lt;br&gt;%! &amp;nbsp;assert (nminf, N, -2*eps);
&lt;br&gt;%! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;%! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 10;
&lt;br&gt;%! &amp;nbsp;A = ones (N);
&lt;br&gt;%! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (@(x) A*x, @(x) A'*x, N, 3);
&lt;br&gt;%! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (@(x) A'*x, @(x) A*x, N, 3);
&lt;br&gt;%! &amp;nbsp;assert (nm1, N, -2*eps);
&lt;br&gt;%! &amp;nbsp;assert (nminf, N, -2*eps);
&lt;br&gt;%! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;%! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 5;
&lt;br&gt;%! &amp;nbsp;A = hilb (N);
&lt;br&gt;%! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (A);
&lt;br&gt;%! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (A', 6);
&lt;br&gt;%! &amp;nbsp;assert (nm1, norm (A, 1), -2*eps);
&lt;br&gt;%! &amp;nbsp;assert (nminf, norm (A, inf), -2*eps);
&lt;br&gt;%! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;%! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&lt;br&gt;## Only likely to be within a factor of 10.
&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 100;
&lt;br&gt;%! &amp;nbsp;A = rand (N);
&lt;br&gt;%! &amp;nbsp;[nm1, v1, w1] = block_onenorm_est (A);
&lt;br&gt;%! &amp;nbsp;[nminf, vinf, winf] = block_onenorm_est (A', 6);
&lt;br&gt;%! &amp;nbsp;assert (nm1, norm (A, 1), -.1);
&lt;br&gt;%! &amp;nbsp;assert (nminf, norm (A, inf), -.1);
&lt;br&gt;%! &amp;nbsp;assert (norm (w1, 1), nm1 * norm (v1, 1), -2*eps)
&lt;br&gt;%! &amp;nbsp;assert (norm (winf, 1), nminf * norm (vinf, 1), -2*eps)
&lt;br&gt;&lt;br&gt;## Copyright (c) 2007, Regents of the University of California
&lt;br&gt;## All rights reserved.
&lt;br&gt;## Redistribution and use in source and binary forms, with or without
&lt;br&gt;## modification, are permitted provided that the following conditions are met:
&lt;br&gt;##
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Redistributions of source code must retain the above copyright
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer.
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Redistributions in binary form must reproduce the above copyright
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer in the
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; documentation and/or other materials provided with the distribution.
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Neither the name of the University of California, Berkeley nor the
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; names of its contributors may be used to endorse or promote products
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; derived from this software without specific prior written permission.
&lt;br&gt;##
&lt;br&gt;## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
&lt;br&gt;## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
&lt;br&gt;## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
&lt;br&gt;## DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
&lt;br&gt;## DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
&lt;br&gt;## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
&lt;br&gt;## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
&lt;br&gt;## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
&lt;br&gt;## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
&lt;br&gt;## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
&lt;br&gt;&lt;br /&gt;## Copyright (C) 2007, Regents of the University of California
&lt;br&gt;## -*- mode: octave; -*-
&lt;br&gt;##
&lt;br&gt;## This program is free software distributed under the &amp;quot;modified&amp;quot; or
&lt;br&gt;## 3-clause BSD license appended to this file.
&lt;br&gt;&lt;br&gt;function [est, v] = condest (varargin)
&lt;br&gt;&amp;nbsp; ## -*- texinfo -*-
&lt;br&gt;&amp;nbsp; ## @deftypefn {Function File} {[@var{est}, @var{v}] = } condest (@var{A}, @var{t} = min (size (A, 1), 5)) 
&lt;br&gt;&amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } condest (@var{A}, @var{SOLVE}, @var{SOVLE_T}, @var{t} = min (n, 5))
&lt;br&gt;&amp;nbsp; ## @deftypefnx {Function File} {[@var{est}, @var{v}] = } condest (@var{APPLY}, @var{APPLY_T}, @var{SOLVE}, @var{SOVLE_T}, @var{n}, @var{t} = min (n, 5))
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## Estimate the 1-norm condition number of a matrix matrix @var{A}
&lt;br&gt;&amp;nbsp; ## using @var{t} test vectors pusing the randomized 1-norm estimator in
&lt;br&gt;&amp;nbsp; ## block_onenorm_est. &amp;nbsp;If the matrix is not explicit, e.g. when
&lt;br&gt;&amp;nbsp; ## estimating the condition number of @var{A} given an LU
&lt;br&gt;&amp;nbsp; ## factorization, condest uses the following functions:
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @table @var
&lt;br&gt;&amp;nbsp; ## @item APPLY
&lt;br&gt;&amp;nbsp; ## @code{A*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @item APPLY_T
&lt;br&gt;&amp;nbsp; ## @code{A'*x} for a matrix @code{x} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @item SOLVE
&lt;br&gt;&amp;nbsp; ## @code{A \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @item SOLVE_T
&lt;br&gt;&amp;nbsp; ## @code{A' \ b} for a matrix @code{b} of size @var{n} by @var{t}.
&lt;br&gt;&amp;nbsp; ## @end table
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## The implicit version requires an explicit dimension @var{n}.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @code{condest} uses a randomized algorithm to approximate
&lt;br&gt;&amp;nbsp; ## the 1-norms.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @code{condest} returns the 1-norm condition estimate @var{est} and
&lt;br&gt;&amp;nbsp; ## a vector @var{v} satisfying @code{norm (@var{A}*@var{v}, 1) == norm
&lt;br&gt;&amp;nbsp; ## (@var{A}, 1) * norm (@var{v}, 1) / @var{est}}. When @var{est} is
&lt;br&gt;&amp;nbsp; ## large, @var{v} is an approximate null vector.
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## References: 
&lt;br&gt;&amp;nbsp; ## @itemize
&lt;br&gt;&amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;nbsp; ## Pseudospectra.&amp;quot; SIMAX vol 21, no 4, pp 1185-1201.
&lt;br&gt;&amp;nbsp; ## &lt;a href=&quot;http://dx.doi.org/10.1137/S0895479899356080&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://dx.doi.org/10.1137/S0895479899356080&lt;/a&gt;&lt;br&gt;&amp;nbsp; ## @item Nicholas J. Higham and Françoise Tisseur, &amp;quot;A Block Algorithm
&lt;br&gt;&amp;nbsp; ## for Matrix 1-Norm Estimation, with an Application to 1-Norm
&lt;br&gt;&amp;nbsp; ## Pseudospectra.&amp;quot; &lt;a href=&quot;http://citeseer.ist.psu.edu/223007.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://citeseer.ist.psu.edu/223007.html&lt;/a&gt;&lt;br&gt;&amp;nbsp; ## @end itemize
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @seealso{rcond, block_onenorm_est, norm, cond}
&lt;br&gt;&amp;nbsp; ##
&lt;br&gt;&amp;nbsp; ## @end deftypefn
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## Author: Jason Riedy &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13886035&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ejr@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;nbsp; ## Keywords: linear-algebra norm estimation
&lt;br&gt;&amp;nbsp; ## Version: 0.2
&lt;br&gt;&lt;br&gt;%!demo
&lt;br&gt;%! &amp;nbsp;N = 100;
&lt;br&gt;%! &amp;nbsp;A = randn (N) + eye (N);
&lt;br&gt;%! &amp;nbsp;condest (A)
&lt;br&gt;%! &amp;nbsp;[L,U,P] = lu (A);
&lt;br&gt;%! &amp;nbsp;condest (A, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)))
&lt;br&gt;%! &amp;nbsp;condest (@(x) A*x, @(x) A'*x, @(x) U\ (L\ (P*x)), @(x) P'*(L'\ (U'\x)), N)
&lt;br&gt;%! &amp;nbsp;norm (inv (A), 1) * norm (A, 1)
&lt;br&gt;&lt;br&gt;&amp;nbsp; [est, v] = rcond(varargin{:});
&lt;br&gt;&amp;nbsp; est = 1/est;
&lt;br&gt;endfunction
&lt;br&gt;&lt;br&gt;## These tests are the same as in rcond().
&lt;br&gt;&lt;br&gt;%!test
&lt;br&gt;%! &amp;nbsp;N = 6;
&lt;br&gt;%! &amp;nbsp;A = hilb (N);
&lt;br&gt;%! &amp;nbsp;cA = condest (A);
&lt;br&gt;%! &amp;nbsp;rcA = 1 / rcond (A);
&lt;br&gt;%! &amp;nbsp;assert (cA, rcA, 2**-12);
&lt;br&gt;&lt;br&gt;## Copyright (c) 2007, Regents of the University of California
&lt;br&gt;## All rights reserved.
&lt;br&gt;## Redistribution and use in source and binary forms, with or without
&lt;br&gt;## modification, are permitted provided that the following conditions are met:
&lt;br&gt;##
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Redistributions of source code must retain the above copyright
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer.
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Redistributions in binary form must reproduce the above copyright
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; notice, this list of conditions and the following disclaimer in the
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; documentation and/or other materials provided with the distribution.
&lt;br&gt;## &amp;nbsp; &amp;nbsp; * Neither the name of the University of California, Berkeley nor the
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; names of its contributors may be used to endorse or promote products
&lt;br&gt;## &amp;nbsp; &amp;nbsp; &amp;nbsp; derived from this software without specific prior written permission.
&lt;br&gt;##
&lt;br&gt;## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
&lt;br&gt;## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
&lt;br&gt;## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
&lt;br&gt;## DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
&lt;br&gt;## DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
&lt;br&gt;## (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
&lt;br&gt;## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
&lt;br&gt;## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
&lt;br&gt;## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
&lt;br&gt;## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
&lt;br&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13886035&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/rcond%2C-condest%2C-and-a-block-1-norm-estimator-tp13886035p13886035.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13885567</id>
	<title>Update to wavread.m and wavwrite.m</title>
	<published>2007-11-06T11:22:08Z</published>
	<updated>2007-11-06T11:22:08Z</updated>
	<author>
		<name>John W. Eaton</name>
	</author>
	<content type="html">On &amp;nbsp;7-Oct-2007, Michael Zeising wrote:
&lt;br&gt;&lt;br&gt;| I've currently noticed that the sample scaling in my WAV functions is 
&lt;br&gt;| wrong and causes asymmetries and DC components (thanks to Denis 
&lt;br&gt;| Sbragion). I've attached an updated version of them and I hope you can 
&lt;br&gt;| include them into the distribution of octave. Thanks in advance!
&lt;br&gt;&lt;br&gt;Please send context diffs relative to the version you started with to
&lt;br&gt;make your modifications. &amp;nbsp;That way, we won't lose any changes that may
&lt;br&gt;have been made to the versions of these functions that are already in
&lt;br&gt;Octave.
&lt;br&gt;&lt;br&gt;Please also use the &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13885567&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug@...&lt;/a&gt; list for sending patches to
&lt;br&gt;functions that are already a part of Octave. &amp;nbsp;The sources list was
&lt;br&gt;originally intended as a place to post add-on functions to Octave and
&lt;br&gt;is mostly dead now that Octave Forge exists.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;jwe
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13885567&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Update-to-wavread.m-and-wavwrite.m-tp13609592p13885567.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13885678</id>
	<title>Re: Update to wavread.m and wavwrite.m (Michael Zeising)</title>
	<published>2007-11-06T05:02:25Z</published>
	<updated>2007-11-06T05:02:25Z</updated>
	<author>
		<name>Muthiah Annamalai-3</name>
	</author>
	<content type="html">&lt;div class='shrinkable-quote'&gt;&amp;gt; Date: Sun, 07 Oct 2007 12:28:08 +0200
&lt;br&gt;&amp;gt; From: Michael Zeising &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13885678&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;michael@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; Subject: Update to wavread.m and wavwrite.m
&lt;br&gt;&amp;gt; To: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13885678&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;octave-sources@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Message-ID: &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13885678&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;4708B4B8.9050100@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; Content-Type: text/plain; charset=&amp;quot;iso-8859-15&amp;quot;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Hi there,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I've currently noticed that the sample scaling in my WAV functions is 
&lt;br&gt;&amp;gt; wrong and causes asymmetries and DC components (thanks to Denis 
&lt;br&gt;&amp;gt; Sbragion). I've attached an updated version of them and I hope you can 
&lt;br&gt;&amp;gt; include them into the distribution of octave. Thanks in advance!
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Regards,
&lt;br&gt;&amp;gt; Michael Zeising
&lt;/div&gt;&lt;br&gt;How about sending a patch to the bug-octave list? I think you must make
&lt;br&gt;a patch against the existing sources, and put it there; then maybe JWE
&lt;br&gt;can update it, and find it easily.
&lt;br&gt;&lt;br&gt;Best,
&lt;br&gt;Muthu
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13885678&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A-Update-to-wavread.m-and-wavwrite.m-%28Michael-Zeising%29-tp13885678p13885678.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13609863</id>
	<title>Re: Information-theoretic functions</title>
	<published>2007-10-10T07:50:44Z</published>
	<updated>2007-10-10T07:50:44Z</updated>
	<author>
		<name>Joseph Wakeling</name>
	</author>
	<content type="html">David Bateman wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Muthiah Annamalai wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hello there,
&lt;br&gt;&amp;gt;&amp;gt; I have a followup email to this discussion at,
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.cae.wisc.edu/pipermail/octave-sources/2006-November/000048.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cae.wisc.edu/pipermail/octave-sources/2006-November/000048.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I have put the files contributed by Joseph Wakeling, into a form we can add
&lt;br&gt;&amp;gt;&amp;gt; to our repository. But, can I put a GPL on it, and commit? or the license I
&lt;br&gt;&amp;gt;&amp;gt; have to wait for Joseph's consent?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I have written to Joseph, but waiting for his reply.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;&amp;gt; Muthu
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; 
&lt;br&gt;&amp;gt; The previous e-mail says &amp;quot;offer to the community&amp;quot;, however what exactly
&lt;br&gt;&amp;gt; that means and under what terms is completely unclear.. No you have to
&lt;br&gt;&amp;gt; get the original authors permission prior to putting these under a GPL.
&lt;/div&gt;&lt;br&gt;Just to confirm my private email to Muthiah, I always intended for these
&lt;br&gt;to be released as GPL.
&lt;br&gt;&lt;br&gt;In the longer run I really should take that code and integrate it with
&lt;br&gt;Muthiah's functions. &amp;nbsp;Muthiah's take the appropriate probability values
&lt;br&gt;and calculate entropy etc., so to ensure compatibility I should use his
&lt;br&gt;functions to perform those tasks (my functions take sequence(s) of
&lt;br&gt;events and calculate the probabilities first).
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13609863&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Information-theoretic-functions-tp12941677p13609863.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13609592</id>
	<title>Update to wavread.m and wavwrite.m</title>
	<published>2007-10-07T04:28:08Z</published>
	<updated>2007-10-07T04:28:08Z</updated>
	<author>
		<name>Michael Zeising</name>
	</author>
	<content type="html">Hi there,
&lt;br&gt;&lt;br&gt;I've currently noticed that the sample scaling in my WAV functions is 
&lt;br&gt;wrong and causes asymmetries and DC components (thanks to Denis 
&lt;br&gt;Sbragion). I've attached an updated version of them and I hope you can 
&lt;br&gt;include them into the distribution of octave. Thanks in advance!
&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Michael Zeising
&lt;br&gt;&lt;br&gt;&lt;br /&gt;## Copyright (C) 2007 Michael Zeising
&lt;br&gt;##
&lt;br&gt;## This file is part of Octave.
&lt;br&gt;##
&lt;br&gt;## Octave is free software; you can redistribute it and/or modify it
&lt;br&gt;## under the terms of the GNU General Public License as published by
&lt;br&gt;## the Free Software Foundation; either version 2, or (at your option)
&lt;br&gt;## any later version.
&lt;br&gt;##
&lt;br&gt;## Octave is distributed in the hope that it will be useful, but
&lt;br&gt;## WITHOUT ANY WARRANTY; without even the implied warranty of
&lt;br&gt;## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &amp;nbsp;See the GNU
&lt;br&gt;## General Public License for more details.
&lt;br&gt;##
&lt;br&gt;## You should have received a copy of the GNU General Public License
&lt;br&gt;## along with Octave; see the file COPYING. &amp;nbsp;If not, write to the Free
&lt;br&gt;## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
&lt;br&gt;## 02110-1301, USA.
&lt;br&gt;&lt;br&gt;## -*- texinfo -*-
&lt;br&gt;## @deftypefn {Function File} {@var{y} =} wavread (@var{filename})
&lt;br&gt;## Load the RIFF/WAVE sound file @var{filename}, and return the samples
&lt;br&gt;## in vector @var{y}. &amp;nbsp;If the file contains multichannel data, then
&lt;br&gt;## @var{y} is a matrix with the channels represented as columns.
&lt;br&gt;##
&lt;br&gt;## @deftypefnx {Function File} {[@var{y}, @var{Fs}, @var{bits}] =} wavread (@var{filename})
&lt;br&gt;## Additionally return the sample rate (@var{fs}) in Hz and the number of bits 
&lt;br&gt;## per sample (@var{bits}).
&lt;br&gt;##
&lt;br&gt;## @deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n})
&lt;br&gt;## Read only the first @var{n} samples from each channel.
&lt;br&gt;##
&lt;br&gt;## @deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename},[@var{n1} @var{n2}])
&lt;br&gt;## Read only samples @var{n1} through @var{n2} from each channel.
&lt;br&gt;##
&lt;br&gt;## @deftypefnx {Function File} {[@var{samples}, @var{channels}] =} wavread (@var{filename}, &amp;quot;size&amp;quot;)
&lt;br&gt;## Return the number of samples (@var{n}) and channels (@var{ch})
&lt;br&gt;## instead of the audio data.
&lt;br&gt;## @seealso{wavwrite}
&lt;br&gt;## @end deftypefn
&lt;br&gt;&lt;br&gt;## Author: Michael Zeising &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13609592&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;michael@...&lt;/a&gt;&amp;gt;
&lt;br&gt;## Created: 07 October 2007
&lt;br&gt;&lt;br&gt;function [y, samples_per_sec, bits_per_sample] = wavread (filename, param)
&lt;br&gt;&lt;br&gt;&amp;nbsp; FORMAT_PCM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 0x0001; &amp;nbsp; # PCM (8/16/32 bit)
&lt;br&gt;&amp;nbsp; FORMAT_IEEE_FLOAT = 0x0003; &amp;nbsp; # IEEE float (32/64 bit)
&lt;br&gt;&amp;nbsp; BYTEORDER &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &amp;quot;ieee-le&amp;quot;;
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (nargin &amp;lt; 1 || nargin &amp;gt; 2)
&lt;br&gt;&amp;nbsp; &amp;nbsp; print_usage ();
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (! ischar (filename))
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavwrite: expecting filename to be a character string&amp;quot;);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; # open file for binary reading
&lt;br&gt;&amp;nbsp; [fid, msg] = fopen (filename, &amp;quot;rb&amp;quot;);
&lt;br&gt;&amp;nbsp; if (fid &amp;lt; 0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: %s&amp;quot;, msg);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## check for RIFF/WAVE header
&lt;br&gt;&amp;nbsp; ck_id = char (fread (fid, 4))';
&lt;br&gt;&amp;nbsp; fseek (fid, 4, SEEK_CUR);
&lt;br&gt;&amp;nbsp; wave_id = char (fread (fid, 4))';
&lt;br&gt;&amp;nbsp; if (ck_id != &amp;quot;RIFF&amp;quot; || wave_id != &amp;quot;WAVE&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: file contains no RIFF/WAVE signature&amp;quot;);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## find format chunk within the next 256 (4*64) bytes
&lt;br&gt;&amp;nbsp; i = 1;
&lt;br&gt;&amp;nbsp; while (true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (char (fread (fid, 4))' == &amp;quot;fmt &amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (i++ == 64)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: file contains no format chunk&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; endwhile
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## format chunk size
&lt;br&gt;&amp;nbsp; ck_size = fread (fid, 1, &amp;quot;uint32&amp;quot;, 0, BYTEORDER); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## sample format code
&lt;br&gt;&amp;nbsp; format_tag = fread (fid, 1, &amp;quot;uint16&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&amp;nbsp; if (format_tag != FORMAT_PCM &amp;&amp; format_tag != FORMAT_IEEE_FLOAT)
&lt;br&gt;&amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: sample format %#x is not supported&amp;quot;, format_tag);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## number of interleaved channels &amp;nbsp;
&lt;br&gt;&amp;nbsp; channels = fread (fid, 1, &amp;quot;uint16&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## sample rate
&lt;br&gt;&amp;nbsp; samples_per_sec = fread (fid, 1, &amp;quot;uint32&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## bits per sample
&lt;br&gt;&amp;nbsp; fseek (fid, 6, SEEK_CUR);
&lt;br&gt;&amp;nbsp; bits_per_sample = fread (fid, 1, &amp;quot;uint16&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## ignore the rest of the chunk
&lt;br&gt;&amp;nbsp; fseek (fid, ck_size-16, SEEK_CUR);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## find data chunk
&lt;br&gt;&amp;nbsp; i = 1;
&lt;br&gt;&amp;nbsp; while (true)
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (char (fread (fid, 4))' == &amp;quot;data&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (i++ == 64)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: file contains no data chunk&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; end
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## data chunk size
&lt;br&gt;&amp;nbsp; ck_size = fread (fid, 1, &amp;quot;uint32&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## determine sample data type
&lt;br&gt;&amp;nbsp; if (format_tag == FORMAT_PCM)
&lt;br&gt;&amp;nbsp; &amp;nbsp; switch (bits_per_sample)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 8
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;uint8&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 16 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;int16&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 24
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;uint8&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 32 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;int32&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; otherwise
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: %d bits sample resolution is not supported with PCM&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bits_per_sample);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endswitch
&lt;br&gt;&amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; switch (bits_per_sample)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 32 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;float32&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 64 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;float64&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; otherwise
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: %d bits sample resolution is not supported with IEEE float&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bits_per_sample);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endswitch
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## parse arguments
&lt;br&gt;&amp;nbsp; if (nargin == 1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; length = inf;
&lt;br&gt;&amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (size (param, 2) == 1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## number of samples is given
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; length = param * channels;
&lt;br&gt;&amp;nbsp; &amp;nbsp; elseif (size (param, 2) == 2)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## sample range is given
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (fseek (fid, (param(1)-1) * channels * (bits_per_sample/8), SEEK_CUR) &amp;lt; 0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; warning (&amp;quot;wavread: seeking failed&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; length = (param(2)-param(1)+1) * channels;
&lt;br&gt;&amp;nbsp; &amp;nbsp; elseif (size (param, 2) == 4 &amp;&amp; char (param) == &amp;quot;size&amp;quot;)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ## size of the file is requested
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; y = [ck_size/channels/(bits_per_sample/8), channels];
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return
&lt;br&gt;&amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: invalid argument 2&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## read samples and close file
&lt;br&gt;&amp;nbsp; if (bits_per_sample == 24)
&lt;br&gt;&amp;nbsp; &amp;nbsp; length *= 3;
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; [yi, n] = fread (fid, length, format, 0, BYTEORDER);
&lt;br&gt;&amp;nbsp; fclose (fid);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## check data
&lt;br&gt;&amp;nbsp; if (mod (numel (yi), channels) != 0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavread: data in %s doesn't match the number of channels&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;filename);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (bits_per_sample == 24)
&lt;br&gt;&amp;nbsp; &amp;nbsp; yi = reshape (yi, 3, rows(yi)/3)';
&lt;br&gt;&amp;nbsp; &amp;nbsp; yi(yi(:,3) &amp;gt;= 128, 3) -= 256;
&lt;br&gt;&amp;nbsp; &amp;nbsp; yi = yi * [1; 256; 65536];
&lt;br&gt;&amp;nbsp; end
&lt;br&gt;&amp;nbsp; if (format_tag == FORMAT_PCM)
&lt;br&gt;&amp;nbsp; &amp;nbsp; ## normalize samples
&lt;br&gt;&amp;nbsp; &amp;nbsp; switch (bits_per_sample)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 8
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; yi = (yi - 128)/127;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 16
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; yi /= 32767;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 24
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; yi /= 8388607;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; case 32
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; yi /= 2147483647;
&lt;br&gt;&amp;nbsp; &amp;nbsp; endswitch
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## deinterleave
&lt;br&gt;&amp;nbsp; nr = numel (yi) / channels;
&lt;br&gt;&amp;nbsp; y = reshape (yi, channels, nr)';
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;endfunction
&lt;br&gt;&lt;br&gt;&lt;br /&gt;## Copyright (C) 2007 Michael Zeising
&lt;br&gt;##
&lt;br&gt;## This file is part of Octave.
&lt;br&gt;##
&lt;br&gt;## Octave is free software; you can redistribute it and/or modify it
&lt;br&gt;## under the terms of the GNU General Public License as published by
&lt;br&gt;## the Free Software Foundation; either version 2, or (at your option)
&lt;br&gt;## any later version.
&lt;br&gt;##
&lt;br&gt;## Octave is distributed in the hope that it will be useful, but
&lt;br&gt;## WITHOUT ANY WARRANTY; without even the implied warranty of
&lt;br&gt;## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &amp;nbsp;See the GNU
&lt;br&gt;## General Public License for more details.
&lt;br&gt;##
&lt;br&gt;## You should have received a copy of the GNU General Public License
&lt;br&gt;## along with Octave; see the file COPYING. &amp;nbsp;If not, write to the Free
&lt;br&gt;## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
&lt;br&gt;## 02110-1301, USA.
&lt;br&gt;&lt;br&gt;## -*- texinfo -*-
&lt;br&gt;## @deftypefn {Function File} {} wavwrite (@var{filename}, @var{y})
&lt;br&gt;## Write @var{y} to the canonical RIFF/WAVE sound file @var{filename}. A sample 
&lt;br&gt;## rate of 8000 Hz and 16-bit samples are assumed. Each column of the data 
&lt;br&gt;## represents a separate channel.
&lt;br&gt;##
&lt;br&gt;## @deftypefnx {Function File} {} wavwrite (@var{filename}, @var{y}, @var{fs})
&lt;br&gt;## Set the sample rate to @var{fs} Hz.
&lt;br&gt;##
&lt;br&gt;## @deftypefnx {Function File} {} wavwrite (@var{filename}, @var{y}, @var{fs}, @var{bits})
&lt;br&gt;## Set the sample rate to @var{fs} Hz and resolution to @var{bits} bits.
&lt;br&gt;## @seealso{wavread}
&lt;br&gt;## @end deftypefn
&lt;br&gt;&lt;br&gt;## Author: Michael Zeising &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13609592&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;michael@...&lt;/a&gt;&amp;gt;
&lt;br&gt;## Created: 07 October 2007
&lt;br&gt;&lt;br&gt;function wavwrite (filename, y, samples_per_sec, bits_per_sample)
&lt;br&gt;&lt;br&gt;&amp;nbsp; BYTEORDER = &amp;quot;ieee-le&amp;quot;;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; if (nargin &amp;lt; 2 || nargin &amp;gt; 4)
&lt;br&gt;&amp;nbsp; &amp;nbsp; print_usage ();
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## test arguments
&lt;br&gt;&amp;nbsp; if (columns (y) &amp;lt; 1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavwrite: Y must have at least one column&amp;quot;);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; if (columns (y) &amp;gt; 2^15-1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavwrite: Y has more than 32767 columns (too many for a WAV-file)&amp;quot;);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## parse arguments
&lt;br&gt;&amp;nbsp; if (nargin &amp;lt; 3)
&lt;br&gt;&amp;nbsp; &amp;nbsp; samples_per_sec = 8000;
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (nargin &amp;lt; 4)
&lt;br&gt;&amp;nbsp; &amp;nbsp; bits_per_sample = 16;
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## determine sample format
&lt;br&gt;&amp;nbsp; switch (bits_per_sample)
&lt;br&gt;&amp;nbsp; &amp;nbsp; case 8 &amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;uint8&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; case 16 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;int16&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; case 32 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; format = &amp;quot;int32&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp; otherwise
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; error (&amp;quot;wavwrite: sample resolution not supported&amp;quot;);
&lt;br&gt;&amp;nbsp; endswitch
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## calculate filesize
&lt;br&gt;&amp;nbsp; [n, channels] = size(y);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## size of data chunk
&lt;br&gt;&amp;nbsp; ck_size = n*channels*(bits_per_sample/8);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## open file for writing binary
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (! ischar (filename))
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavwrite: expecting filename to be a character string&amp;quot;);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; [fid, msg] = fopen (filename, &amp;quot;wb&amp;quot;);
&lt;br&gt;&amp;nbsp; if (fid &amp;lt; 0)
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavwrite: %s&amp;quot;, msg)
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## write RIFF/WAVE header
&lt;br&gt;&amp;nbsp; c = 0;
&lt;br&gt;&amp;nbsp; c += fwrite (fid, &amp;quot;RIFF&amp;quot;, &amp;quot;uchar&amp;quot;);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## file size - 8
&lt;br&gt;&amp;nbsp; c += fwrite (fid, ck_size + 36, &amp;quot;uint32&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&amp;nbsp; c += fwrite (fid, &amp;quot;WAVEfmt &amp;quot;, &amp;quot;uchar&amp;quot;);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## size of fmt chunk
&lt;br&gt;&amp;nbsp; c += fwrite (fid, 16, &amp;quot;uint32&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## sample format code (PCM)
&lt;br&gt;&amp;nbsp; c += fwrite (fid, 1, &amp;quot;uint16&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## channels
&lt;br&gt;&amp;nbsp; c += fwrite (fid, channels, &amp;quot;uint16&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## sample rate
&lt;br&gt;&amp;nbsp; c += fwrite (fid, samples_per_sec, &amp;quot;uint32&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## bytes per second
&lt;br&gt;&amp;nbsp; bps = samples_per_sec*channels*bits_per_sample/8;
&lt;br&gt;&amp;nbsp; c += fwrite (fid, bps, &amp;quot;uint32&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; ## block align
&lt;br&gt;&amp;nbsp; c += fwrite (fid, channels*bits_per_sample/8, &amp;quot;uint16&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&lt;br&gt;&amp;nbsp; c += fwrite (fid, bits_per_sample, &amp;quot;uint16&amp;quot;, 0, BYTEORDER); &amp;nbsp; 
&lt;br&gt;&amp;nbsp; c += fwrite (fid, &amp;quot;data&amp;quot;, &amp;quot;uchar&amp;quot;);
&lt;br&gt;&amp;nbsp; c += fwrite (fid, ck_size, &amp;quot;uint32&amp;quot;, 0, BYTEORDER);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; if (c &amp;lt; 25)
&lt;br&gt;&amp;nbsp; &amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; &amp;nbsp; error (&amp;quot;wavwrite: writing to file failed&amp;quot;);
&lt;br&gt;&amp;nbsp; endif
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## interleave samples
&lt;br&gt;&amp;nbsp; yi = reshape (y', n*channels, 1);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## scale samples
&lt;br&gt;&amp;nbsp; switch (bits_per_sample)
&lt;br&gt;&amp;nbsp; &amp;nbsp; case 8
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; yi = round (yi*127 + 128);
&lt;br&gt;&amp;nbsp; &amp;nbsp; case 16
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; yi = round (yi*32767);
&lt;br&gt;&amp;nbsp; &amp;nbsp; case 32
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; yi = round (yi*2147483647);
&lt;br&gt;&amp;nbsp; endswitch
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; ## write to file
&lt;br&gt;&amp;nbsp; c = fwrite (fid, yi, format, 0, BYTEORDER);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; fclose (fid);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;endfunction
&lt;br&gt;&lt;br&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13609592&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Update-to-wavread.m-and-wavwrite.m-tp13609592p13609592.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13070866</id>
	<title>print.m: SVG ans size specification for PNG and SVG</title>
	<published>2007-10-05T22:54:44Z</published>
	<updated>2007-10-05T22:54:44Z</updated>
	<author>
		<name>John W. Eaton</name>
	</author>
	<content type="html">On 21-Sep-2007, Francesco Potorti` wrote:
&lt;br&gt;&lt;br&gt;| This patch, which is alternative to the previously posted one, adds the
&lt;br&gt;| SVG type to the capabilities of print.m and additionally allows for a
&lt;br&gt;| -Sxsize,ysize option for PNG and SVG terminals.
&lt;br&gt;&lt;br&gt;I applied this patch.
&lt;br&gt;&lt;br&gt;BTW, I would have missed this change if you had not mentioned it
&lt;br&gt;again. &amp;nbsp;In the future, it would be best to send changes for existing
&lt;br&gt;code to the &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13070866&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;bug@...&lt;/a&gt; list.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;jwe
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13070866&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/print.m%3A-SVG-ans-size-specification-for-PNG-and-SVG-tp12941618p13070866.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13070876</id>
	<title>Missing keywords in octave-mod.el</title>
	<published>2007-10-04T10:09:37Z</published>
	<updated>2007-10-04T10:09:37Z</updated>
	<author>
		<name>Rafael Laboissiere</name>
	</author>
	<content type="html">Patch attached.
&lt;br&gt;&lt;br&gt;2007-10-04 &amp;nbsp;Rafael Laboissiere &amp;nbsp;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13070876&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;rafael@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * emacs/octave-mod.el: Added missing keywords to list of reserved
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; words.
&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;? Makefile
&lt;br&gt;Index: octave-mod.el
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvs/octave/emacs/octave-mod.el,v
&lt;br&gt;retrieving revision 1.43
&lt;br&gt;diff -u -u -r1.43 octave-mod.el
&lt;br&gt;--- octave-mod.el	20 Apr 2007 05:31:41 -0000	1.43
&lt;br&gt;+++ octave-mod.el	4 Oct 2007 16:11:18 -0000
&lt;br&gt;@@ -112,7 +112,8 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp;(append octave-begin-keywords
&lt;br&gt;&amp;nbsp;	 &amp;nbsp;octave-else-keywords
&lt;br&gt;&amp;nbsp;	 &amp;nbsp;octave-end-keywords
&lt;br&gt;-	 &amp;nbsp;'(&amp;quot;all_va_args&amp;quot; &amp;quot;break&amp;quot; &amp;quot;continue&amp;quot; &amp;quot;end&amp;quot; &amp;quot;global&amp;quot; &amp;quot;return&amp;quot;))
&lt;br&gt;+	 &amp;nbsp;'(&amp;quot;all_va_args&amp;quot; &amp;quot;break&amp;quot; &amp;quot;continue&amp;quot; &amp;quot;end&amp;quot; &amp;quot;global&amp;quot; &amp;quot;persistent&amp;quot;
&lt;br&gt;+	 &amp;nbsp; &amp;nbsp;&amp;quot;return&amp;quot; &amp;quot;static&amp;quot; &amp;quot;varargin&amp;quot; &amp;quot;varargout&amp;quot; &amp;quot;__FILE__&amp;quot; &amp;quot;__LINE__&amp;quot;))
&lt;br&gt;&amp;nbsp; &amp;nbsp;&amp;quot;Reserved words in Octave.&amp;quot;)
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp;(defvar octave-text-functions
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13070876&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Missing-keywords-in-octave-mod.el-tp13070876p13070876.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-13019011</id>
	<title>Re: Information-theoretic functions</title>
	<published>2007-09-28T08:35:13Z</published>
	<updated>2007-09-28T08:35:13Z</updated>
	<author>
		<name>David Bateman</name>
	</author>
	<content type="html">Muthiah Annamalai wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello there,
&lt;br&gt;&amp;gt; I have a followup email to this discussion at,
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.cae.wisc.edu/pipermail/octave-sources/2006-November/000048.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cae.wisc.edu/pipermail/octave-sources/2006-November/000048.html&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I have put the files contributed by Joseph Wakeling, into a form we can add
&lt;br&gt;&amp;gt; to our repository. But, can I put a GPL on it, and commit? or the license I
&lt;br&gt;&amp;gt; have to wait for Joseph's consent?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I have written to Joseph, but waiting for his reply.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Muthu
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;The previous e-mail says &amp;quot;offer to the community&amp;quot;, however what exactly
&lt;br&gt;that means and under what terms is completely unclear.. No you have to
&lt;br&gt;get the original authors permission prior to putting these under a GPL.
&lt;br&gt;&lt;br&gt;D.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;David Bateman &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13019011&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;David.Bateman@...&lt;/a&gt;
&lt;br&gt;Motorola Labs - Paris &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 48 04 (Ph) 
&lt;br&gt;Parc Les Algorithmes, Commune de St Aubin &amp;nbsp; &amp;nbsp;+33 6 72 01 06 33 (Mob) 
&lt;br&gt;91193 Gif-Sur-Yvette FRANCE &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+33 1 69 35 77 01 (Fax) 
&lt;br&gt;&lt;br&gt;The information contained in this communication has been classified as: 
&lt;br&gt;&lt;br&gt;[x] General Business Information 
&lt;br&gt;[ ] Motorola Internal Use Only 
&lt;br&gt;[ ] Motorola Confidential Proprietary
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=13019011&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Information-theoretic-functions-tp12941677p13019011.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-12941275</id>
	<title>Re: findobj</title>
	<published>2007-09-26T14:49:41Z</published>
	<updated>2007-09-26T14:49:41Z</updated>
	<author>
		<name>dbateman3</name>
	</author>
	<content type="html">Ben Abbott wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I tried to post once, but it hasn't gone through yet ... so I'm trying again.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I've written a Octave script that is intended to mirror the functionality of
&lt;br&gt;&amp;gt; Matlab's findobj function. 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I'm having some difficulty understanding how the '-logicaloperator' option
&lt;br&gt;&amp;gt; is intended to work, but beyond that annoyance, it appears to be working.
&lt;br&gt;&amp;gt; I've attached a copy of this 'work in progress'. 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I have a couple of questions. 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (1) Is this something that might be contributed to Octave in general? 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; (2) If so, what is the proper procedure? 
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.nabble.com/file/p12767686/findobj.m&quot; target=&quot;_top&quot;&gt;http://www.nabble.com/file/p12767686/findobj.m&lt;/a&gt;&amp;nbsp;findobj.m 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;This is an Octave core function and so it goes into the core. Yeah I
&lt;br&gt;think its useful. You should probably join the octave help or
&lt;br&gt;maintainers list directly at
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.octave.org/archive.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.octave.org/archive.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;and send the code you have there.. The Nabble interface is probably why
&lt;br&gt;no ones responded to this mail yet as the e-mail took sometime to get to
&lt;br&gt;the lists.. Unfortunately the attachment seems to have been stripped by
&lt;br&gt;Nabble..
&lt;br&gt;&lt;br&gt;D.
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12941275&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A-findobj-tp12941275p12941275.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-12941677</id>
	<title>Information-theoretic functions</title>
	<published>2007-09-24T09:14:15Z</published>
	<updated>2007-09-24T09:14:15Z</updated>
	<author>
		<name>Muthiah Annamalai-3</name>
	</author>
	<content type="html">Hello there,
&lt;br&gt;I have a followup email to this discussion at,
&lt;br&gt;&lt;a href=&quot;http://www.cae.wisc.edu/pipermail/octave-sources/2006-November/000048.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cae.wisc.edu/pipermail/octave-sources/2006-November/000048.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;I have put the files contributed by Joseph Wakeling, into a form we can add
&lt;br&gt;to our repository. But, can I put a GPL on it, and commit? or the license I
&lt;br&gt;have to wait for Joseph's consent?
&lt;br&gt;&lt;br&gt;I have written to Joseph, but waiting for his reply.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Muthu
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12941677&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Information-theoretic-functions-tp12941677p12941677.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-12941618</id>
	<title>print.m: SVG ans size specification for PNG and SVG</title>
	<published>2007-09-21T05:32:45Z</published>
	<updated>2007-09-21T05:32:45Z</updated>
	<author>
		<name>Francesco Potortì</name>
	</author>
	<content type="html">This patch, which is alternative to the previously posted one, adds the
&lt;br&gt;SVG type to the capabilities of print.m and additionally allows for a
&lt;br&gt;-Sxsize,ysize option for PNG and SVG terminals.
&lt;br&gt;&lt;br&gt;--- /home/pot/math/octavelib/utils/myprint.m~	2007-09-21 12:48:05.000000000 +0200
&lt;br&gt;+++ /home/pot/math/octavelib/utils/myprint.m	2007-09-21 13:30:55.000000000 +0200
&lt;br&gt;@@ -69,20 +69,22 @@
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item cdr
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @itemx corel
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; CorelDraw
&lt;br&gt;-## &amp;nbsp; @item hpgl
&lt;br&gt;-## &amp;nbsp; &amp;nbsp; HP plotter language
&lt;br&gt;-## &amp;nbsp; @item fig
&lt;br&gt;-## &amp;nbsp; &amp;nbsp; XFig
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item dxf
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; AutoCAD
&lt;br&gt;+## &amp;nbsp; @item emf
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; Microsoft Enhanced Metafile
&lt;br&gt;+## &amp;nbsp; @item fig
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; XFig
&lt;br&gt;+## &amp;nbsp; @item hpgl
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; HP plotter language
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item mf
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; Metafont
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item png
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; Portable network graphics
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item pbm
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; PBMplus
&lt;br&gt;-## &amp;nbsp; @item emf
&lt;br&gt;-## &amp;nbsp; &amp;nbsp; Microsoft Enhanced Metafile
&lt;br&gt;+## &amp;nbsp; @item svg
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; Scalable vector graphics
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @end table
&lt;br&gt;&amp;nbsp;##
&lt;br&gt;&amp;nbsp;## &amp;nbsp; Other devices are supported by &amp;quot;convert&amp;quot; from ImageMagick. &amp;nbsp;Type
&lt;br&gt;@@ -91,6 +93,9 @@
&lt;br&gt;&amp;nbsp;## &amp;nbsp; If the device is omitted, it is inferred from the file extension,
&lt;br&gt;&amp;nbsp;## &amp;nbsp; or if there is no filename it is sent to the printer as postscript.
&lt;br&gt;&amp;nbsp;##
&lt;br&gt;+## @itemx -S@@var{xsize},@var{ysize}
&lt;br&gt;+## &amp;nbsp; Plot size in points for PNG and SVG.
&lt;br&gt;+##
&lt;br&gt;&amp;nbsp;## @item -F@var{fontname}
&lt;br&gt;&amp;nbsp;## @itemx -F@var{fontname}:@var{size}
&lt;br&gt;&amp;nbsp;## @itemx -F:@var{size}
&lt;br&gt;@@ -116,6 +121,7 @@ function print (varargin)
&lt;br&gt;&amp;nbsp; &amp;nbsp;force_solid = 0; # 0=default, -1=dashed, +1=solid
&lt;br&gt;&amp;nbsp; &amp;nbsp;fontsize = &amp;quot;&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp;font = &amp;quot;&amp;quot;;
&lt;br&gt;+ &amp;nbsp;size = &amp;quot;&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp;name = &amp;quot;&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp;devopt = &amp;quot;&amp;quot;;
&lt;br&gt;&amp;nbsp; &amp;nbsp;printer = &amp;quot;&amp;quot;;
&lt;br&gt;@@ -147,6 +153,8 @@ function print (varargin)
&lt;br&gt;&amp;nbsp;	else
&lt;br&gt;&amp;nbsp;	 &amp;nbsp;font = arg(3:length(arg));
&lt;br&gt;&amp;nbsp;	endif
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;elseif (length (arg) &amp;gt; 2 &amp;&amp; arg(1:2) == &amp;quot;-S&amp;quot;)
&lt;br&gt;+	size = arg(3:length(arg));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;elseif (length (arg) &amp;gt;= 1 &amp;&amp; arg(1) == &amp;quot;-&amp;quot;)
&lt;br&gt;&amp;nbsp;	error (&amp;quot;print: unknown option `%s'&amp;quot;, arg);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;elseif (length (arg) &amp;gt; 0)
&lt;br&gt;@@ -191,7 +199,7 @@ function print (varargin)
&lt;br&gt;&amp;nbsp; &amp;nbsp;endif
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;## check if we have to use convert
&lt;br&gt;- &amp;nbsp;dev_list = {&amp;quot;aifm&amp;quot;, &amp;quot;corel&amp;quot;, &amp;quot;fig&amp;quot;, &amp;quot;png&amp;quot;, &amp;quot;pbm&amp;quot;, &amp;quot;dxf&amp;quot;, &amp;quot;mf&amp;quot;, ...
&lt;br&gt;+ &amp;nbsp;dev_list = {&amp;quot;aifm&amp;quot;, &amp;quot;corel&amp;quot;, &amp;quot;fig&amp;quot;, &amp;quot;png&amp;quot;, &amp;quot;pbm&amp;quot;, &amp;quot;dxf&amp;quot;, &amp;quot;mf&amp;quot;, &amp;quot;svg&amp;quot;, ...
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;hpgl&amp;quot;, &amp;quot;ps&amp;quot;, &amp;quot;ps2&amp;quot;, &amp;quot;psc&amp;quot;, &amp;quot;psc2&amp;quot;, &amp;quot;eps&amp;quot;, &amp;quot;eps2&amp;quot;, ...
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;epsc&amp;quot;, &amp;quot;epsc2&amp;quot;, &amp;quot;emf&amp;quot;, &amp;quot;pstex&amp;quot;, &amp;quot;pslatex&amp;quot;, ...
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;epslatex&amp;quot;, &amp;quot;epslatexstandalone&amp;quot;};
&lt;br&gt;@@ -325,11 +333,25 @@ function print (varargin)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;##eval (sprintf (&amp;quot;__gnuplot_set__ term %s mono medium&amp;quot;, dev));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;##endif
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp; &amp;nbsp;new_terminal = &amp;quot;png large&amp;quot;;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if (isempty (size))
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;options = &amp;quot; large&amp;quot;;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;else
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;options = strcat (&amp;quot; size &amp;quot;, size);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;endif
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;new_terminal = strcat (&amp;quot;png&amp;quot;, options);
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;elseif (strcmp (dev, &amp;quot;dxf&amp;quot;) || strcmp (dev, &amp;quot;mf&amp;quot;) || strcmp (dev, &amp;quot;hpgl&amp;quot;))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;## AutoCad DXF, METAFONT, HPGL
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;new_terminal = dev;
&lt;br&gt;+
&lt;br&gt;+ &amp;nbsp;elseif (strcmp (dev, &amp;quot;svg&amp;quot;))
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;## SVG
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;options = &amp;quot;&amp;quot;;
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;if (! isempty (size))
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp;options = strcat (&amp;quot; size &amp;quot;, size);
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;endif
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;new_terminal = strcat (&amp;quot;svg&amp;quot;, options);
&lt;br&gt;+
&lt;br&gt;&amp;nbsp; &amp;nbsp;endif
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;drawnow (new_terminal, name);
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Francesco Potortì (ricercatore) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Voice: +39 050 315 3058 (op.2111)
&lt;br&gt;ISTI - Area della ricerca CNR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Fax: &amp;nbsp; +39 050 315 2040
&lt;br&gt;via G. Moruzzi 1, I-56124 Pisa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Email: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12941618&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Potorti@...&lt;/a&gt;
&lt;br&gt;Web: &lt;a href=&quot;http://fly.isti.cnr.it/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://fly.isti.cnr.it/&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Key: &amp;nbsp; fly.isti.cnr.it/public.key
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12941618&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/print.m%3A-SVG-ans-size-specification-for-PNG-and-SVG-tp12941618p12941618.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-12941453</id>
	<title>SVG in print.m</title>
	<published>2007-09-21T04:59:06Z</published>
	<updated>2007-09-21T04:59:06Z</updated>
	<author>
		<name>Francesco Potortì</name>
	</author>
	<content type="html">This simple patch adds the SVG type to the capabilities of print.m. &amp;nbsp; It
&lt;br&gt;looks longer than necessary because it sorts extensions in alphabetical
&lt;br&gt;order.
&lt;br&gt;&lt;br&gt;--- /home/pot/math/octavelib/utils/myprint.m~	2007-09-21 12:48:05.000000000 +0200
&lt;br&gt;+++ /home/pot/math/octavelib/utils/myprint.m	2007-09-21 12:40:57.000000000 +0200
&lt;br&gt;@@ -69,20 +69,22 @@
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item cdr
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @itemx corel
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; CorelDraw
&lt;br&gt;-## &amp;nbsp; @item hpgl
&lt;br&gt;-## &amp;nbsp; &amp;nbsp; HP plotter language
&lt;br&gt;-## &amp;nbsp; @item fig
&lt;br&gt;-## &amp;nbsp; &amp;nbsp; XFig
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item dxf
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; AutoCAD
&lt;br&gt;+## &amp;nbsp; @item emf
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; Microsoft Enhanced Metafile
&lt;br&gt;+## &amp;nbsp; @item fig
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; XFig
&lt;br&gt;+## &amp;nbsp; @item hpgl
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; HP plotter language
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item mf
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; Metafont
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item png
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; Portable network graphics
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @item pbm
&lt;br&gt;&amp;nbsp;## &amp;nbsp; &amp;nbsp; PBMplus
&lt;br&gt;-## &amp;nbsp; @item emf
&lt;br&gt;-## &amp;nbsp; &amp;nbsp; Microsoft Enhanced Metafile
&lt;br&gt;+## &amp;nbsp; @item svg
&lt;br&gt;+## &amp;nbsp; &amp;nbsp; Scalable vector graphics
&lt;br&gt;&amp;nbsp;## &amp;nbsp; @end table
&lt;br&gt;&amp;nbsp;##
&lt;br&gt;&amp;nbsp;## &amp;nbsp; Other devices are supported by &amp;quot;convert&amp;quot; from ImageMagick. &amp;nbsp;Type
&lt;br&gt;@@ -191,7 +193,7 @@ function print (varargin)
&lt;br&gt;&amp;nbsp; &amp;nbsp;endif
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp;## check if we have to use convert
&lt;br&gt;- &amp;nbsp;dev_list = {&amp;quot;aifm&amp;quot;, &amp;quot;corel&amp;quot;, &amp;quot;fig&amp;quot;, &amp;quot;png&amp;quot;, &amp;quot;pbm&amp;quot;, &amp;quot;dxf&amp;quot;, &amp;quot;mf&amp;quot;, ...
&lt;br&gt;+ &amp;nbsp;dev_list = {&amp;quot;aifm&amp;quot;, &amp;quot;corel&amp;quot;, &amp;quot;fig&amp;quot;, &amp;quot;png&amp;quot;, &amp;quot;pbm&amp;quot;, &amp;quot;dxf&amp;quot;, &amp;quot;mf&amp;quot;, &amp;quot;svg&amp;quot;, ...
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;hpgl&amp;quot;, &amp;quot;ps&amp;quot;, &amp;quot;ps2&amp;quot;, &amp;quot;psc&amp;quot;, &amp;quot;psc2&amp;quot;, &amp;quot;eps&amp;quot;, &amp;quot;eps2&amp;quot;, ...
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;epsc&amp;quot;, &amp;quot;epsc2&amp;quot;, &amp;quot;emf&amp;quot;, &amp;quot;pstex&amp;quot;, &amp;quot;pslatex&amp;quot;, ...
&lt;br&gt;&amp;nbsp;	 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;epslatex&amp;quot;, &amp;quot;epslatexstandalone&amp;quot;};
&lt;br&gt;@@ -327,8 +329,9 @@ function print (varargin)
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;new_terminal = &amp;quot;png large&amp;quot;;
&lt;br&gt;&amp;nbsp;
&lt;br&gt;- &amp;nbsp;elseif (strcmp (dev, &amp;quot;dxf&amp;quot;) || strcmp (dev, &amp;quot;mf&amp;quot;) || strcmp (dev, &amp;quot;hpgl&amp;quot;))
&lt;br&gt;- &amp;nbsp; &amp;nbsp;## AutoCad DXF, METAFONT, HPGL
&lt;br&gt;+ &amp;nbsp;elseif (strcmp (dev, &amp;quot;dxf&amp;quot;) || strcmp (dev, &amp;quot;mf&amp;quot;) ...
&lt;br&gt;+	 &amp;nbsp;|| strcmp (dev, &amp;quot;hpgl&amp;quot;) || strcmp (dev, &amp;quot;svg&amp;quot;))
&lt;br&gt;+ &amp;nbsp; &amp;nbsp;## AutoCad DXF, METAFONT, HPGL, SVG
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;new_terminal = dev;
&lt;br&gt;&amp;nbsp; &amp;nbsp;endif
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Francesco Potortì (ricercatore) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Voice: +39 050 315 3058 (op.2111)
&lt;br&gt;ISTI - Area della ricerca CNR &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Fax: &amp;nbsp; +39 050 315 2040
&lt;br&gt;via G. Moruzzi 1, I-56124 Pisa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Email: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12941453&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Potorti@...&lt;/a&gt;
&lt;br&gt;Web: &lt;a href=&quot;http://fly.isti.cnr.it/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://fly.isti.cnr.it/&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Key: &amp;nbsp; fly.isti.cnr.it/public.key
&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12941453&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/SVG-in-print.m-tp12941453p12941453.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-12803690</id>
	<title>findobj</title>
	<published>2007-09-18T16:53:53Z</published>
	<updated>2007-09-18T16:53:53Z</updated>
	<author>
		<name>Ben Abbott</name>
	</author>
	<content type="html">&lt;br&gt;I tried to post once, but it hasn't gone through yet ... so I'm trying again.
&lt;br&gt;&lt;br&gt;I've written a Octave script that is intended to mirror the functionality of
&lt;br&gt;Matlab's findobj function. 
&lt;br&gt;&lt;br&gt;I'm having some difficulty understanding how the '-logicaloperator' option
&lt;br&gt;is intended to work, but beyond that annoyance, it appears to be working.
&lt;br&gt;I've attached a copy of this 'work in progress'. 
&lt;br&gt;&lt;br&gt;I have a couple of questions. 
&lt;br&gt;&lt;br&gt;(1) Is this something that might be contributed to Octave in general? 
&lt;br&gt;&lt;br&gt;(2) If so, what is the proper procedure? 
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/file/p12767686/findobj.m&quot; target=&quot;_top&quot;&gt;http://www.nabble.com/file/p12767686/findobj.m&lt;/a&gt;&amp;nbsp;findobj.m 
&lt;br&gt;-- 
&lt;br&gt;View this message in context: &lt;a href=&quot;http://www.nabble.com/findobj-tf4477653.html#a12767686&quot; target=&quot;_top&quot;&gt;http://www.nabble.com/findobj-tf4477653.html#a12767686&lt;/a&gt;&lt;br&gt;Sent from the Octave - Sources mailing list archive at Nabble.com.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12803690&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/findobj-tp12803690p12803690.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-12804062</id>
	<title>Re: regression function</title>
	<published>2007-09-07T01:21:45Z</published>
	<updated>2007-09-07T01:21:45Z</updated>
	<author>
		<name>Michael Creel</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;&lt;div&gt;&lt;span class=&quot;gmail_quote&quot;&gt;On 9/7/07, &lt;b class=&quot;gmail_sendername&quot;&gt;Ghassen El Montasser&lt;/b&gt; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12804062&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;g.elmontasser@...&lt;/a&gt;&amp;gt; wrote:&lt;/span&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div&gt;hi,&lt;/div&gt;
&lt;div&gt;I would like to contribute with the function&amp;quot;regression&amp;quot;. This function like ols functions produces &amp;quot;beta&amp;quot;,&amp;quot;sigma&amp;quot; &amp;quot;residus&amp;quot; but besides my function produces the statistics of Student of estimated coefficients and the associated p values(bilateral or one sided tests). The statistics of Student and the p-values are very interesting for the significativity decision of the 
parameters.I believe with the function &amp;quot;regression&amp;quot; , we shall have richer output.&lt;/div&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br&gt;That sounds like a good idea to me. The following gives an idea of what I&amp;#39;d like to see in such a function. Cheers, M&lt;br&gt;&lt;br&gt;# Calculates ordinary LS estimator using the Huber-White heteroscedastic
&lt;br&gt;# consistent variance estimator.&lt;br&gt;&lt;br&gt;function [b, varb, e, ess] = mc_ols(y, x, names, silent, regularvc)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; k = columns(x);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if nargin &amp;lt; 5 regularvc = 0; endif&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if nargin &amp;lt; 4 silent = 0; endif
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (nargin &amp;lt; 3) || (rows(names) != k)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; names = 1:k;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; names = names&amp;#39;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [b, sigsq, e] = ols(y,x);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xx_inv = inv(x&amp;#39;*x);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n = rows(x);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ess = e&amp;#39; * e;
&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Ordinary or het. consistent variance estimate&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if regularvc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; varb = xx_inv*sigsq;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; varb = HetConsistentVariance(x,e);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; seb = sqrt(diag(varb));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; t = b ./ seb;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tss = y - mean(y);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tss = tss&amp;#39; * tss;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rsq = 1 - ess / tss;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; labels = str2mat(&amp;quot;estimate&amp;quot;,&amp;quot;st.err.&amp;quot;, &amp;quot;t-stat.&amp;quot;, &amp;quot;p-value&amp;quot;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if !silent&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;\n*********************************************************\n&amp;quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;OLS estimation results\n&amp;quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;Observations %d\n&amp;quot;,n);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;R-squared %f\n&amp;quot;,rsq);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;Sigma-squared %f\n&amp;quot;,sigsq);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; p = 2 - 2*t_cdf(abs(t), n - k);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; results = [b, seb, t, p];&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if regularvc&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;\nResults (Ordinary var-cov estimator)\n\n&amp;quot;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;\nResults (Het. consistent var-cov estimator)\n\n&amp;quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; endif&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; prettyprint(results, names, labels);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&amp;quot;\n*********************************************************\n&amp;quot;);
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endif&lt;br&gt;endfunction&lt;br&gt;&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12804062&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/regression-function-tp12534592p12804062.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-12534592</id>
	<title>regression function</title>
	<published>2007-09-06T17:48:14Z</published>
	<updated>2007-09-06T17:48:14Z</updated>
	<author>
		<name>Ghassen El Montasser</name>
	</author>
	<content type="html">&lt;div&gt;hi,&lt;/div&gt;
&lt;div&gt;I would like to contribute with the function&amp;quot;regression&amp;quot;. This function like ols functions produces &amp;quot;beta&amp;quot;,&amp;quot;sigma&amp;quot; &amp;quot;residus&amp;quot; but besides my function produces the statistics of Student of estimated coefficients and the associated p values(bilateral or one sided tests). The statistics of Student and the p-values are very interesting for the significativity decision of the 
parameters.I believe with the function &amp;quot;regression&amp;quot; , we shall have richer output.&lt;/div&gt;
&lt;br /&gt;function [beta,sigma,residus,t_student,p_values]=regression(y,x,type)
&lt;br&gt;&lt;br&gt;##########written by Ghassen El Montasser
&lt;br&gt;##########07/9/2007
&lt;br&gt;##########mail:&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12534592&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;g.elmontasser@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;#######input description
&lt;br&gt;#y the vector of dependent variable
&lt;br&gt;#x the matrix of independent variables
&lt;br&gt;#type takes the value of 1 or 2. If 1 we have a one sided &amp;nbsp;test of student on parameters significativity#, if 2 we have bilateral test of individual significativity.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&lt;br&gt;#######output description
&lt;br&gt;#beta like that of ols function in octave(octave manual,Edition 3 for Octave version 2.9.13,p266).
&lt;br&gt;#sigma like that of ols function in octave
&lt;br&gt;#residus like those of ols function in octave
&lt;br&gt;#t_student the vector of calculated student statistics for each estimated coefficient
&lt;br&gt;#p_values the vector of p values associated with calculates student statistics
&lt;br&gt;&lt;br&gt;beta=inv(x'*x)*x'*y;
&lt;br&gt;sigma=(y-x*beta)'*(y-x*beta)/(rows(y)-columns(x));
&lt;br&gt;residus=y-x*beta;
&lt;br&gt;v=diag(sigma*inv(x'*x));
&lt;br&gt;t_student=zeros(columns(x),1);
&lt;br&gt;for i=1:columns(x)
&lt;br&gt;t_student(i)=beta(i)/sqrt(v(i));
&lt;br&gt;endfor
&lt;br&gt;switch type
&lt;br&gt;case { 1 }
&lt;br&gt;p_values=zeros(columns(x),1);
&lt;br&gt;for i=1:columns(x)
&lt;br&gt;p_values(i)=1-tcdf(t_student(i),(rows(y)-columns(x)));
&lt;br&gt;endfor
&lt;br&gt;&amp;nbsp;case { 2 }
&lt;br&gt;p_values=zeros(columns(x),1);
&lt;br&gt;for i=1:columns(x)
&lt;br&gt;p_values(i)=2*(1-tcdf(t_student(i),(rows(y)-columns(x))))
&lt;br&gt;endfor
&lt;br&gt;endswitch
&lt;br&gt;&lt;br&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=12534592&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/regression-function-tp12534592p12534592.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-11865886</id>
	<title>I Wrote a bessel filter function</title>
	<published>2007-07-29T11:27:40Z</published>
	<updated>2007-07-29T11:27:40Z</updated>
	<author>
		<name>Wolfgang Heidrich-2</name>
	</author>
	<content type="html">Dear all,
&lt;br&gt;&lt;br&gt;I used octave to write some code to compute the coefficients of the 
&lt;br&gt;transferfunction of a bessel filter, because I couldn't find these 
&lt;br&gt;coefficients in the web. The reverse bessel polynomial is splitted in 
&lt;br&gt;quadratic terms using the roots() function, I also normalize the function so 
&lt;br&gt;that it is useful for filter design (3dB cutoff at frequency=1*i). Quadratic 
&lt;br&gt;terms are good for designing signal filters with operational amplifiers in 
&lt;br&gt;electrical engineering.
&lt;br&gt;&lt;br&gt;As I'm new to octave I don't know if I did it in the optimal way. On 
&lt;br&gt;&lt;a href=&quot;http://www.hw-loesungen.de/besselfilter.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.hw-loesungen.de/besselfilter.pdf&lt;/a&gt;&amp;nbsp;you can find the mathematical 
&lt;br&gt;background I used to write that code. Here is the code, you can include it in 
&lt;br&gt;Octave.
&lt;br&gt;&lt;br&gt;With this code you can generate the coefficients for bessel filters with as 
&lt;br&gt;many poles as you like, only restricted by numerical accuracy.
&lt;br&gt;&lt;br&gt;Further I would like to thank all people who contributed to octave, it is 
&lt;br&gt;great!
&lt;br&gt;&lt;br&gt;Best,
&lt;br&gt;Wolfgang
&lt;br&gt;-- 
&lt;br&gt;Wolfgang A. Heidrich
&lt;br&gt;&lt;br /&gt;&lt;tt&gt;[bessel.m]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;## Copyright (C) 2007 Wolfgang A. Heidrich
&lt;br&gt;##
&lt;br&gt;## This is free software; you can redistribute it and/or modify it
&lt;br&gt;## under the terms of the GNU General Public License as published by
&lt;br&gt;## the Free Software Foundation; either version 2, or (at your option)
&lt;br&gt;## any later version.
&lt;br&gt;##
&lt;br&gt;## This is distributed in the hope that it will be useful, but
&lt;br&gt;## WITHOUT ANY WARRANTY; without even the implied warranty of
&lt;br&gt;## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &amp;nbsp;See the GNU
&lt;br&gt;## General Public License for more details.
&lt;br&gt;##
&lt;br&gt;&lt;br&gt;## -*- texinfo -*-
&lt;br&gt;## @deftypefn {Function File} {} bessel (@var{n})
&lt;br&gt;##
&lt;br&gt;## For a scalar @var{n}, return
&lt;br&gt;## the coefficients of the quadratic terms of the
&lt;br&gt;## factorized reverse bessel polynomial B(s), normalized so that B(i)=sqrt(2).
&lt;br&gt;## @iftex
&lt;br&gt;## @tex
&lt;br&gt;## $$
&lt;br&gt;## B(s)= (1+a_{1}x+b_{1}x^{2})(1+a_{2}x+b_{2}x^{2})(1+a_{3}x+b_{3}x^{2})\ldots
&lt;br&gt;## $$
&lt;br&gt;## @end tex
&lt;br&gt;## @end iftex
&lt;br&gt;## @ifinfo
&lt;br&gt;##
&lt;br&gt;## @example
&lt;br&gt;## B(s)= (1 + a(1) * x + b(1)*x^2) * (1 + a(2) * x + b(2)*x^2) * ...
&lt;br&gt;## @end example
&lt;br&gt;## @end ifinfo
&lt;br&gt;## @end deftypefn
&lt;br&gt;&lt;br&gt;## Author: Wolfgang Arne Heidrich
&lt;br&gt;## Created: 29 July 2007
&lt;br&gt;## Read http://www.hw-loesungen.de/besselfilter.pdf
&lt;br&gt;## to understand how this code works.
&lt;br&gt;&lt;br&gt;&lt;br&gt;function [a,b] = bessel (arg)
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ( (nargout!=2) || (nargin != 1) || (size(arg)(1)!=1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;	|| (size(arg)(2)!=1)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; usage (&amp;quot;[a,b]=bessel(n) where n is an integer number&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endif
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n=arg(1);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&amp;quot;Bessel polynomial number of poles: %d\n&amp;quot;, n );
&lt;br&gt;%	printf(&amp;quot; %2d */ &amp;quot;, n );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % First we generate the bessel polynomial using the recursive formula
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % v(n-ind+1) = 2*(n-ind+1)*cf/ind/(2*n-ind+1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cz=1;cn=1; % to be calculated coefficients as integernumbers
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cf=1; % to be calculated coefficients as floating numbers
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; puts(&amp;quot;c0=1\nc1=1\n&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; v(n)=1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; v(n+1)=1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ind=2:n
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cz = 2*(n-ind+1)*cz;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cn = ind*(2*n-ind+1)*cn;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cf = 2*(n-ind+1)*cf/ind/(2*n-ind+1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % just for fun we also calculate the fraction with integer
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % numerator cz and demoninator cn
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if( cz&amp;lt;cn ) min=cz; else min=cn; end;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w=sqrt(min)+1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for k=2:w
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while( (rem(cz,k)==0) &amp;&amp; (rem(cn,k)==0) )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cz=cz/k;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cn=cn/k;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % Here I print out the integer numerator cz and demoninator cn,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % that aren't used further.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printf(&amp;quot;c%i=%i/%i=%g\n&amp;quot;, ind, cz, cn,cf );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %v(n-ind+1)=cz/cn;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; v(n-ind+1)=cf;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; puts(&amp;quot;\n&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r=roots(v); % these are the roots of the polynomial
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % Now we want to find the 3dB-Frequency omega of this filter.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % i must be here the imaginary unit sqrt(-1) !
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; omega=0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while( abs(polyval( v,i*omega ) ) &amp;lt; 2 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; omega++;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w2 = sqrt(2);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xa=0;xb=omega;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; diff = 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count=0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while( abs(diff) &amp;gt; 1e-10 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; omega = (xa+xb)/2;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; diff = w2 - abs(polyval( v,i*omega ) );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if( diff &amp;gt; 0 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xa = (xa+xb)/2;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; xb = (xa+xb)/2;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count++;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;%	printf(&amp;quot;3dB-cutoff frequency:%g count:%i erg:%g\n&amp;quot;,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %	omega, count, abs(polyval( v,i*omega )) );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % OK, now we got the n roots of the bessel polynomial. Most of the
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % roots are complex numbers, but for even orders we always have one
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % root with imaginary part = zero. Now we want to determine the quadratic
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % terms: We know: (x-r)(x-~r) = x^2 - 2*x*real(r) + |r|^2
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % And we want this to divide
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % by |r|^2 : (x-r)(x-~r)/(|r|^2) = x^2/(|r|^2) - 2*x*real(r)/(|r|^2) + 1
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % We only take the poles with imgaginary part &amp;gt; 0
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % I assume for conjugated roots in r=roots(v) :
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % 	first comes the root with imaginary part &amp;gt; 0, then 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %	comes the root with imaginary part &amp;lt; 0.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % For other roots we know that the imaginary part is always zero.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % I want to check this, to be sure that we extract only the wanted roots,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % because I don't know if the accuracy of octave or the computer is good
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % enough, so that for example for a noncomplex root the calculated
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % imaginary part really is exact zero.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnt=1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for ind=1:n
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if( imag(r(ind)) &amp;gt; 0 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if( imag(r(ind+1))!=-imag(r(ind)) )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; error(&amp;quot;Expected exact conjugated pole&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % it is fantastic that octave works so accurately,
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % that imag(r(ind+1)) == -imag(r(ind)) exactly !!!
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a(cnt)=-omega*2.0*real(r(ind))/(abs(r(ind))^2);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b(cnt)=omega^2*1.0/(abs(r(ind))^2);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %printf(&amp;quot;a=%.10f b=%.10f\n&amp;quot;, a(cnt), b(cnt) );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %printf(&amp;quot;%.10f,&amp;quot;, a(cnt) );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %printf(&amp;quot;%.10f,&amp;quot;, b(cnt) );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnt++;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if( imag(r(ind)) == 0 )
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; % (x-r)/(-r) = -x/r + 1
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a(cnt) = -omega*1.0/r(ind);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b(cnt)=0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %printf(&amp;quot;a=%.10f b=%.10f\n&amp;quot;, a(cnt), 0 );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %printf(&amp;quot;%.10f,&amp;quot;, a(cnt) );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; %printf(&amp;quot;%.10f,&amp;quot;, 0 );
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cnt++;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; puts(&amp;quot;\n&amp;quot;);
&lt;br&gt;end
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=11865886&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/I-Wrote-a-bessel-filter-function-tp11865886p11865886.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-11865637</id>
	<title>Re: Testing utility</title>
	<published>2007-06-12T21:09:42Z</published>
	<updated>2007-06-12T21:09:42Z</updated>
	<author>
		<name>Paul Kienzle</name>
	</author>
	<content type="html">&lt;br&gt;On Jun 8, 2007, at 4:20 AM, David Bateman wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Olli Saarela wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 'make check' is not necessarily available in a run-time environment. I
&lt;br&gt;&amp;gt;&amp;gt; used the enclosed function when testing the MSCV distribution.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Olli
&lt;br&gt;&amp;gt; Yes but this will only check the tests that are in the m-files. There
&lt;br&gt;&amp;gt; are many tests also embedded in the C++ source code that this will miss
&lt;br&gt;&amp;gt; as the source is not on the path. It will also miss the octave/tests
&lt;br&gt;&amp;gt; directory that includes many tests as well. Really the &amp;quot;make check&amp;quot; is
&lt;br&gt;&amp;gt; for the builder of octave that has a built version of octave in its
&lt;br&gt;&amp;gt; source tree...
&lt;/div&gt;&lt;br&gt;It is easy to grab the C++ tests:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for f in `find octave -name &amp;quot;*.cc&amp;quot; -print | xargs grep -l &amp;quot;^[%][!]&amp;quot;`; 
&lt;br&gt;do
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; out=${f##*/}
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; grep &amp;quot;^[%][!]&amp;quot; $f &amp;gt; test_${out%.cc}.m
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; done
&lt;br&gt;&lt;br&gt;If these were extracted and installed along with the tests in 
&lt;br&gt;octave/test, then you could write testall using something like:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; fns_and_files=completion_matches('test_');
&lt;br&gt;&amp;nbsp; &amp;nbsp; files=regexp(fns_and_files,'[.]m$','lineanchors');
&lt;br&gt;&amp;nbsp; &amp;nbsp; for f = files, test('f'); endfor
&lt;br&gt;&lt;br&gt;Sorry, this is untested --- I don't have 2.9.x on my Mac.
&lt;br&gt;&lt;br&gt;- Paul
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Octave-sources mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=11865637&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Octave-sources@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;https://www.cae.wisc.edu/mailman/listinfo/octave-sources&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Testing-utility-tp11020850p11865637.html" />
</entry>

</feed>
