SCM

SCM Repository

[matrix] Diff of /pkg/src/bCrosstab.c
ViewVC logotype

Diff of /pkg/src/bCrosstab.c

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

revision 463, Sat Jan 29 14:11:34 2005 UTC revision 464, Sat Jan 29 14:12:53 2005 UTC
# Line 27  Line 27 
27  }  }
28    
29  /**  /**
30   * Calculate the zero-based index in a row-wise packed lower   * Calculate the zero-based index in a row-wise packed lower triangular matrix.
31   * triangular matrix.  This is used for the arrays of blocked sparse matrices.   * This is used for the arrays of blocked sparse matrices.
32   *   *
33   * @param i row number (0-based)   * @param i column number (zero-based)
34   * @param k column number (0-based)   * @param k row number (zero-based)
35   *   *
36   * @return The 0-based index of the (i,k) element of a row-wise packed lower   * @return The index of the (k,i) element of a packed lower triangular matrix
  * triangular matrix.  
37   */   */
38  static R_INLINE int  static R_INLINE
39  Lind(int i, int k)  int Lind(int k, int i)
40  {  {
41      return (i * (i + 1))/2 + k;      if (k < i) error("Lind(k = %d, i = %d) must have k >= i", k, i);
42        return (k * (k + 1))/2 + i;
43  }  }
44    
45  /**  /**

Legend:
Removed from v.463  
changed lines
  Added in v.464

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