From help-octave-request at bevo dot che dot wisc dot edu Tue Jun 15 22:34:50 1999 Subject: Re: stack and append From: heberf at calvin dot wustl dot edu To: octave Date: Tue, 15 Jun 1999 22:36:20 -0500 (CDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime at docserver dot cac dot washington dot edu for more info. ---2137254918-604406821-929504180=:4814 Content-Type: TEXT/PLAIN; charset=US-ASCII I figured out the stack and append thing and then noticed on the list archive that JWE had commented that insert would be more efficient. Boy did he turn out to be right. Eduardo Gallestey suggested a faster way to write the m-file. The oct-file using stack and append gives about the same speed improvement as Eduardo's suggestion (a little faster than Edwardos m-file but not much). Attached is the function using insert. It's MUCH faster than any of the above (the cputime is less than 1/10 that of kron.m) and really simple. However if anyone can suggest an even better way I'll take it. If not I'll post this to the octave-sources list. Heber On Tue, 15 Jun 1999, heberf wrote: > I need a faster implementation of the kronecker product. The one that comes > with octave is in linear-algebra/kron.m and it's not suitable for me because my > problem involves many large matrices. I'm trying to rewrite it as an oct file. > > A few weeks ago there was some discussion on this list of using stack and append > as defined in dMatrix.h. I'm pretty poor at C++ and I can't tell from reading > that file how to implement it. Could someone point out a function where either > of these are used or send a few lines of an oct file so I can see how to do it? > > Much thanks, > Heber Farnsworth > > > > --------------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. To ensure > that development continues, see www.che.wisc.edu/octave/giftform.html > Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html > --------------------------------------------------------------------- > > ---2137254918-604406821-929504180=:4814 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="newkron.cc" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: oct file for kron Content-Disposition: attachment; filename="newkron.cc" I2luY2x1ZGUgPG9jdGF2ZS9vY3QuaD4NCiNpbmNsdWRlICJjb25maWcuaCIN CiNpbmNsdWRlICJvY3Qtb2JqLmgiDQojaW5jbHVkZSAib2N0LW1hcC5oIg0K I2luY2x1ZGUgImRlZnVuLWRsZC5oIg0KI2luY2x1ZGUgInRvcGxldi5oIg0K DQpERUZVTl9ETEQgKG5ld2tyb24sIGFyZ3MsICwiRmFzdGVyIEtyb25lY2tl ciBQcm9kdWN0IikNCnsNCg0KICBvY3RhdmVfdmFsdWVfbGlzdCByZXR2YWw7 DQoNCiAgTWF0cml4IEEgPSBhcmdzKDApLm1hdHJpeF92YWx1ZSgpOw0KICBN YXRyaXggQiA9IGFyZ3MoMSkubWF0cml4X3ZhbHVlKCk7DQogIA0KICBpbnQg cmEgPSBBLnJvd3MoKTsNCiAgaW50IGNhID0gQS5jb2x1bW5zKCk7DQogIGlu dCByYiA9IEIucm93cygpOw0KICBpbnQgY2IgPSBCLmNvbHVtbnMoKTsNCiAg aW50IHIgPSByYSpyYjsNCiAgaW50IGMgPSBjYSpjYjsNCiAgTWF0cml4IHRt cG1hdChyYixjYiwwKTsNCiAgTWF0cml4IEMocixjLDApOw0KICBmb3IgKGlu dCBpPTA7IGk8cmE7IGkrKykNCiAgICB7DQogICAgICBmb3IgKGludCBqPTA7 IGo8Y2E7IGorKykNCgl7DQoJICB0bXBtYXQgPSBBKGksaikqQjsNCgkgIEMg PSBDLmluc2VydCh0bXBtYXQsaSpyYixqKmNiKTsNCgl9DQogICAgfQ0KICBy ZXR2YWwoMCkgPSBvY3RhdmVfdmFsdWUoQyk7DQpyZXR1cm4gcmV0dmFsOw0K DQp9DQo= ---2137254918-604406821-929504180=:4814-- --------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. To ensure that development continues, see www.che.wisc.edu/octave/giftform.html Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html ---------------------------------------------------------------------