This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Permutations


Alberto Manuel Brandão Simões writes:
 >  What's the correct way to construct a permutation? To access the
 > memory directly, or there is any non-documented function to put
 > elements at specific locations?
 >  If the solution is to access memory... linear buffer?

If you start from the identity permutation there's a swap function for
exchanging elements.  Otherwise you have to directly into the data[]
array.  If you plan to do this extensively define a macro like,

    #define PERM_SET(p,i,k) ((p)->data[(i)]=(k)) 

in case you need to change things later.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]