7 extern "C" void F77_FUNC(mc64id, MC64ID)(
int*);
8 extern "C" void F77_FUNC(mc64ad, MC64AD)(
int*,
int*,
int*,
int*,
int*,
9 double*,
int*,
int*,
int*,
int*,
10 int*,
double*,
int*,
int*);
14 const bool StoreTranspose,
const bool analyze) :
17 if (A_.Comm().NumProc() != 1)
19 std::cerr <<
"Class Amesos_MC64 can be used with one processor only!" << std::endl;
24 Compute(JOB, StoreTranspose, analyze);
28 int Amesos_MC64::Compute(
int JOB,
const bool StoreTranspose,
const bool analyze)
32 int MaxNumEntries = A_.MaxNumEntries();
33 int N = A_.NumMyRows();
34 int NE = A_.NumMyNonzeros();
37 std::vector<double> VAL;
39 std::vector<int> Indices(MaxNumEntries);
40 std::vector<double> Values(MaxNumEntries);
46 IP.resize(N + 1); IP[0] = 1;
51 for (
int i = 0 ; i < N ; ++i)
55 A_.ExtractMyRowCopy(i, MaxNumEntries, NumEntries, &Values[0],
58 IP[i + 1] = IP[i] + NumEntries;
60 for (
int j = 0 ; j < NumEntries ; ++j)
62 IRN[count] = Indices[j] + 1;
63 VAL[count] = Values[j];
76 IRN.resize(N * MaxNumEntries);
77 VAL.resize(N * MaxNumEntries);
79 std::vector<int> count(N);
80 for (
int i = 0 ; i < N ; ++i) count[i] = 0;
82 for (
int i = 0 ; i < N ; ++i)
86 A_.ExtractMyRowCopy(i, MaxNumEntries, NumEntries, &Values[0],
89 for (
int j = 0 ; j < NumEntries ; ++j)
92 IRN[col * MaxNumEntries + count[col]] = i + 1;
93 VAL[col * MaxNumEntries + count[col]] = Values[j];
100 for (
int col = 0 ; col < N ; ++col)
102 for (
int row = 0 ; row < count[col] ; ++row)
104 IRN[k] = IRN[col * MaxNumEntries + row];
105 VAL[k] = VAL[col * MaxNumEntries + row];
117 for (
int col = 0 ; col < N ; ++col)
118 IP[col + 1] = IP[col] + count[col];
120 std::vector<std::vector<int> > cols(N);
121 std::vector<std::vector<double> > vals(N);
123 for (
int i = 1 ; i <= N ; ++i)
127 A_.ExtractMyRowCopy(i - 1, MaxNumEntries, NumEntries, &Values[0],
130 for (
int j = 0 ; j < NumEntries ; ++j)
132 cols[Indices[j]].push_back(i);
133 vals[Indices[j]].push_back(Values[j]);
137 IP.resize(N + 1); IP[0] = 1;
142 for (
int i = 0 ; i < N ; ++i)
144 IP[i + 1] = IP[i] + cols[i].size();
146 for (
int j = 0 ; j < cols[i].size() ; ++j)
148 IRN[count] = cols[i][j];
149 VAL[count] = vals[i][j];
158 int LIW = 10 * N + NE;
159 std::vector<int> IW(LIW);
160 int LDW = 3 * N + NE;
164 F77_FUNC(mc64ad, MC64aD)(&JOB, &N, &NE, &IP[0], &IRN[0], &VAL[0],
165 &NUM, &CPERM_[0], &LIW, &IW[0], &LDW,
166 &DW_[0], ICNTL_, INFO_);
170 std::map<double, int> table;
171 for (
int col = 0 ; col < N ; ++col)
173 for (
int j = IP[col] ; j < IP[col + 1] ; ++j)
175 int row = IRN[j - 1] - 1;
176 int new_col = CPERM_[col];
177 double new_val = VAL[j - 1] * exp(DW_[row] + DW_[col + N]);
178 if (new_val < 0.0) new_val = -new_val;
179 if (new_val > 0.1) table[0.1]++;
180 else if (new_val > 0.01) table[0.01]++;
181 else if (new_val > 0.001) table[0.001]++;
182 else if (new_val > 0.0001) table[0.0001]++;
183 else if (new_val > 0.00001) table[0.00001]++;
184 else if (new_val > 0.000001) table[0.000001]++;
189 std::cout <<
"# elements (total) = " << NE << std::endl;
190 std::cout <<
"# elements > 0.1 = " << table[0.1] << std::endl;
191 std::cout <<
"# elements > 0.01 = " << table[0.01] << std::endl;
192 std::cout <<
"# elements > 0.001 = " << table[0.001] << std::endl;
193 std::cout <<
"# elements > 0.0001 = " << table[0.0001] << std::endl;
194 std::cout <<
"# elements > 0.00001 = " << table[0.00001] << std::endl;
195 std::cout <<
"# elements > 0.000001 = " << table[0.000001] << std::endl;
196 std::cout <<
"# elements <=0.000001 = " << table[0.0] << std::endl;
203 double* Amesos_MC64::GetColScaling()
205 return((
double*)&DW_[0 + A_.NumMyRows()]);
#define AMESOS_RETURN(amesos_err)
void F77_FUNC(mc64id, MC64ID)(int *)