[overture] Re: writeMatrixToFile command in Oges

  • From: srinath <smallik2@xxxxxxxx>
  • To: overture@xxxxxxxxxxxxx
  • Date: Sun, 30 Sep 2007 19:52:44 -0500

Thanks Bill

Here is a bit of code, using awk, which converts the stuff from debug::63 to the format used by writeMatrixToFile.

Someone may find this useful.
First remove all the non relevant text lines from the output.
Then execute the following script.

#!/bin/bash
sed 's/Row i=  //;s/[(),]/ /g;' $1 | awk '{
                                           for(i = 2; i < NF; i += 2)
                                                print $1" "$i" "$(i+1)
                                         }'
and pipe the output to however you want to view/ save it.

Unix Rules
Srinath


Bill Henshaw wrote:
Hi Srinath:

  Unfortunately the "writeMatrixToFile" does not currently work with
the harwell option.

  There is another way to print out the matrix. Include the line
     Oges::debug=63;
in your code and Oges will print out the matrix to the screen (along with other
useful information).

...Bill

srinath wrote:
Thanks Dominic

It prints out the matrix now. But the index j seems to be way off.
I have a 10*10 grid and a system of 4 eqns,
but maximum value of j seems to be 2736130!
I looked at the previous posts, where this problem apparently occurs if uou call the SLAP solver.
I am using the Harwell solver, and i seem to run into the same problem.

I tried using the default Yale.
The problem is Yale, doesn't solve my system. It quits out, after the following error message. allocateWorkSpace: numberOfEquations=900, nsp = 86526, fillinRatio= 19, numberOfNonzeros = 4554
 CGESL1: YALE  path:1   null pivot                    --  row = 633
 CGESL1: flag= 5133
 CGESL1: neq = 900
 CGESL1: nsp=  86526
 CGESL1: path=  1
 CGESL1: Work spaces used fillinRatio = 19.00
 CGESL1: irem=mod(flag,neq)= 633
 CGESL1: itype=(flag-irem)/neq= 5
STOP CGESL1C statement executed.
Since the line, for saving the Matrix, comes after the "solve" statement, no matrix is saved, as the line is never reached. But Harwell seems to work fine. It just prints the matrix in the wrong format.

Also how does one determine the size of the Matrix?
I could do max(max(i),max(j)) in Matlab, but what if there are rows, with all zero's at the top and bottom, which never show up, in this display format?
My Matrix seems to be close to singular, i would like to see which bc is
responsible for pushing it over the edge, into a singular structure.
Could you suggest something?

Thanks
Srinath


#DOMINIC DENVER JOHN CHANDAR# wrote:
Hi Srinath,

I guess, the "writeMatrixToFile" has to be called after you solve the
equations.
It works for me then. I see that the solve() function internally first
generates the matrix using the function formMatrix(). I'm not very sure
how to see the matrix without having to call solve().
Regards,
Dominic  -----Original Message-----
From: overture-bounce@xxxxxxxxxxxxx
[mailto:overture-bounce@xxxxxxxxxxxxx] On Behalf Of srinath
Sent: Sunday, September 30, 2007 12:28 PM
To: overture@xxxxxxxxxxxxx
Subject: [overture] Re: writeMatrixToFile command in Oges

Thanks Dominic

I added the line, but i still get nothing in the file Matrix.dat.
These are the specific lines.

Oges solver(cg);
solver.set(OgesParameters::harwell);
solver.setCoefficientArray(coeff);
solver.set(OgesParameters::THEkeepSparseMatrix,true);
solver.writeMatrixToFile("Matrix.dat");

Thanks
Srinath


#DOMINIC DENVER JOHN CHANDAR# wrote:
Hi Srinath,

You have to put this statement in your code after you create a solver
context:

solver.set(OgesParameters::THEkeepSparseMatrix,true);

From wat I have done... I see that it gets stored in (ia,ja,v) format (Row index, Col Index, matrix entry).
You might want to take a look at one of the earlier posts in topica :
http://lists.topica.com/lists/overture/read/message.html?mid=812533515
&s
ort=d&start=860

And the replies by Bill following that..

Regards,
Dominic



-----Original Message-----
From: overture-bounce@xxxxxxxxxxxxx
[mailto:overture-bounce@xxxxxxxxxxxxx] On Behalf Of srinath
Sent: Sunday, September 30, 2007 11:24 AM
To: overture@xxxxxxxxxxxxx
Subject: [overture] writeMatrixToFile command in Oges

Hello

I am trying to print the coefficient matrix to a file.
I have the following line
solver.writeMatrixToFile("Matrix.dat"), but a file, with nothing in it

is created.
Could someone tell me what i am doing wrong.

Regards
Srinath









Other related posts: