Issue #49 wontfix

bug in mzd_from_jcf()

christian holata
created an issue

in the documentation for mzd_from_jcf() it says

"where a negative column_index indicates a row increase by one."

but in the code a negative column_index gets just multiplied by -1 ... so if i got a 1000x1000 matrix i would need to use -1001 as a new-row-indicator.

i guess in io.c it should read

while(fscanf(fh,"%ld\n",&j)==1){
 if(j<0){
  i++;
 }

or

while(fscanf(fh,"%ld\n",&j)==1){
 if(j<0){
  i++;
 }else{
  mzd_write_bit(A, i, j, 1);
 }
};

instead of

while(fscanf(fh,"%ld\n",&j)==1){
 if(j<0){
  i++, j = -j;
 }

Comments (10)

  1. christian holata reporter

    in order to produce a pure-zero row in a 65000by65000 matrix you would still need to use "-65001" as a newline indicator? because just using -1 would create an entry at index +1 ... seems weird to me :-) either i still got it wrong or ill stick with my change :P

  2. Martin Albrecht repo owner

    As far as I know this format does not support pure-zero rows. The format is optimised for matrices destined for Gaussian elimination (from GB computations) and hence zero rows are redundant.

  3. christian holata reporter

    in the a-matrix zero rows make little sense, true ... but most solvers just ignore them and sometimes the input contains nodes that do not relate to other nodes which you would need to filter out before using m4ri.

    but what about a left-hand-side matrix/b-matrix with a width of 1? clearly it can have rows with just a zero. so you would need -2 as a row seperator/new row sign?

  4. Martin Albrecht repo owner

    As far as I know this input format does not support all zero rows. The function is for reading matrices provided by Jean-Charles Faugère, hence the name, and as far as I can tell he does not consider all zero rows. The general purpose I/O format for M4RI are 1-bit PNG images.

  5. christian holata reporter

    sorry i mean right-hand-side in the previous post. how would the JCF file for the right hand side of the following problem look like? currently you would need something like

    5 1 2

    5

    -99

    -99

    0

    -99

    0

    -99

    -99

    1 0 0 0 0 | 0

    0 1 0 0 1 | 0

    0 0 1 1 0 | 1

    0 0 0 1 1 | 1

    0 0 0 0 1 | 0

    even "-0" as a new-row-indicator makes little sense so a row with a 1 just at index 0 gives problems? i understand why the format would not need all zero rows for the left matrix but in the right matrix/vector there are zero rows most time.

    but ill stick with PNG ;-)

  6. Log in to comment