Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2800 closed Bugs (fixed)

Bug in transposed_structure

Reported by: Tiago Requeijo Owned by: Gunter
Milestone: Boost 1.39.0 Component: uBLAS
Version: Boost 1.38.0 Severity: Problem
Keywords: uBlas, storage scheme, row_major, column_major, triangular_matrix, transposed_structure Cc:

Description

The transposed_structure template simply takes an upper triangular matrix and regards it as the transpose of a lower triangular matrix. It doesn't take into account the row/column major storage, leading to the following bug:

If we take the upper matrix U

1 2 3

  • 4 5
  • - 6

and regard it as the transpose of a lower matrix L

1 2 4 3 5 6

without a row/column major swap, then storing the row major version of the lower matrix is the same as storing the column major version of the upper matrix:

a) row_major for U: 1 2 3 4 5 6 b) row_major for L: 1 2 4 3 5 6

Since the transposed_structure template simply maps the elements to the transpose and doesn't change the storage, we are in fact storing b) instead of a).

Attachments (1)

main.cpp (3.3 KB ) - added by anonymous 14 years ago.
C++ test file for triangular matrix storage schemes

Download all attachments as: .zip

Change History (4)

by anonymous, 14 years ago

Attachment: main.cpp added

C++ test file for triangular matrix storage schemes

comment:1 by anonymous, 14 years ago

The matrices above got flattened into the same line. The example above should read:

upper matrix U

1 2 3

  • 4 5
  • - 6

lower matrix L

1
2 4
3 5 6

and the row major versions for U and L, respectively

a) row_major for U: 1 2 3 4 5 6
b) row_major for L: 1 2 4 3 5 6

comment:2 by Gunter, 14 years ago

Resolution: fixed
Status: newclosed

(In [51764]) functional.hpp:

  • added triangular_type definitions
  • added transposed_layout to basic_row_major and basic_column_major
  • fix #2800 : transposed_structure has to switch row major and column major

comment:3 by Gunter, 14 years ago

(In [52145]) ublas/expression_types.hpp: added typedef ublas_expression::self_type ublas/fwd.hpp: added default template arguments to declaration of generalized_vector_of_vector ublas/lu.hpp: added constructor from vector to permutation_matrix ublas/storage.hpp: fix #2891 ublas/detail/concepts.hpp: added documentation and some missing concept checks

ublas/traits.hpp:

added new traits classes: container_traits, matrix_traits, vector_traits they work for all ublas classes and c-arrays (T[M][N] and T[M])

ublas/functional.hpp:

added triangular type tags fix #2800 added my name to copyright message

Note: See TracTickets for help on using tickets.