File tree Expand file tree Collapse file tree
include/Rcpp/sugar/matrix Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 2026-09-22 Iñaki Ucar <iucar@fedoraproject.org>
2+
3+ * inst/include/Rcpp/sugar/matrix/col.h: Fix Col constructor using ncol()
4+ instead of nrow() to set the number of rows
5+ * inst/tinytest/test_sugar.R: Add a non-square matrix test case for the
6+ row()/col() sugar functions
7+
182026-09-05 Iñaki Ucar <iucar@fedoraproject.org>
29
310 * .github/workflows/werror.yaml: Add -Wconversion
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class Col : public MatrixBase<
3535public:
3636 typedef Rcpp::MatrixBase<RTYPE ,LHS_NA ,LHS_T > LHS_TYPE ;
3737
38- Col ( const LHS_TYPE & lhs) : nr( static_cast <int >(lhs.ncol ()) ), nc( static_cast <int >(lhs.ncol()) ) {}
38+ Col ( const LHS_TYPE & lhs) : nr( static_cast <int >(lhs.nrow ()) ), nc( static_cast <int >(lhs.ncol()) ) {}
3939
4040 inline int operator ()( int /* i*/ , int j ) const {
4141 return j + 1 ;
Original file line number Diff line number Diff line change @@ -592,6 +592,14 @@ target <- list( row = row(m), col = col(m) )
592592expect_equal( res , target )
593593
594594
595+ # test.sugar.matrix.row.nonsquare <- function( ){
596+ fx <- runit_row
597+ m <- matrix (1 : 24 , nrow = 6 , ncol = 4 )
598+ res <- fx(m )
599+ target <- list (row = row(m ), col = col(m ))
600+ expect_equal(res , target )
601+
602+
595603# test.sugar.diag <- function( ){
596604fx <- runit_diag
597605
You can’t perform that action at this time.
0 commit comments