~ubuntu-branches/ubuntu/trusty/r-cran-rcpparmadillo/trusty-proposed

« back to all changes in this revision

Viewing changes to inst/include/armadillo_bits/fn_rank.hpp

  • Committer: Package Import Robot
  • Author(s): Dirk Eddelbuettel
  • Date: 2014-01-05 07:49:39 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20140105074939-dwxho57ujap094yj
Tags: 0.4.000-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (C) 2009-2011 Conrad Sanderson
2
 
// Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
 
1
// Copyright (C) 2009-2013 Conrad Sanderson
 
2
// Copyright (C) 2009-2013 NICTA (www.nicta.com.au)
3
3
// Copyright (C) 2009-2010 Dimitrios Bouzas
4
4
// Copyright (C) 2011 Stanislav Funiak
5
5
// 
33
33
  uword  X_n_cols;
34
34
  Col<T> s;
35
35
  
36
 
  const bool  status = auxlib::svd(s, X, X_n_rows, X_n_cols);
 
36
  const bool  status = auxlib::svd_dc(s, X, X_n_rows, X_n_cols);
37
37
  const uword n_elem = s.n_elem;
38
38
  
39
39
  if(status == true)
45
45
    
46
46
    // count non zero valued elements in s
47
47
    
48
 
    const T*  s_mem  = s.memptr();
49
 
          uword count  = 0;
 
48
    const T* s_mem = s.memptr();
 
49
    
 
50
    uword count = 0;
50
51
    
51
52
    for(uword i=0; i<n_elem; ++i)
52
53
      {
53
 
      if(s_mem[i] > tol)
54
 
        {
55
 
        ++count;
56
 
        }
 
54
      if(s_mem[i] > tol) { ++count; }
57
55
      }
58
56
    
59
57
    return count;