13
13
// rescaled = false;
14
14
// }
15
15
16
- kr_balancing::kr_balancing (const size_t &input_rows, const size_t &input_cols,
17
- const size_t &input_nnz,
18
- const Eigen::Ref<VectorXsize_t > input_indptr,
19
- const Eigen::Ref<VectorXsize_t > input_indices,
16
+ kr_balancing::kr_balancing (const int64_t &input_rows, const int64_t &input_cols,
17
+ const int64_t &input_nnz,
18
+ const Eigen::Ref<VectorXint64 > input_indptr,
19
+ const Eigen::Ref<VectorXint64 > input_indices,
20
20
const Eigen::Ref<Eigen::VectorXd> input_values)
21
21
{
22
22
@@ -26,17 +26,17 @@ kr_balancing::kr_balancing(const size_t &input_rows, const size_t &input_cols,
26
26
std::vector<T> triplets;
27
27
triplets.reserve (input_nnz);
28
28
29
- size_t i = 0 ;
30
- size_t j_start = 0 ;
31
- size_t j_end = 0 ;
29
+ int64_t i = 0 ;
30
+ int64_t j_start = 0 ;
31
+ int64_t j_end = 0 ;
32
32
while (i < input_indptr.size () - 1 )
33
33
{
34
34
j_start = input_indptr (i);
35
35
j_end = input_indptr (i + 1 );
36
36
37
37
while (j_start < j_end)
38
38
{
39
- triplets.push_back (T (i, size_t (input_indices (j_start)),
39
+ triplets.push_back (T (i, int64_t (input_indices (j_start)),
40
40
float (input_values (j_start))));
41
41
j_start++;
42
42
}
@@ -75,15 +75,15 @@ void kr_balancing::computeKR()
75
75
76
76
void kr_balancing::outer_loop ()
77
77
{
78
- size_t outer_loop_count = 0 ;
78
+ int64_t outer_loop_count = 0 ;
79
79
double stop_tol = tol * 0.5 ;
80
80
double eta = etamax;
81
81
double rt = tol * tol;
82
82
double rout = rho_km1.coeff (0 , 0 );
83
83
double rold = rout;
84
84
if (fl == 1 )
85
85
std::cout << " intermediate convergence statistics is off" << std::endl;
86
- size_t nochange = 0 ;
86
+ int64_t nochange = 0 ;
87
87
while (rout > rt)
88
88
{ // outer itteration
89
89
outer_loop_count++;
@@ -168,7 +168,7 @@ void kr_balancing::inner_loop()
168
168
if (delta == 0 )
169
169
break ;
170
170
Eigen::Matrix<bool , Eigen::Dynamic, Eigen::Dynamic> ind_helper = (ap.array () < 0 );
171
- VectorXsize_t ind = VectorXsize_t ::LinSpaced (ind_helper.size (), 0 , ind_helper.size () - 1 );
171
+ VectorXint64 ind = VectorXint64 ::LinSpaced (ind_helper.size (), 0 , ind_helper.size () - 1 );
172
172
ind.conservativeResize (std::stable_partition (
173
173
ind.data (), ind.data () + ind.size (), [&ind_helper](int i) { return ind_helper (i); }) -
174
174
ind.data ());
@@ -185,7 +185,7 @@ void kr_balancing::inner_loop()
185
185
if (ynew.maxCoeff () >= Delta)
186
186
{
187
187
Eigen::Matrix<bool , Eigen::Dynamic, Eigen::Dynamic> ind_helper = (ynew.array () > Delta);
188
- VectorXsize_t ind = VectorXsize_t ::LinSpaced (ind_helper.size (), 0 , ind_helper.size () - 1 );
188
+ VectorXint64 ind = VectorXint64 ::LinSpaced (ind_helper.size (), 0 , ind_helper.size () - 1 );
189
189
ind.conservativeResize (std::stable_partition (
190
190
ind.data (), ind.data () + ind.size (), [&ind_helper](size_t i) { return ind_helper (i); }) -
191
191
ind.data ());
@@ -284,9 +284,9 @@ const SparseMatrixCol *kr_balancing::get_normalisation_vector(bool &rescale)
284
284
PYBIND11_MODULE (krbalancing, m)
285
285
{
286
286
py::class_<kr_balancing>(m, " kr_balancing" )
287
- .def (py::init<const size_t &, const size_t &, const size_t &,
288
- const Eigen::Ref<VectorXsize_t >,
289
- const Eigen::Ref<VectorXsize_t >,
287
+ .def (py::init<const int64_t &, const int64_t &, const int64_t &,
288
+ const Eigen::Ref<VectorXint64 >,
289
+ const Eigen::Ref<VectorXint64 >,
290
290
const Eigen::Ref<Eigen::VectorXd>>())
291
291
.def (" computeKR" , &kr_balancing::computeKR)
292
292
.def (" get_normalisation_vector" , &kr_balancing::get_normalisation_vector,
0 commit comments