Skip to content

Commit

Permalink
update a path with the coo2csr-take-2 version
Browse files Browse the repository at this point in the history
  • Loading branch information
superwhiskers committed Jul 24, 2024
1 parent c87d704 commit 3c33ef2
Showing 1 changed file with 21 additions and 67 deletions.
88 changes: 21 additions & 67 deletions resolve/LinSolverDirectLUSOL.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <algorithm>

#include "LinSolverDirectLUSOL.hpp"
#include "lusol/lusol.hpp"
Expand Down Expand Up @@ -85,14 +85,14 @@ namespace ReSolve

/**
* @brief Analysis function of LUISOL
*
*
* At this time, only memory allocation and initialization is done here.
*
*
* @return int - 0 if successful, error code otherwise
*
*
* @pre System matrix `A_` is in unsorted COO format without duplicates.
*
* @note LUSOL does not expose symbolic factorization in its API. It might
*
* @note LUSOL does not expose symbolic factorization in its API. It might
* be possible refactor lu1fac into separate symbolic and numerical
* factorization functions, but for now, we do the both in ::factorize().
*/
Expand Down Expand Up @@ -156,54 +156,7 @@ namespace ReSolve
w_,
&inform);

if (inform == 7) {
delete[] a_;
delete[] indc_;
delete[] indr_;

lena_ = luparm_[12];

a_ = new real_type[lena_];
indc_ = new index_type[lena_];
indr_ = new index_type[lena_];
mem_.setZeroArrayOnHost(a_, lena_);
mem_.setZeroArrayOnHost(indc_, lena_);
mem_.setZeroArrayOnHost(indr_, lena_);

mem_.setZeroArrayOnHost(p_, m_);

mem_.setZeroArrayOnHost(q_, n_);

mem_.setZeroArrayOnHost(lenc_, n_);

mem_.setZeroArrayOnHost(lenr_, m_);

mem_.setZeroArrayOnHost(locc_, n_);

mem_.setZeroArrayOnHost(locr_, m_);

mem_.setZeroArrayOnHost(iploc_, n_);

mem_.setZeroArrayOnHost(iqloc_, m_);

mem_.setZeroArrayOnHost(ipinv_, m_);

mem_.setZeroArrayOnHost(iqinv_, n_);

mem_.setZeroArrayOnHost(w_, n_);

real_type* a_in = A_->getValues(memory::HOST);
index_type* indc_in = A_->getRowData(memory::HOST);
index_type* indr_in = A_->getColData(memory::HOST);

for (index_type i = 0; i < nelem_; i++) {
a_[i] = a_in[i];
indc_[i] = indc_in[i] + 1;
indr_[i] = indr_in[i] + 1;
}

return factorize();
}
// TODO: consider handling inform = 7

return inform;
}
Expand Down Expand Up @@ -327,6 +280,7 @@ namespace ReSolve
mem_.setZeroArrayOnHost(indc_, lena_);
mem_.setZeroArrayOnHost(indr_, lena_);


p_ = new index_type[m_];
mem_.setZeroArrayOnHost(p_, m_);

Expand Down Expand Up @@ -359,7 +313,7 @@ namespace ReSolve

w_ = new real_type[n_];
mem_.setZeroArrayOnHost(w_, n_);

return 0;
}

Expand All @@ -379,20 +333,20 @@ namespace ReSolve
delete[] ipinv_;
delete[] iqinv_;
delete[] w_;
a_ = nullptr;
indc_ = nullptr;
indr_ = nullptr;
p_ = nullptr;
q_ = nullptr;
lenc_ = nullptr;
lenr_ = nullptr;
locc_ = nullptr;
locr_ = nullptr;
a_ = nullptr;
indc_ = nullptr;
indr_ = nullptr;
p_ = nullptr;
q_ = nullptr;
lenc_ = nullptr;
lenr_ = nullptr;
locc_ = nullptr;
locr_ = nullptr;
iploc_ = nullptr;
iqloc_ = nullptr;
ipinv_ = nullptr;
iqloc_ = nullptr;
ipinv_ = nullptr;
iqinv_ = nullptr;
w_ = nullptr;
w_ = nullptr;

return 0;
}
Expand Down

0 comments on commit 3c33ef2

Please sign in to comment.