Commit 7bbfaa09 authored by davidkep's avatar davidkep

fix bug in construction of CSC matrix

parent cf5516a4
......@@ -277,7 +277,7 @@ inline arma::sp_vec SoftThresholdSparse(const arma::sp_vec& z1, const double c,
// From the index and value vectors, create a sparse vector.
if (nnz > 0) {
return arma::sp_mat(ind.head_rows(nnz), arma::uvec {0, z1.n_elem}, val.head_rows(nnz), z1.n_elem, 1);
return arma::sp_mat(ind.head_rows(nnz), arma::uvec {0, nnz}, val.head_rows(nnz), z1.n_elem, 1);
} else {
return arma::sp_vec(z1.n_elem);
}
......@@ -364,7 +364,7 @@ inline arma::sp_vec SoftThresholdSparse(const arma::sp_vec& z1, const double c,
// From the index and value vectors, create a sparse vector.
if (nnz > 0) {
return arma::sp_mat(ind.head_rows(nnz), arma::uvec {0, z1.n_elem}, val.head_rows(nnz), z1.n_elem, 1);
return arma::sp_mat(ind.head_rows(nnz), arma::uvec {0, nnz}, val.head_rows(nnz), z1.n_elem, 1);
} else {
return arma::sp_vec(z1.n_elem);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment