Skip to content

Commit 45d8dec

Browse files
committed
try to coorect of size of block matrix ( 0 expression => size never null)
1 parent edd62bf commit 45d8dec

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/fflib/lgmat.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,10 +2778,13 @@ template<typename R> AnyType BlockMatrix<R>::operator()(Stack s) const
27782778

27792779
cnjij = false;
27802780
KN<long> Oi(N+1), Oj(M+1);
2781+
KN<bool> Zi(N,false), Zj(M,false);
2782+
27812783
if(verbosity>9) { cout << " Build Block Matrix : " << N << " x " << M << endl;}
27822784
Bij = (L) 0;
27832785
Oi = (long) 0;
27842786
Oj = (long)0;
2787+
27852788
for (int i=0;i<N;++i)
27862789
for (int j=0;j<M;++j)
27872790
{
@@ -2818,7 +2821,8 @@ template<typename R> AnyType BlockMatrix<R>::operator()(Stack s) const
28182821
nm = get_NM( *Bij(i,j));
28192822
else if(Fij(i,j))
28202823
nm = make_pair<long,long>(Fij(i,j)->N(), Fij(i,j)->M());
2821-
2824+
else
2825+
Zi(i)=Zj(j)=true;
28222826
if (( nm.first || nm.second) && verbosity>3)
28232827
cout << " Block [ " << i << "," << j << " ] = " << nm.first << " x " << nm.second << " cnj = " << cnjij(i,j) << endl;
28242828
if (nm.first)
@@ -2845,22 +2849,20 @@ template<typename R> AnyType BlockMatrix<R>::operator()(Stack s) const
28452849

28462850
if (err) ExecError("Error Block Matrix, size sub matrix");
28472851
// gestion of zero block ????
2848-
/* remove for block of size 0 june 13 2025 PHT and FH
2852+
/* remove for block of size 0 june 13 2025 PHT and FH */
28492853
for (int j=0;j<M;++j)
28502854
{ if(verbosity>99) cout << j << " column size" << Oj(j+1) << endl;
2851-
if ( Oj(j+1) ==0) {
2855+
if ( Oj(j+1) ==0 && Zj(j))
28522856
Oj(j+1)=1;
2853-
if( Oj(j+1) !=1) err++;}
2857+
28542858
}
28552859
for (int i=0;i<N;++i)
28562860
{
28572861
if(verbosity>99) cout << i << " row size" << Oi(i+1) << endl;
2858-
if ( Oi(i+1) ==0) {
2862+
if ( Oi(i+1) ==0 && Zi(i))
28592863
Oi(i+1)=1;
2860-
if( Oi(i+1) !=1) err++;}
28612864
}
2862-
if (err) ExecError("Error Block Matrix with 0 line or 0 colomn..");
2863-
*/
2865+
28642866
for (int i=0;i<N;++i)
28652867
Oi(i+1) += Oi(i);
28662868
for (int j=0;j<M;++j) // correct 10/01/2007 FH

0 commit comments

Comments
 (0)