* Patch for a permutation function @ 2002-12-31 9:55 Nicolas Darnis 2002-06-26 14:58 ` Nicolas Darnis 2002-12-31 9:55 ` Brian Gough 0 siblings, 2 replies; 4+ messages in thread From: Nicolas Darnis @ 2002-12-31 9:55 UTC (permalink / raw) To: gsl-discuss Hi, the gsl_permutation_canonical_cycles (const gsl_permutation * p) function is erroenous, this is the correct one: size_t gsl_permutation_canonical_cycles (const gsl_permutation * p) { size_t i; size_t count = 1; size_t min = p->data[0]; for (i = 0; i < p->size; i++) { if (p->data[i] >= min) { min = p->data[i]; count++; } } return count; } The if (p->data[i] < min) was the error. Enjoy, -- Nicolas Darnis mailto:ndarnis@cvf.fr work phone: (+33) 05 56 01 98 34 GPG 0x6B794D9E: 051F 3035 0183 A6DD 2701 A773 EE05 821E 6B79 4D9E ^ permalink raw reply [flat|nested] 4+ messages in thread
* Patch for a permutation function 2002-12-31 9:55 Patch for a permutation function Nicolas Darnis @ 2002-06-26 14:58 ` Nicolas Darnis 2002-12-31 9:55 ` Brian Gough 1 sibling, 0 replies; 4+ messages in thread From: Nicolas Darnis @ 2002-06-26 14:58 UTC (permalink / raw) To: gsl-discuss Hi, the gsl_permutation_canonical_cycles (const gsl_permutation * p) function is erroenous, this is the correct one: size_t gsl_permutation_canonical_cycles (const gsl_permutation * p) { size_t i; size_t count = 1; size_t min = p->data[0]; for (i = 0; i < p->size; i++) { if (p->data[i] >= min) { min = p->data[i]; count++; } } return count; } The if (p->data[i] < min) was the error. Enjoy, -- Nicolas Darnis mailto:ndarnis@cvf.fr work phone: (+33) 05 56 01 98 34 GPG 0x6B794D9E: 051F 3035 0183 A6DD 2701 A773 EE05 821E 6B79 4D9E ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch for a permutation function 2002-12-31 9:55 Patch for a permutation function Nicolas Darnis 2002-06-26 14:58 ` Nicolas Darnis @ 2002-12-31 9:55 ` Brian Gough 2002-06-30 3:19 ` Brian Gough 1 sibling, 1 reply; 4+ messages in thread From: Brian Gough @ 2002-12-31 9:55 UTC (permalink / raw) To: gsl-discuss Nicolas Darnis writes: > Hi, > > the gsl_permutation_canonical_cycles (const gsl_permutation * p) > function > is erroenous, this is the correct one: > There was a different convention in use -- it is based on Knuth's convention so the ordering is different. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Patch for a permutation function 2002-12-31 9:55 ` Brian Gough @ 2002-06-30 3:19 ` Brian Gough 0 siblings, 0 replies; 4+ messages in thread From: Brian Gough @ 2002-06-30 3:19 UTC (permalink / raw) To: gsl-discuss Nicolas Darnis writes: > Hi, > > the gsl_permutation_canonical_cycles (const gsl_permutation * p) > function > is erroenous, this is the correct one: > There was a different convention in use -- it is based on Knuth's convention so the ordering is different. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-06-27 17:55 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-12-31 9:55 Patch for a permutation function Nicolas Darnis 2002-06-26 14:58 ` Nicolas Darnis 2002-12-31 9:55 ` Brian Gough 2002-06-30 3:19 ` Brian Gough
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).