pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@postgresql.org
Subject: Re: pgsql: Avoid use of float arithmetic in bipartite_match.c.
Date: Sun, 23 Aug 2015 19:25:46 +0200
Message-ID: <20150823172546.GI8552@awork2.anarazel.de> (raw)
In-Reply-To: <E1ZTYfD-0005B0-4M@gemulon.postgresql.org>
References: <E1ZTYfD-0005B0-4M@gemulon.postgresql.org>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Hi,

On 2015-08-23 17:02:35 +0000, Tom Lane wrote:
> Avoid use of float arithmetic in bipartite_match.c.
> 
> Since the distances used in this algorithm are small integers (not more
> than the size of the U set, in fact), there is no good reason to use float
> arithmetic for them.  Use short ints instead: they're smaller, faster, and
> require no special portability assumptions.

Yea, makes sense. Thanks.

> In passing, make a few other small adjustments to make the code match
> usual Postgres coding style a bit better.

Not sure why you replaced n by k? Anyway, it's not a complete
replacement afaics:
 /*
  * Given a bipartite graph consisting of nodes U numbered 1..nU, nodes V
  * numbered 1..nV, and an adjacency map of undirected edges in the form
- * adjacency[u] = [n, v1, v2, v3, ... vn], we wish to find a "maximum
+ * adjacency[u] = [k, v1, v2, v3, ... vk], we wish to find a "maximum
  * cardinality matching", which is defined as follows: a matching is a subset
  * of the original edges such that no node has more than one edge, and a
  * matching has maximum cardinality if there exists no other matching with a

the nodes are 1..n, so the adjacency list should be as well (or the
other way round).

Andres


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



view thread (5+ messages)  latest in thread

Message-ID: <20150823172546.GI8552@awork2.anarazel.de>
Permalink:  ../20150823172546.GI8552@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20150823172546.GI8552@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid use of float arithmetic in bipartite_match.c.
  In-Reply-To: <20150823172546.GI8552@awork2.anarazel.de>
  References: <E1ZTYfD-0005B0-4M@gemulon.postgresql.org> <20150823172546.GI8552@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox