mirror of https://github.com/CGAL/cgal
194 lines
5.0 KiB
TeX
194 lines
5.0 KiB
TeX
% +------------------------------------------------------------------------+
|
|
% | Reference manual page: Taucs_matrix.tex
|
|
% +------------------------------------------------------------------------+
|
|
% | 21.09.2005 Laurent Saboret, Pierre Alliez
|
|
% | Package: Parameterization
|
|
% |
|
|
\RCSdef{\RCSTaucsmatrixRev}{$Id$}
|
|
\RCSdefDate{\RCSTaucsmatrixDate}{$Date$}
|
|
% |
|
|
%%RefPage: end of header, begin of main body
|
|
% +------------------------------------------------------------------------+
|
|
|
|
|
|
\begin{ccRefClass}{Taucs_matrix} %% add template arg's if necessary
|
|
|
|
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
|
%% \ccHtmlIndexC[class]{} %% add further index entries
|
|
|
|
|
|
\ccDefinition
|
|
|
|
% The section below is automatically generated. Do not edit!
|
|
%START-AUTO(\ccDefinition)
|
|
|
|
The class Taucs\_matrix is a C++ wrapper around TAUCS' matrix type taucs\_ccs\_matrix.
|
|
|
|
This kind of matrix can be either symmetric or not. Symmetric matrices store only the lower triangle.
|
|
|
|
\begin{description}
|
|
\item[Todo]Taucs\_matrix must reallocate the array of non null elements when it's full.
|
|
|
|
Filling a Taucs\_matrix by lines is very slow. We must improve this code.\end{description}
|
|
|
|
%END-AUTO(\ccDefinition)
|
|
|
|
\ccInclude{CGAL/Taucs_matrix.h}
|
|
|
|
|
|
\ccIsModel
|
|
|
|
% The section below is automatically generated. Do not edit!
|
|
%START-AUTO(\ccIsModel)
|
|
|
|
Model of the SparseLinearAlgebraTraits\_d::Matrix concept.
|
|
|
|
%END-AUTO(\ccIsModel)
|
|
|
|
|
|
\ccParameters
|
|
|
|
The full template declaration is:
|
|
|
|
% The section below is automatically generated. Do not edit!
|
|
%START-AUTO(\ccParameters)
|
|
|
|
template$<$ \\
|
|
class T$>$ \\
|
|
struct Taucs\_matrix;
|
|
|
|
%END-AUTO(\ccParameters)
|
|
|
|
|
|
\ccTypes
|
|
|
|
% The section below is automatically generated. Do not edit!
|
|
%START-AUTO(\ccTypes)
|
|
|
|
\ccNestedType{NT}
|
|
{
|
|
}
|
|
\ccGlue
|
|
|
|
%END-AUTO(\ccTypes)
|
|
|
|
|
|
\ccCreation
|
|
\ccCreationVariable{M} %% choose variable name for \ccMethod
|
|
|
|
% The section below is automatically generated. Do not edit!
|
|
%START-AUTO(\ccCreation)
|
|
|
|
\ccConstructor{Taucs_matrix (int dim, bool is_symmetric = false, int nb_max_elements = 0);}
|
|
{
|
|
Create a square matrix initialized with zeros.
|
|
}
|
|
\ccGlue
|
|
\begin{description}
|
|
\item[Parameters: ]
|
|
\begin{description}
|
|
\item[dim]Matrix dimension. \item[is\_symmetric]Symmetric/hermitian? \item[nb\_max\_elements]Max number of non 0 elements in the matrix (automatically computed if 0). \end{description}
|
|
\end{description}
|
|
\ccGlue
|
|
\ccConstructor{Taucs_matrix (int rows, int columns, bool is_symmetric = false, int nb_max_elements = 0);}
|
|
{
|
|
Create a rectangular matrix initialized with zeros.
|
|
}
|
|
\ccGlue
|
|
\begin{description}
|
|
\item[Parameters: ]
|
|
\begin{description}
|
|
\item[rows]Matrix dimensions. \item[is\_symmetric]Symmetric/hermitian? \item[nb\_max\_elements]Max number of non 0 elements in the matrix (automatically computed if 0). \end{description}
|
|
\end{description}
|
|
\ccGlue
|
|
|
|
%END-AUTO(\ccCreation)
|
|
|
|
|
|
\ccOperations
|
|
|
|
% The section below is automatically generated. Do not edit!
|
|
%START-AUTO(\ccOperations)
|
|
|
|
\ccMethod{int row_dimension () const;}
|
|
{
|
|
Return the matrix' number of rows.
|
|
}
|
|
\ccGlue
|
|
\ccMethod{int column_dimension () const;}
|
|
{
|
|
Return the matrix' number of columns.
|
|
}
|
|
\ccGlue
|
|
\ccMethod{T get_coef (int i, int j) const;}
|
|
{
|
|
Read access to 1 matrix coefficient.
|
|
Preconditions:\begin{itemize}
|
|
\item 0 $<$= i $<$ row\_dimension().\item 0 $<$= j $<$ column\_dimension(). \end{itemize}
|
|
}
|
|
\ccGlue
|
|
\ccMethod{void set_coef (int i, int j, T val);}
|
|
{
|
|
Write access to 1 matrix coefficient: a\_ij $<$- val.
|
|
Optimization: For symmetric matrices, Taucs\_matrix stores only the lower triangle set\_coef() does nothing if (i,j) belongs to the upper triangle.
|
|
Preconditions:\begin{itemize}
|
|
\item 0 $<$= i $<$ row\_dimension().\item 0 $<$= j $<$ column\_dimension(). \end{itemize}
|
|
}
|
|
\ccGlue
|
|
\ccMethod{void add_coef (int i, int j, T val);}
|
|
{
|
|
Write access to 1 matrix coefficient: a\_ij $<$- a\_ij + val.
|
|
Optimization: For symmetric matrices, Taucs\_matrix stores only the lower triangle add\_coef() does nothing if (i,j) belongs to the upper triangle.
|
|
Preconditions:\begin{itemize}
|
|
\item 0 $<$= i $<$ row\_dimension().\item 0 $<$= j $<$ column\_dimension(). \end{itemize}
|
|
}
|
|
\ccGlue
|
|
\ccMethod{const taucs_ccs_matrix* get_taucs_matrix () const;}
|
|
{
|
|
Get TAUCS matrix wrapped by this object.
|
|
}
|
|
\ccGlue
|
|
\ccMethod{taucs_ccs_matrix* get_taucs_matrix ();}
|
|
{
|
|
}
|
|
\ccGlue
|
|
|
|
%END-AUTO(\ccOperations)
|
|
|
|
|
|
\ccSeeAlso
|
|
|
|
\ccRefIdfierPage{CGAL::Taucs_solver_traits} \\
|
|
\ccRefIdfierPage{CGAL::Taucs_symmetric_solver_traits} \\
|
|
\ccRefIdfierPage{CGAL::Taucs_symmetric_matrix} \\
|
|
\ccRefIdfierPage{CGAL::Taucs_vector} \\
|
|
|
|
|
|
\ccExample
|
|
|
|
A Taucs\_matrix object can be used as a 2D array of floating points.
|
|
Use get\_coef() and set\_coef() to access to the matrix elements.
|
|
|
|
\begin{ccExampleCode}
|
|
|
|
typedef CGAL::Taucs_matrix<double> Matrix;
|
|
|
|
int main()
|
|
{
|
|
Matrix m(100, 50); // 100 x 50 elements
|
|
m.set_coef(0, 0, 4.3);
|
|
double val = m.get_coef(0, 0);
|
|
...
|
|
}
|
|
|
|
\end{ccExampleCode}
|
|
|
|
|
|
\end{ccRefClass}
|
|
|
|
% +------------------------------------------------------------------------+
|
|
%%RefPage: end of main body, begin of footer
|
|
% EOF
|
|
% +------------------------------------------------------------------------+
|
|
|