SCM

SCM Repository

[bigmemory] Diff of /pkg/bigalgebra/src/bigalgebra.cpp
ViewVC logotype

Diff of /pkg/bigalgebra/src/bigalgebra.cpp

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

revision 470, Mon Sep 8 14:46:33 2014 UTC revision 471, Tue Nov 25 19:35:57 2014 UTC
# Line 25  Line 25 
25                        SEXP BETA, SEXP C, SEXP LDC, SEXP A_isBM, SEXP B_isBM,                        SEXP BETA, SEXP C, SEXP LDC, SEXP A_isBM, SEXP B_isBM,
26                        SEXP C_isBM, SEXP C_offset);                        SEXP C_isBM, SEXP C_offset);
27    SEXP daxpy_wrapper (SEXP N, SEXP A, SEXP X, SEXP Y, SEXP X_isBM);    SEXP daxpy_wrapper (SEXP N, SEXP A, SEXP X, SEXP Y, SEXP X_isBM);
28      SEXP dadd(SEXP N, SEXP ALPHA, SEXP Y, SEXP Y_isBM, SEXP SIGN, SEXP ALPHA_LHS);
29    
30  #ifdef __cplusplus  #ifdef __cplusplus
31  }  }
# Line 157  Line 158 
158    unprotect(2);    unprotect(2);
159    return ans;    return ans;
160  }  }
161    
162    // Note that the following two functions should be updated to use
163    // the proper BLAS functions.
164    SEXP
165    dadd(SEXP N, SEXP ALPHA, SEXP Y, SEXP Y_isBM, SEXP SIGN, SEXP ALPHA_LHS) {
166      SEXP ans;
167      double *pY;
168      INT NN = (INT) * (DOUBLE_DATA(N));
169      double alpha = *(DOUBLE_DATA(ALPHA));
170      int alpha_lhs = *(INTEGER_DATA(ALPHA_LHS));
171      double sign = *(DOUBLE_DATA(SIGN));
172      pY = make_double_ptr(Y, Y_isBM);
173      PROTECT(ans = Y);
174      if (alpha_lhs)
175      {
176        for (INT i=0; i < NN; ++i)
177        {
178          pY[i] = alpha + sign * pY[i];
179        }
180      }
181      else
182      {
183        for (INT i=0; i < NN; ++i)
184        {
185          pY[i] += sign*alpha;
186        }
187      }
188      unprotect(1);
189      return ans;
190    }

Legend:
Removed from v.470  
changed lines
  Added in v.471

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