The R Project SVN R

Rev

Rev 59039 | Rev 72229 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59039 Rev 60327
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 
3
 
4
 *  Copyright (C) 1994-9 W. N. Venables and B. D. Ripley
4
 *  Copyright (C) 1994-9 W. N. Venables and B. D. Ripley
5
 *  Copyright (C) 2007-2007  The R Core Team
5
 *  Copyright (C) 2007-12  The R Core Team
6
 *
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  (at your option) any later version.
10
 *  (at your option) any later version.
Line 38... Line 38...
38
 
38
 
39
#define RELTOL 1e-5
39
#define RELTOL 1e-5
40
 
40
 
41
void R_max_col(double *matrix, int *nr, int *nc, int *maxes, int *ties_meth)
41
void R_max_col(double *matrix, int *nr, int *nc, int *maxes, int *ties_meth)
42
{
42
{
43
    int	  r, c, m, n_r = *nr;
43
    int	  r, c, m;
-
 
44
    size_t  n_r = *nr; // for indexing like r + c * n_r
44
    double a, b, large;
45
    double a, b, large;
45
    Rboolean isna,
-
 
46
	used_random = FALSE,
-
 
47
	do_rand = *ties_meth == 1;
46
    Rboolean isna, used_random = FALSE, do_rand = *ties_meth == 1;
48
 
47
 
49
    for (r = 0; r < n_r; r++) {
48
    for (r = 0; r < n_r; r++) {
50
	/* first check row for any NAs and find the largest abs(entry) */
49
	/* first check row for any NAs and find the largest abs(entry) */
51
	large = 0.0;
50
	large = 0.0;
52
	isna = FALSE;
51
	isna = FALSE;