|
Ublas : |
Subject: [ublas] LU decomposition of compressed_matrix
From: Ungermann, Jörn (j.ungermann_at_[hidden])
Date: 2011-03-31 04:24:27
Hi,
we recently found out that using "unsigned int" for the index array in compressed matrix gives a small, but noticeable performance boost for large matrix-vector products in axpy_prod (likely because the performance is memory throughput bound). Trying to change our types, one of our simpler testcases involving the LU decomposition stopped to compile.
While we do not really plan to use the LU decomposition on large system, we do use it sometimes for stuff like matrix inverse and determinants for debugging of smaller test-problems.
I defined a type ("Matrix1" below) to be used as our "new" standard CSR format below, which seems to work fine. Can somebody help me with the compilation issue?
I use boost 1.46.1 and gcc (Debian 4.4.4-8) 4.4.5 20100728 (prerelease).
The error messages point a bit too deep into the template-expression-proxy-stuff that I am quite unfamiliar with.
Thanks and kind regards,
Joern
<snippet start>
#include <boost/numeric/ublas/matrix_sparse.hpp>
#include <boost/numeric/ublas/lu.hpp>
namespace ublas = boost::numeric::ublas;
typedef ublas::compressed_matrix<
double, ublas::row_major, 0, ublas::unbounded_array<unsigned int>
> Matrix1;
typedef ublas::compressed_matrix<double, ublas::row_major> Matrix2;
int main() {
typedef Matrix1 Matrix;
typedef ublas::permutation_matrix<Matrix::size_type> pmatrix;
Matrix A(2, 2);
pmatrix pm(A.size1());
Matrix::size_type res = ublas::lu_factorize(A, pm);
}
<snippet end>
PS:
A side effect of this change is that interaction with dense vector and dense matrix gives quite a bit of warnings for conversion between unsigned int and unsigned long. Is there an easy way to also use unsigned int for indices in those structs (but not for the underlying memory, of course)? Our vector sizes/individual matrix dimensions do not exceed 32 bit, whereas the overall memory consumed by the matrices does.
-- Joern Ungermann Dipl.-Mathematiker Institute for Energy and Climate Research - Stratosphere (IEK-7) Research Centre Juelich Telefon: +49 2461 61-6438 ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDirig Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender), Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Besuchen Sie uns auf unserem neuen Webauftritt unter www.fz-juelich.de