ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
Structured Matrix Types
Warning
Structured matrix types are experimental in ViennaCL. Interface changes as well as considerable performance improvements may be included in future releases!

There are a number of structured dense matrices for which some algorithms such as matrix-vector products can be computed with much lower computational effort than for the general dense matrix case. In the following, four structured dense matrix types included in ViennaCL are discussed. Example code can be found in examples/tutorial/structured-matrices.cpp.

Circulant Matrix

A circulant matrix is a matrix of the form

\[ \left( \begin{array}{ccccc} c_0 & c_{n-1} & \ldots & c_2 & c_1 \\ c_1 & c_0 & c_{n-1} & & c_2 \\ \vdots & c_1 & c_0 & \ddots & \vdots \\ c_{n-2} & & \ddots & \ddots & c_{n-1} \\ c_{n-1} & c_{n-2} & \hdots & c_1 & c_0 \\ \end{array} \right) \]

and available in ViennaCL via

std::size_t s = 42;

The circulant_matrix type can be manipulated in the same way as the dense matrix type matrix. Note that writing to a single element of the matrix is structure-preserving, e.g. changing circ_mat(1,2) will automatically update circ_mat(0,1), circ_mat(2,3) and so on.

Hankel Matrix

A Hankel matrix is a matrix of the form

\[ \left( \begin{array}{cccc} a & b & c & d \\ b & c & d & e \\ c & d & e & f \\ d & e & f & g \\ \end{array} \right) \]

and available in ViennaCL via

std::size_t s = 42;
viennacl::hankel_matrix hank_mat(s, s);

The hankel_matrix type can be manipulated in the same way as the dense matrix type matrix. Note that writing to a single element of the matrix is structure-preserving, e.g. changing hank_mat(1,2) in the example above will also update hank_mat(0,3), hank_mat(2,1), hank_mat(3,0), etc.

Toeplitz Matrix

A Toeplitz matrix is a matrix of the form

\[ \left( \begin{array}{cccc} a & b & c & d \\ e & a & b & c \\ f & e & a & b \\ g & f & e & a \\ \end{array} \right) \]

and available in ViennaCL via

std::size_t s = 42;

The toeplitz_matrix type can be manipulated in the same way as the dense matrix type matrix. Note that writing to a single element of the matrix is structure-preserving, e.g. changing toep_mat(1,2) in the example above will also update toep_mat(0,1), toep_mat(2,3), etc.

Vandermonde Matrix

A Vandermonde matrix is a matrix of the form

\[ \left( \begin{array}{ccccc} 1 & \alpha_1 & \alpha_1^2 & \ldots & \alpha_1^{n-1} \\ 1 & \alpha_2 & \alpha_2^2 & \ldots & \alpha_2^{n-1} \\ 1 & \vdots & \vdots & \vdots \\ 1 & \alpha_m & \alpha_m^2 & \ldots & \alpha_m^{n-1} \\ \end{array} \right) \]

and available in ViennaCL via

std::size_t s = 42;

The vandermonde_matrix type can be manipulated in the same way as the dense matrix type matrix, but restrictions apply. For example, the addition or subtraction of two Vandermonde matrices does not yield another Vandermonde matrix. Note that writing to a single element of the matrix is structure-preserving, e.g. changing vand_mat(1,2) in the example above will automatically update vand_mat(1,3), vand_mat(1,4), etc.