4 From d253f645f0bfbcd2c818fa5d0a6970c61f39c6b5 Mon Sep 17 00:00:00 2001
5 From: Thomas Dickerson <elfprince13@gmail.com>
6 Date: Thu, 12 May 2022 14:28:41 -0400
7 Subject: [PATCH] Repair sparse_matrix.hpp
9 Unclear why nobody has noticed
for a decade that
this code was just totally uncompilable. `SparseMatrix` does not have methods `Columns()` or `Rows()`, and `m_ppElements[i]` is a pointer so can
't possibly have anything called with `.`.
11 .../3rdparty/poisson4/sparse_matrix.hpp | 18 +++++++++---------
12 1 file changed, 9 insertions(+), 9 deletions(-)
14 Index: pcl-1.12.1+dfsg/surface/include/pcl/surface/3rdparty/poisson4/sparse_matrix.hpp
15 ===================================================================
16 --- pcl-1.12.1+dfsg.orig/surface/include/pcl/surface/3rdparty/poisson4/sparse_matrix.hpp
17 +++ pcl-1.12.1+dfsg/surface/include/pcl/surface/3rdparty/poisson4/sparse_matrix.hpp
18 @@ -250,9 +250,9 @@ namespace pcl
20 SparseMatrix<T>& SparseMatrix<T>::operator *= (const T& V)
22 - for (int i=0; i<this->Rows(); i++)
23 + for (int i=0; i<rows; i++)
25 - for(int ii=0;ii<m_ppElements[i].size();ii++){m_ppElements[i][ii].Value*=V;}
26 + for(int ii=0;ii<rowSizes[i];ii++){m_ppElements[i][ii].Value*=V;}
30 @@ -260,12 +260,12 @@ namespace pcl
32 SparseMatrix<T> SparseMatrix<T>::Multiply( const SparseMatrix<T>& M ) const
34 - SparseMatrix<T> R( this->Rows(), M.Columns() );
35 - for(int i=0; i<R.Rows(); i++){
36 - for(int ii=0;ii<m_ppElements[i].size();ii++){
37 + SparseMatrix<T> R( rows, M._maxEntriesPerRow );
38 + for(int i=0; i<rows; i++){
39 + for(int ii=0;ii<rowSizes[i];ii++){
40 int N=m_ppElements[i][ii].N;
41 T Value=m_ppElements[i][ii].Value;
42 - for(int jj=0;jj<M.m_ppElements[N].size();jj++){
43 + for(int jj=0;jj<M.rowSizes[N];jj++){
44 R(i,M.m_ppElements[N][jj].N) += Value * M.m_ppElements[N][jj].Value;
47 @@ -319,11 +319,11 @@ namespace pcl
49 SparseMatrix<T> SparseMatrix<T>::Transpose() const
51 - SparseMatrix<T> M( this->Columns(), this->Rows() );
52 + SparseMatrix<T> M( _maxEntriesPerRow, rows );
54 - for (int i=0; i<this->Rows(); i++)
55 + for (int i=0; i<rows; i++)
57 - for(int ii=0;ii<m_ppElements[i].size();ii++){
58 + for(int ii=0;ii<rowSizes[i];ii++){
59 M(m_ppElements[i][ii].N,i) = m_ppElements[i][ii].Value;