SCM

SCM Repository

[matrix] Diff of /pkg/Matrix/src/Mutils.h
ViewVC logotype

Diff of /pkg/Matrix/src/Mutils.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 536, Thu Feb 10 08:15:12 2005 UTC revision 565, Tue Feb 22 01:15:45 2005 UTC
# Line 161  Line 161 
161    
162  #endif  #endif
163    
164    
165    /**
166     * Apply a permutation to an integer vector
167     *
168     * @param i vector of 0-based indices
169     * @param n length of vector i
170     * @param perm 0-based permutation vector of length max(i) + 1
171     */
172    static R_INLINE void
173    int_permute(int i[], int n, const int perm[])
174    {
175        int j;
176        for (j = 0; j < n; j++) i[j] = perm[i[j]];
177    }
178    
179    /**
180     * Force index pairs to be in the upper triangle of a matrix
181     *
182     * @param i vector of 0-based row indices
183     * @param j vector of 0-based column indices
184     * @param nnz length of index vectors
185     */
186    static R_INLINE void
187    make_upper_triangular(int i[], int j[], int nnz)
188    {
189        int k;
190        for (k = 0; k < nnz; k++) {
191            if (i[k] > j[k]) {
192                int tmp = i[k];
193                i[k] = j[k];
194                j[k] = tmp;
195            }
196        }
197    }

Legend:
Removed from v.536  
changed lines
  Added in v.565

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge