Dear Nasos, thank you for the quick answer.
I will consider using the find functions.
concerning the construction of the matrix we are actually using our own version of vector of vectors. If you are interested you can have a look to our implementation at the link
http://kratos.cimne.upc.es/trac/browser/kratos/kratos/solving_strategies/builder_and_solvers/residualbased_elimination_builder_and_solver.h
from line 965
what you may find of interest is the first touch approach we use for the matrix in openmp context. This has a very important effect on performance on numa machines, starting from line 1034 in the same file
in any case thanks a lot for your attention
Riccardo
On Thu, 12 Aug 2010 10:01:35 -0400, Nasos Iliopoulos <nasos_i@hotmail.com> wrote:
Ricardo,
you can use the find_element(i,j) member function, that returns a pointer to the element when it exists and 0 otherwise.
Also for filling sparse matrices, I would suggest taking a look at Gunter's wiki:
http://ublas.sourceforge.net/refdoc/classboost_1_1numeric_1_1ublas_1_1compressed__matrix.html
and playing a bit with the various sparse matrix types.
I find that for FEA, it is usually more efficient to use a generalized_vector_of_vector to assemble the matrix and then copy that into a compressed_matrix, to send it to a solver. Of course this process heavily depends on problem size.
Best,
Nasos
> From: rrossi@cimne.upc.edu
> To: ublas@lists.boost.org
> Date: Thu, 12 Aug 2010 14:21:58 +0200
> Subject: [ublas] simple question on CSR matrix
>
> Dear list,
>
> i have a CSR matrix, of which i preallocated the zeros doing
> push_back
>
> is there a way to ensure that if i access
> A(i,j) and i,j is not in the graph an error is thrown? i mean... i would
> prefer an error (even segfault) than ublas silently attempting to resize
> the matrix
>
> any hint is very welcome
>
> thank you
> Riccardo
>
> --
> ________________________________________________________________
> Riccardo Rossi, Ph.D, Civil Engineer
> member of the Kratos Group: kratos.cimne.upc.es
> Centro Internacional de Métodos Numéricos en Ingeniería (CIMNE)
> Universidad Politécnica de Cataluña (UPC)
> Edificio C-1, campus Norte UPC
> Gran Capitan, s/n
> 08034 Barcelona, España
> Tel. (+34) 93 401 73 99
> ________________________________________________________________
>
> AVISO IMPORTANTE
>
> Los datos de carácter personal contenidos en el mensaje, se registrarán
> en un fichero para facilitar la gestión de las comunicaciones de CIMNE.
> Se pueden ejercitar los derechos de acceso, rectificación, cancelación y
> oposición por escrito, dirigiéndose a nuestras oficinas de CIMNE, Gran
> Capitán s/n, Edificio C1 - Campus Norte UPC, 08034 Barcelona, España.
>
> AVÍS IMPORTANT
>
> Les dades de caràcter personal contingudes en aquest missatge es
> registraran en un fitxer per facilitar la gestió de les comunicacions
> del CIMNE. Es poden exercir els drets d'accés, rectificació,
> cancel·lació i oposició, per escrit a les nostres oficines del CIMNE,
> Gran Capità s/n, Edifici C1, Campus Nord UPC, 08034 Barcelona, Espanya.
>
> IMPORTANT NOTICE
>
> All personal data contained in this mail will be processed
> confidentially and stored in a file property of CIMNE in order to manage
> corporate communications. You may exercise the right of access,
> rectification, deletion and objection by letter sent to CIMNE, Gran
> Capitán, Edificio C1 - Campus Norte UPC, 08034 Barcelona, Spain.
>
>
>
>
>
>
> _______________________________________________
> ublas mailing list
> ublas@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: nasos_i@hotmail.com