SCM

SCM Repository

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

Diff of /pkg/Matrix/src/sparseQR.c

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

revision 2868, Sat Feb 2 19:38:06 2013 UTC revision 3105, Fri May 8 06:48:01 2015 UTC
# Line 39  Line 39 
39                      double *y, int *ydims)                      double *y, int *ydims)
40  {  {
41      int j, k, m = V->m, n = V->n;      int j, k, m = V->m, n = V->n;
42      double *x = Alloca(m, double);      /* workspace */      double *x; // workspace
     R_CheckStack();  
43    
44      if (ydims[0] != m)      if (ydims[0] != m)
45          error(_("sparseQR_Qmult(): nrow(y) = %d != %d = nrow(V)"), ydims[0], m);          error(_("sparseQR_Qmult(): nrow(y) = %d != %d = nrow(V)"), ydims[0], m);
46        C_or_Alloca_TO(x, m, double);
47      for (j = 0; j < ydims[1]; j++) {      for (j = 0; j < ydims[1]; j++) {
48          double *yj = y + j * m;          double *yj = y + j * m;
49          if (trans) {          if (trans) {
# Line 58  Line 58 
58              Memcpy(yj, x, m);              Memcpy(yj, x, m);
59          }          }
60      }      }
61        if(m >= SMALL_4_Alloca) Free(x);
62  }  }
63    
64    
# Line 144  Line 145 
145    
146    // FIXME: check  n_R, M (= R->m)   vs  n, m    // FIXME: check  n_R, M (= R->m)   vs  n, m
147      int *q = INTEGER(qslot), lq = LENGTH(qslot), n_R = R->n;      int *q = INTEGER(qslot), lq = LENGTH(qslot), n_R = R->n;
148      double *x = Alloca(M, double);      double *x;
149      R_CheckStack();      C_or_Alloca_TO(x, M, double);
150      for (int j = 0; j < n; j++) {      for (int j = 0; j < n; j++) {
151          double *aj = ax + j * M;          double *aj = ax + j * M;
152          cs_usolve(R, aj);          cs_usolve(R, aj);
# Line 154  Line 155 
155              Memcpy(aj, x, n_R);              Memcpy(aj, x, n_R);
156          }          }
157      }      }
158        if(M >= SMALL_4_Alloca) Free(x);
159    
160      if(rank_def) {      if(rank_def) {
161          warning(_("%s(): structurally rank deficient case: possibly WRONG zeros"),          warning(_("%s(): structurally rank deficient case: possibly WRONG zeros"),

Legend:
Removed from v.2868  
changed lines
  Added in v.3105

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