<div dir="ltr"><div dir="ltr"><div class="gmail-markdown-here-wrapper"><p style="margin:0px 0px 1.2em">Hi, </p>
<p style="margin:0px 0px 1.2em">I ran ex10 from /vec/examples/tutorials and saved the matrix in binary format.</p>
<p style="margin:0px 0px 1.2em">Looking at the matrix in binary using xxd, I see </p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;background-color:rgb(248,248,248);white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block">[sajid@xrm temp]$ xxd -b vector.dat
0000000: 00000000 00010010 01111011 01001110 00000000 00000000 ..{N..
0000006: 00000000 00010100 00000000 00000000 00000000 00000000 ......
000000c: 00000000 00000000 00000000 00000000 00111111 11110000 ....?.
0000012: 00000000 00000000 00000000 00000000 00000000 00000000 ......
0000018: 01000000 00000000 00000000 00000000 00000000 00000000 @.....
000001e: 00000000 00000000 01000000 00001000 00000000 00000000 ..@...
0000024: 00000000 00000000 00000000 00000000 01000000 00010000 ....@.
000002a: 00000000 00000000 00000000 00000000 00000000 00000000 ......
0000030: 01000000 00010100 00000000 00000000 00000000 00000000 @.....
0000036: 00000000 00000000 01000000 00011000 00000000 00000000 ..@...
000003c: 00000000 00000000 00000000 00000000 01000000 00011100 ....@.
0000042: 00000000 00000000 00000000 00000000 00000000 00000000 ......
0000048: 01000000 00100000 00000000 00000000 00000000 00000000 @ ....
000004e: 00000000 00000000 01000000 00100010 00000000 00000000 ..@"..
0000054: 00000000 00000000 00000000 00000000 01000000 00100100 ....@$
000005a: 00000000 00000000 00000000 00000000 00000000 00000000 ......
0000060: 01000000 00100110 00000000 00000000 00000000 00000000 @&....
0000066: 00000000 00000000 01000000 00101000 00000000 00000000 ..@(..
000006c: 00000000 00000000 00000000 00000000 01000000 00101010 ....@*
0000072: 00000000 00000000 00000000 00000000 00000000 00000000 ......
0000078: 01000000 00101100 00000000 00000000 00000000 00000000 @,....
000007e: 00000000 00000000 01000000 00101110 00000000 00000000 ..@...
0000084: 00000000 00000000 00000000 00000000 01000000 00110000 ....@0
000008a: 00000000 00000000 00000000 00000000 00000000 00000000 ......
0000090: 01000000 00110001 00000000 00000000 00000000 00000000 @1....
0000096: 00000000 00000000 01000000 00110010 00000000 00000000 ..@2..
000009c: 00000000 00000000 00000000 00000000 01000000 00110011 ....@3
00000a2: 00000000 00000000 00000000 00000000 00000000 00000000 ......
</code></pre><div title="MDH:PGRpdiBkaXI9Imx0ciI+PGRpdj48ZGl2PkhpLCA8YnI+PGJyPjwvZGl2PkkgcmFuIGV4MTAgZnJv
bSAvdmVjL2V4YW1wbGVzL3R1dG9yaWFscyBhbmQgc2F2ZWQgdGhlIG1hdHJpeCBpbiBiaW5hcnkg
Zm9ybWF0Ljxicj48YnI+PC9kaXY+TG9va2luZyBhdCB0aGUgbWF0cml4IGluIGJpbmFyeSB1c2lu
ZyB4eGQsIEkgc2VlIDxicj5gYGA8YnI+W3NhamlkQHhybSB0ZW1wXSQgeHhkIC1iIHZlY3Rvci5k
YXQ8YnI+MDAwMDAwMDogMDAwMDAwMDAgMDAwMTAwMTAgMDExMTEwMTEgMDEwMDExMTAgMDAwMDAw
MDAgMDAwMDAwMDAmbmJzcDsgLi57Ti4uPGJyPjAwMDAwMDY6IDAwMDAwMDAwIDAwMDEwMTAwIDAw
MDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwJm5ic3A7IC4uLi4uLjxicj4wMDAwMDBj
OiAwMDAwMDAwMCAwMDAwMDAwMCAwMDAwMDAwMCAwMDAwMDAwMCAwMDExMTExMSAxMTExMDAwMCZu
YnNwOyAuLi4uPy48YnI+MDAwMDAxMjogMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAw
MDAgMDAwMDAwMDAgMDAwMDAwMDAmbmJzcDsgLi4uLi4uPGJyPjAwMDAwMTg6IDAxMD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AwMDAwMDAgMDAwMDAwMDAg
MDAwMDAwMDAmbmJzcDsgLi4uLi4uPGJyPjAwMDAwOTA6IDAxMDAwMDAwIDAwMTEwMDAxIDAwMDAw
MDAwIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwJm5ic3A7IEAxLi4uLjxicj4wMDAwMDk2OiAw
MDAwMDAwMCAwMDAwMDAwMCAwMTAwMDAwMCAwMDExMDAxMCAwMDAwMDAwMCAwMDAwMDAwMCZuYnNw
OyAuLkAyLi48YnI+MDAwMDA5YzogMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAg
MDEwMDAwMDAgMDAxMTAwMTEmbmJzcDsgLi4uLkAzPGJyPjAwMDAwYTI6IDAwMDAwMDAwIDAwMDAw
MDAwIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwIDAwMDAwMDAwJm5ic3A7IC4uLi4uLjxiciBj
bGVhcj0iYWxsIj48ZGl2PjxkaXY+PGRpdj48ZGl2PmBgYDxicj48YnI+PC9kaXY+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px"></div></div><div dir="ltr"><div><div><div><div><br></div><div>The format of the binary file is supposed to be <br></div><div>MAT_FILE_CLASSID, num_rows, num_cols, -1 followed by data. <br><br></div><div>Converting the first 4 bytes (32 bits) of binary to int, the number <br></div><div>00000000000100100111101101001110 becomes 1211214, but the value of MAT_FILE_CLASSID according to the header file petscmat.h is 1211216 (<a href="mailto:petsc@3.10.2.1">petsc@3.10.2.1</a> built without complex support). What causes this discrepancy ? <br><br></div><div>Also, what are the special characters at the end of every line ? Am i not reading the binary file correctly ?<br></div><div><br></div><div><br></div><div>Thank You, <br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div style="font-size:12.8px">Sajid Ali<br></div><div style="font-size:12.8px">Applied Physics<br></div><div style="font-size:12.8px">Northwestern University</div></div></div></div></div></div></div></div></div></div>