1- // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2- //
1+
32// SubMatrix.h: Rcpp R/C++ interface class library -- sub matrices
43//
54// Copyright (C) 2010 - 2013 Dirk Eddelbuettel and Romain Francois
@@ -40,8 +39,8 @@ class SubMatrix : public Rcpp::MatrixBase< RTYPE, true, SubMatrix<RTYPE> > {
4039 {}
4140
4241 inline R_xlen_t size () const { return ((R_xlen_t)ncol ()) * nrow () ; }
43- inline int ncol () const { return nc ; }
44- inline int nrow () const { return nr ; }
42+ inline R_xlen_t ncol () const { return nc ; }
43+ inline R_xlen_t nrow () const { return nr ; }
4544
4645 inline Proxy operator ()(int i, int j) const {
4746 return iter[ i + j*m_nr ] ;
@@ -52,16 +51,16 @@ class SubMatrix : public Rcpp::MatrixBase< RTYPE, true, SubMatrix<RTYPE> > {
5251private:
5352 MATRIX& m ;
5453 vec_iterator iter ;
55- int m_nr, nc, nr ;
54+ R_xlen_t m_nr, nc, nr ;
5655} ;
5756
5857template <int RTYPE, template <class > class StoragePolicy >
59- Matrix<RTYPE,StoragePolicy>::Matrix( const SubMatrix<RTYPE>& sub ) : VECTOR( Rf_allocMatrix( RTYPE, sub.nrow(), sub.ncol() )), nrows(sub.nrow()) {
60- int nc = sub.ncol () ;
58+ Matrix<RTYPE,StoragePolicy>::Matrix( const SubMatrix<RTYPE>& sub ) : VECTOR( Rf_allocMatrix( RTYPE, ( int ) sub.nrow(), ( int ) sub.ncol() )), nrows(( int ) sub.nrow()) {
59+ R_xlen_t nc = sub.ncol () ;
6160 iterator start = VECTOR::begin () ;
6261 iterator rhs_it ;
63- for ( int j=0 ; j<nc; j++){
64- rhs_it = sub.column_iterator (j) ;
62+ for ( R_xlen_t j=0 ; j<nc; j++){
63+ rhs_it = sub.column_iterator (( int ) j) ;
6564 for ( int i=0 ; i<nrows; i++, ++start){
6665 *start = rhs_it[i] ;
6766 }
0 commit comments