octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GCD -> NDArrays, Matlab compatiable?


From: David Bateman
Subject: GCD -> NDArrays, Matlab compatiable?
Date: Wed, 14 Apr 2004 15:04:15 +0200
User-agent: Mutt/1.4.1i

In my efforts to convert things to be compatiable with NDArrays, I picked
on the gcd.m and lcm.m files. Basically not only are these candidates for
conversion for use with NDArrays, but they are also not comaptiable with
their equivalent matlab versions at the moment.

Also when considering the conversion for NDArrays I saw no way to avoid
for-loops in the dot-m files. Therefore I tried converting the gcd function
to be an oct-file and will rewrite lcm.m to use this.

I've attemptted to maintain compatiably with both the old octave version
and the matlab code, but it goes beyond both. Like the old octave code
any number of input args is valid, except now the args can be integer
scalars or arrays. Likewise if all args are scalar or a single argument
is given, then the previous behaviour of "[g,v] = gcd(...)" will be obtained.

However, like the matlab version the output variable "v" can now be
broken down into its components like "[g,v1,v2,...,vk] =
gcd(a1,a2,...,ak)", this holds even in a case like "[g,v1,v2] =
gcd(15,20)". In this manner compatiablity with both the old octave code
and matlab is achieved.

Does anyone see any objection to removing the old gcd.m code and using the
attached oct-file instead? If not, John would you accept this if I rewrote
it as a patch?

Cheers
David


-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

Attachment: gcd.cc
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]