| 49 | } ; |
| 50 | |
| 51 | class no_init_matrix { |
| 52 | public: |
| 53 | no_init_matrix(int nr_, int nc_): nr(nr_), nc(nc_) {} |
| 54 | |
| 55 | inline int nrow() const { |
| 56 | return nr; |
| 57 | } |
| 58 | |
| 59 | inline int ncol() const { |
| 60 | return nc; |
| 61 | } |
| 62 | |
| 63 | template <int RTYPE, template <class> class StoragePolicy > |
| 64 | operator Matrix<RTYPE, StoragePolicy>() const { |
| 65 | // Explicitly protect temporary matrix to avoid false positive |
| 66 | // with rchk (#892) |
| 67 | Shield<SEXP> x(Rf_allocMatrix(RTYPE, nr, nc)); |
| 68 | Matrix<RTYPE, PreserveStorage> ret(x); |
| 69 | return ret; |
| 70 | } |
| 71 | |
| 72 | private: |
| 73 | int nr; |
| 74 | int nc; |
| 75 | } ; |
| 76 | |
| 77 | inline no_init_vector no_init(R_xlen_t size) { |
| 78 | return no_init_vector(size); |