Teuchos - Trilinos Tools Package Version of the Day
DenseMatrix/cxx_main_sym.cpp

This is an example of how to use the Teuchos::SerialSymDenseMatrix class.

The Teuchos_SerialSymDenseMatrix class enables the construction and use of symmetric, positive-definite, dense matrices of templated type.

The Teuchos::SerialSymDenseMatrix class is intended to provide full-featured support for solving linear and eigen system problems for symmetric positive-definite (SPD) matrices. It is written on top of BLAS and LAPACK and thus has excellent performance and numerical capabilities. Using this class, one can either perform simple factorizations and solves or apply all the tricks available in LAPACK to get the best possible solution for very ill-conditioned problems.

Teuchos::SerialSymDenseMatrix vs. Teuchos::LAPACK

The Teuchos::LAPACK class provides access to most of the same functionality as Teuchos::SerialSymDenseMatrix. The primary difference is that Teuchos::LAPACK is a "thin" layer on top of LAPACK and Teuchos::SerialSymDenseMatrix attempts to provide easy access to the more sophisticated aspects of solving dense linear and eigensystems.

Constructing Teuchos::SerialSymDenseMatrix Objects

There are three Teuchos::SerialSymDenseMatrix constructors. The first constructs a zero-sized object which should be made to appropriate length using the Shape() or Reshape() functions and then filled with the [] or () operators. The second is a constructor that accepts user data as a 2D array, the third is a copy constructor. The second constructor has two data access modes (specified by the Teuchos::DataAccess argument):

  1. Copy mode - Allocates memory and makes a copy of the user-provided data. In this case, the user data is not needed after construction.
  2. View mode - Creates a "view" of the user data. In this case, the user data is required to remain intact for the life of the object.
Warning:
View mode is extremely dangerous from a data hiding perspective. Therefore, we strongly encourage users to develop code using Copy mode first and only use the View mode in a secondary optimization phase.

Extracting Data from Teuchos::SerialSymDenseMatrix Objects

Once a Teuchos::SerialSymDenseMatrix is constructed, it is possible to view the data via access functions.

Warning:
Use of these access functions cam be extremely dangerous from a data hiding perspective.

Vector and Utility Functions

Once a Teuchos::SerialSymDenseMatrix is constructed, several mathematical functions can be applied to the object. Specifically:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines