branch: csr_matrix_and_memory_fixes
commit 06165410f54c1c82ee82903906c6497cd535ce83
Author: Andriy.Andreykiv
Date: Thu Jun 6 14:26:43 2019 +0200
allowing gmm::csc_matrix and gmm::csr_matrix to be also templetized by
index type. This was necessary to interface them with Intel's MKL, which
requires int for indexes.
---
src/gmm/gmm_inoutput.h | 42 +++---
src/gmm/gmm_matrix.h | 94 --
2 files changed, 66 insertions(+), 70 deletions(-)
diff --git a/src/gmm/gmm_inoutput.h b/src/gmm/gmm_inoutput.h
index cca7027..ea2c277 100644
--- a/src/gmm/gmm_inoutput.h
+++ b/src/gmm/gmm_inoutput.h
@@ -124,12 +124,12 @@ namespace gmm {
/** open filename and reads header */
void open(const char *filename);
/** read the opened file */
-template void read(csc_matrix& A);
+template void
read(csc_matrix& A);
template void read(MAT ) IS_DEPRECATED;
-template
-static void write(const char *filename, const csc_matrix& A);
-template
-static void write(const char *filename, const csc_matrix& A,
+template
+static void write(const char *filename, const csc_matrix& A);
+template
+static void write(const char *filename, const csc_matrix& A,
const std::vector );
template
static void write(const char *filename,
@@ -324,8 +324,8 @@ namespace gmm {
}
/* only valid for double and complex csc matrices */
- template void
- HarwellBoeing_IO::read(csc_matrix& A) {
+ template void
+ HarwellBoeing_IO::read(csc_matrix& A) {
// typedef typename csc_matrix::IND_TYPE IND_TYPE;
@@ -531,17 +531,17 @@ namespace gmm {
return 1;
}
- template void
+ template void
HarwellBoeing_IO::write(const char *filename,
- const csc_matrix& A) {
+ const csc_matrix& A) {
write(filename, csc_matrix_ref
([0], [0], [0], A.nr, A.nc));
}
- template void
+ template void
HarwellBoeing_IO::write(const char *filename,
- const csc_matrix& A,
+ const csc_matrix& A,
const std::vector ) {
write(filename, csc_matrix_ref
@@ -593,9 +593,9 @@ namespace gmm {
/** save a "double" or "std::complex" csc matrix into a
HarwellBoeing file
*/
- template inline void
+ template inline void
Harwell_Boeing_save(const std::string ,
- const csc_matrix& A)
+ const csc_matrix& A)
{ HarwellBoeing_IO::write(filename.c_str(), A); }
/** save a reference on "double" or "std::complex" csc matrix
@@ -631,8 +631,8 @@ namespace gmm {
/** load a "double" or "std::complex" csc matrix from a
HarwellBoeing file
*/
- template void
- Harwell_Boeing_load(const std::string , csc_matrix& A) {
+ template void
+ Harwell_Boeing_load(const std::string , csc_matrix& A) {
HarwellBoeing_IO h(filename.c_str()); h.read(A);
}
@@ -1022,8 +1022,8 @@ namespace gmm {
/* read opened file */
template void read(Matrix );
/* write a matrix */
-template static void
-write(const char *filename, const csc_matrix& A);
+template static void
+write(const char *filename, const csc_matrix& A);
template static void
write(const char *filename,
const csc_matrix_ref& A);
@@ -1038,8 +1038,8 @@ namespace gmm {
mm.read(A);
}
/** write a matrix-market file */
- template void
- MatrixMarket_save(const char *filename, const csc_matrix& A) {
+ template void
+ MatrixMarket_save(const char *filename, const csc_matrix& A) {
MatrixMarket_IO mm; mm.write(filename, A);
}
@@ -1106,8 +1106,8 @@ namespace gmm {
}
}
- template void
- MatrixMarket_IO::write(const char *filename, const csc_matrix& A) {
+ template void
+ MatrixMarket_IO::write(const char *filename, const csc_matrix& A) {
write(filename, csc_matrix_ref
([0], [0], [0], A.nr, A.nc));
diff --git a/src/gmm/gmm_matrix.h b/src/gmm/gmm_matrix.h
index 3b133bb..634019c 100644
--- a/src/gmm/gmm_matrix.h
+++ b/src/gmm/gmm_matrix.h
@@ -497,9 +497,8 @@ namespace gmm
/* */
/* */
- template
+ template
struct csc_matrix {
-typedef unsigned int IND_TYPE;
std::vector pr;
std::vector ir;
@@ -519,7 +518,7 @@ namespace gmm
void init_with(const csc_matrix_ref& B)
{ init_with_good_format(B); }
template
-void init_with(const csc_matrix& B)
+void init_with(const csc_matrix& B)
{ init_with_good_format(B); }
void init_with_identity(size_type n);
@@ -529,7 +528,7 @@ namespace gmm
size_type nrows(void) const { return nr; }
size_type ncols(void) const { return nc; }
-void swap(csc_matrix ) {
+void swap(csc_matrix ) {