From becdde3d52c9c488dfe666b6ee13304bfd4d2da8 Mon Sep 17 00:00:00 2001 From: Lorenzo Moneta <Lorenzo.Moneta@cern.ch> Date: Thu, 6 Jul 2006 08:50:27 +0000 Subject: [PATCH] update online doc git-svn-id: http://root.cern.ch/svn/root/trunk@15716 27541ba8-7e3a-0410-8455-c3a389f83636 --- smatrix/doc/SMatrix.html | 2 +- smatrix/doc/SVector.html | 2 +- smatrix/doc/main.html | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/smatrix/doc/SMatrix.html b/smatrix/doc/SMatrix.html index 1b2ae996293..7ba2c34c163 100644 --- a/smatrix/doc/SMatrix.html +++ b/smatrix/doc/SMatrix.html @@ -1 +1 @@ -// SMatrix example of usage /** \page SMatrixDoc SMatrix Class Properties The template ROOT::Math::SMatrix class has 4 template parameters which define, at compile time, its properties. These are: <ul> <li> type of the contained elements, T, for example <em>float</em> or <em>double</em>;</li> <li>number of rows;</li> <li> number of columns;</li> <li>representation type (\ref MatRep). This is a class describing the underlined storage model of the Matrix. Presently exists only two types of this class: <ol> <li>ROOT::Math::MatRepStd for a general nrows x ncols matrix. This class is itself a template on the contained type T, the number of rows and the number of columns. Its data member is an array T[nrows*ncols] containing the matrix data. The data are stored in the row-major C convention. For example, for a matrix, M, of size 3x3, the data \f$ \left[a_0,a_1,a_2,.......,a_7,a_8 \right] \f$ are stored in the following order: \f[ M = \left( \begin{array}{ccc} a_0 & a_1 & a_2 \\ a_3 & a_4 & a_5 \\ a_6 & a_7 & a_8 \end{array} \right) \f] </li> <li>ROOT::Math::MatRepSym for a symmetric matrix of size NxN. This class is a template on the contained type and on the symmetric matrix size, N. It has as data member an array of type T of size N*(N+1)/2, containing the lower diagonal block of the matrix. The order follows the lower diagonal block, still in a row-major convention. For example for a symmetric 3x3 matrix the order of the 6 elements \f$ \left[a_0,a_1.....a_5 \right]\f$ is: \f[ M = \left( \begin{array}{ccc} a_0 & a_1 & a_3 \\ a_1 & a_2 & a_4 \\ a_3 & a_4 & a_5 \end{array} \right) \f] </li> </ol> </li> </ul> <h3>Creating a matrix</h3> The following constructors are available to create a matrix: <ul> <li>Default constructor for a zero matrix (all elements equal to zero).</li> <li>Constructor of an identity matrix.</li> <li>Copy constructor (and assignment) for a matrix with the same representation, or from a different one when possible, for example from a symmetric to a general matrix. </li> <li>Constructor (and assignment) from a matrix expression, like D = A*B + C. Due to the expression template technique, no temporary objects are created in this operation. In the case of an operation like A = A*B + C, a temporary object is needed and it is created automatically to store the intermediary result in order to preserve the validity of this operation. </li> <li>Constructor from a generic STL-like iterator copying the data referred by the iterator, following its order. It is both possible to specify the <em>begin</em> and <em>end</em> of the iterator or the <em>begin</em> and the size. In case of a symmetric matrix, it is required only the triangular block and the user can specify whether giving a block representing the lower (default case) or the upper diagonal part.</li> </ul> <p> Here are some examples on how to create a matrix. We use <em>typedef's</em> in the following examples to avoid the full C++ names for the matrix classes. Notice that for a general matrix the representation has the default value, ROOT::Math::MatRepStd, and it is not needed to be specified. Furtheremore, for a general square matrix, the number of column may be as well omitted. </p> <pre> <em>// typedef definitions used in the following declarations</em> typedef ROOT::Math::SMatrix<double,3> SMatrix33; typedef ROOT::Math::SMatrix<double,2> SMatrix22; typedef ROOT::Math::SMatrix<double,3,3,ROOT::Math::MatRepSym<double,3> > SMatrixSym3; typedef ROOT::Math::SVector>double,2> SVector2; typedef ROOT::Math::SVector>double,3> SVector3; typedef ROOT::Math::SVector>double,6> SVector6; SMatrix33 m0; <em>// create a zero 3x3 matrix</em> <em>// create an 3x3 identity matrix </em> SMatrix33 i = ROOT::Math::SMatrixIdentity(); double a[9] = {1,2,3,4,5,6,7,8,9}; <em>// input matrix data</em> SMatrix33 m(a,9); <em>// create a matrix using the a[] data</em> <em>// this will produce the 3x3 matrix // ( 1 2 3 // 4 5 6 // 7 8 9 )</em> </pre> Example to fill a symmetric matrix from an <em>std::vector</em>: <pre> std::vector<double> v(6); for (int i = 0; i<6; ++i) v[i] = double(i); SMatrixSym3 s(v.begin(),v.end()) // this will produce the symmetric matrix // ( 1 4 5 // 4 2 6 // 5 6 3 ) <em>// create a a general matrix from a symmetric matrix. The opposite will not compile</em> SMatrix33 m2 = s; </pre> <h3>Accessing and Setting Methods</h3> The matrix elements can be set using the <em>operator()(irow,icol)</em>, where irow and icol are the row and column indexes or by using the iterator interface. Notice that the indexes start from zero and not from one as in Fortran. <br> The elements can be accessed by these same methods and also by using the ROOT::Math::SMatrix::apply function. The <em>apply(i)</em> function has exactly the same behavior for general and symmetric matrices, in contrast to the iterator access methods which behave differently (it follows the data order). <pre> SMatrix33 m; m(0,0) = 1; <em> // set the element in first row and first column</em> *(m.<strong>begin</strong>()+1) = 2; <em>// set the second element (0,1)</em> double x = m(2,1); <em>// return the element in third row and first column</em> x = m.<strong>apply</strong>(7); <em>// return the 8-th element (row=2,col=1) </em> x = *(m.<strong>begin</strong>()+7); <em>// return the 8-th element (row=2,col=1)</em> <em>// symmetric matrices (note the difference in behavior between apply and the iterators)</em> x = *(m.<strong>begin</strong>()+4) <em>// return the element (row=2,col=1). </em> x = m.<strong>apply</strong>(7); <em>// returns again the (row=2,col=1) element</em> </pre> There are methods to place and/or retrieve ROOT::Math::SVector objects as rows or columns in (from) a matrix. In addition one can put (get) a sub-matrix as another ROOT::Math::SMatrix object in a matrix. If the size of the the sub-vector or sub-matrix are larger than the matrix size a static assert ( a compilation error) is produced. The non-const methods are: <pre> SMatrix33 m; SVector2 v2(1,2); <em>// place a vector of size 2 in the first row starting from element (0,1) : m(0,1) = v2[0]</em> m.<strong>Place_in_row</strong>(v2,0,1); <em>// place the vector in the second column from (0,1) : m(0,1) = v2[0] </em> m.<strong>Place in_col</strong>(v2,0,1); SMatrix22 m2; <em>// place the sub-matrix m2 in m starting from the element (1,1) : m(1,1) = m2(0,0) </em> m.<strong>Place_at</strong>(m2,1,1); SVector3 v3(1,2,3); <em>// set v3 as the diagonal elements of m : m(i,i) = v3[i] for i=0,1,2</em> m.<strong>SetDiagonal</strong>(v3) </pre> The const methods retrieving contents (getting slices of a matrix) are: <pre> a = {1,2,3,4,5,6,7,8,9}; SMatrix33 m(a,a+9); SVector3 irow = m.<strong>Row</strong>(0); <em>// return as vector the first matrix row </em> SVector3 jcol = m.<strong>Col</strong>(1); <em>// return as vector the second matrix column </em> <em>// return a slice of the first row from element (0,1) : r2[0] = m(0,1); r2[1] = m(0,2)</em> SVector2 r2 = m.<strong>SubRow</strong><SVector2> (0,1); <em>// return a slice of the second column from element (0,1) : c2[0] = m(0,1); c2[1] = m(1,1);</em> SVector2 c2 = m.<strong>SubCol</strong><SVector2> (1,0); <em>// return a sub-matrix 2x2 with the upper left corner at the values (1,1)</em> SMatrix22 subM = m.<strong>Sub</strong><SMatrix22> (1,1); <em>// return the diagonal element in a SVector</em> SVector3 diag = m.<strong>Diagonal</strong>(); <em>// return the upper(lower) block of the matrix m</em> SVector6 vub = m.<strong>UpperBlock</strong>(); <em>// vub = [ 1, 2, 3, 5, 6, 9 ]</em> SVector6 vlb = m.<strong>LowerBlock</strong>(); <em> // vlb = [ 1, 4, 5, 7, 8, 9 ] </em> </pre> <h3>Linear Algebra Functions</h3> Only limited linear algebra functionality is available for SMatrix. It is possible for squared matrices NxN, to find the inverse or to calculate the determinant. Different inversion algorithms are used if the matrix is smaller than 6x6 or if it is symmetric. In the case of a small matrix, a faster direct inversion is used. For a large (N > 6) symmetric matrix the Bunch-Kaufman diagonal pivoting method is used while for a large (N > 6) general matrix an LU factorization is performed using the same algorithm as in the CERNLIB routine <a href="http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/f010/top.html">dinv</a>. <pre> <em>// Invert a NxN matrix. The inverted matrix replace the existing one and returns if the result is successful</em> bool ret = m.<strong>Invert</strong>() <em>// return the inverse matrix of m. If the inversion fails ifail is different than zero</em> int ifail = 0; mInv = m.<strong>Inverse</strong>(ifail); </pre> The determinant of a square matrix can be obtained as follows: <pre> double det; <em>// calculate the determinant modyfing the matrix content. Returns if the calculation was successful</em> bool ret = m.<strong>Det</strong>(det); <em>// calculate the determinant using a temporary matrix but preserving the matrix content </em> bool ret = n.<strong>Det2</strong>(det); </pre> <br> For additional Matrix functionality see the \ref MatVecFunctions page */ \ No newline at end of file +// SMatrix example of usage /** \page SMatrixDoc SMatrix Class Properties The template ROOT::Math::SMatrix class has 4 template parameters which define, at compile time, its properties. These are: <ul> <li> type of the contained elements, T, for example <em>float</em> or <em>double</em>;</li> <li>number of rows;</li> <li> number of columns;</li> <li>representation type (\ref MatRep). This is a class describing the underlined storage model of the Matrix. Presently exists only two types of this class: <ol> <li>ROOT::Math::MatRepStd for a general nrows x ncols matrix. This class is itself a template on the contained type T, the number of rows and the number of columns. Its data member is an array T[nrows*ncols] containing the matrix data. The data are stored in the row-major C convention. For example, for a matrix, M, of size 3x3, the data \f$ \left[a_0,a_1,a_2,.......,a_7,a_8 \right] \f$ are stored in the following order: \f[ M = \left( \begin{array}{ccc} a_0 & a_1 & a_2 \\ a_3 & a_4 & a_5 \\ a_6 & a_7 & a_8 \end{array} \right) \f] </li> <li>ROOT::Math::MatRepSym for a symmetric matrix of size NxN. This class is a template on the contained type and on the symmetric matrix size, N. It has as data member an array of type T of size N*(N+1)/2, containing the lower diagonal block of the matrix. The order follows the lower diagonal block, still in a row-major convention. For example for a symmetric 3x3 matrix the order of the 6 elements \f$ \left[a_0,a_1.....a_5 \right]\f$ is: \f[ M = \left( \begin{array}{ccc} a_0 & a_1 & a_3 \\ a_1 & a_2 & a_4 \\ a_3 & a_4 & a_5 \end{array} \right) \f] </li> </ol> </li> </ul> <h3>Creating a matrix</h3> The following constructors are available to create a matrix: <ul> <li>Default constructor for a zero matrix (all elements equal to zero).</li> <li>Constructor of an identity matrix.</li> <li>Copy constructor (and assignment) for a matrix with the same representation, or from a different one when possible, for example from a symmetric to a general matrix. </li> <li>Constructor (and assignment) from a matrix expression, like D = A*B + C. Due to the expression template technique, no temporary objects are created in this operation. In the case of an operation like A = A*B + C, a temporary object is needed and it is created automatically to store the intermediary result in order to preserve the validity of this operation. </li> <li>Constructor from a generic STL-like iterator copying the data referred by the iterator, following its order. It is both possible to specify the <em>begin</em> and <em>end</em> of the iterator or the <em>begin</em> and the size. In case of a symmetric matrix, it is required only the triangular block and the user can specify whether giving a block representing the lower (default case) or the upper diagonal part.</li> </ul> <p> Here are some examples on how to create a matrix. We use <em>typedef's</em> in the following examples to avoid the full C++ names for the matrix classes. Notice that for a general matrix the representation has the default value, ROOT::Math::MatRepStd, and it is not needed to be specified. Furtheremore, for a general square matrix, the number of column may be as well omitted. </p> <pre> <em>// typedef definitions used in the following declarations</em> typedef ROOT::Math::SMatrix<double,3> SMatrix33; typedef ROOT::Math::SMatrix<double,2> SMatrix22; typedef ROOT::Math::SMatrix<double,3,3,ROOT::Math::MatRepSym<double,3> > SMatrixSym3; typedef ROOT::Math::SVector>double,2> SVector2; typedef ROOT::Math::SVector>double,3> SVector3; typedef ROOT::Math::SVector>double,6> SVector6; SMatrix33 m0; <em>// create a zero 3x3 matrix</em> <em>// create an 3x3 identity matrix </em> SMatrix33 i = ROOT::Math::SMatrixIdentity(); double a[9] = {1,2,3,4,5,6,7,8,9}; <em>// input matrix data</em> SMatrix33 m(a,9); <em>// create a matrix using the a[] data</em> <em>// this will produce the 3x3 matrix // ( 1 2 3 // 4 5 6 // 7 8 9 )</em> </pre> Example to fill a symmetric matrix from an <em>std::vector</em>: <pre> std::vector<double> v(6); for (int i = 0; i<6; ++i) v[i] = double(i); SMatrixSym3 s(v.begin(),v.end()) // this will produce the symmetric matrix // ( 1 4 5 // 4 2 6 // 5 6 3 ) <em>// create a a general matrix from a symmetric matrix. The opposite will not compile</em> SMatrix33 m2 = s; </pre> <h3>Accessing and Setting Methods</h3> The matrix elements can be set using the <em>operator()(irow,icol)</em>, where irow and icol are the row and column indexes or by using the iterator interface. Notice that the indexes start from zero and not from one as in FORTRAN. All the matrix elements can be set also by using the ROOT::Math::SetElements function passing a generic iterator. <br> The elements can be accessed by these same methods and also by using the ROOT::Math::SMatrix::apply function. The <em>apply(i)</em> function has exactly the same behavior for general and symmetric matrices, in contrast to the iterator access methods which behave differently (it follows the data order). <pre> SMatrix33 m; m(0,0) = 1; <em> // set the element in first row and first column</em> *(m.<strong>begin</strong>()+1) = 2; <em>// set the second element (0,1)</em> double d[9]={1,2,3,4,5,6,7,8,9}; m.SetElements(d,d+9); <em>// set the d[] values in m</em> double x = m(2,1); <em>// return the element in third row and first column</em> x = m.<strong>apply</strong>(7); <em>// return the 8-th element (row=2,col=1) </em> x = *(m.<strong>begin</strong>()+7); <em>// return the 8-th element (row=2,col=1)</em> <em>// symmetric matrices (note the difference in behavior between apply and the iterators)</em> x = *(m.<strong>begin</strong>()+4) <em>// return the element (row=2,col=1). </em> x = m.<strong>apply</strong>(7); <em>// returns again the (row=2,col=1) element</em> </pre> There are methods to place and/or retrieve ROOT::Math::SVector objects as rows or columns in (from) a matrix. In addition one can put (get) a sub-matrix as another ROOT::Math::SMatrix object in a matrix. If the size of the the sub-vector or sub-matrix are larger than the matrix size a static assert ( a compilation error) is produced. The non-const methods are: <pre> SMatrix33 m; SVector2 v2(1,2); <em>// place a vector of size 2 in the first row starting from element (0,1) : m(0,1) = v2[0]</em> m.<strong>Place_in_row</strong>(v2,0,1); <em>// place the vector in the second column from (0,1) : m(0,1) = v2[0] </em> m.<strong>Place in_col</strong>(v2,0,1); SMatrix22 m2; <em>// place the sub-matrix m2 in m starting from the element (1,1) : m(1,1) = m2(0,0) </em> m.<strong>Place_at</strong>(m2,1,1); SVector3 v3(1,2,3); <em>// set v3 as the diagonal elements of m : m(i,i) = v3[i] for i=0,1,2</em> m.<strong>SetDiagonal</strong>(v3) </pre> The const methods retrieving contents (getting slices of a matrix) are: <pre> a = {1,2,3,4,5,6,7,8,9}; SMatrix33 m(a,a+9); SVector3 irow = m.<strong>Row</strong>(0); <em>// return as vector the first matrix row </em> SVector3 jcol = m.<strong>Col</strong>(1); <em>// return as vector the second matrix column </em> <em>// return a slice of the first row from element (0,1) : r2[0] = m(0,1); r2[1] = m(0,2)</em> SVector2 r2 = m.<strong>SubRow</strong><SVector2> (0,1); <em>// return a slice of the second column from element (0,1) : c2[0] = m(0,1); c2[1] = m(1,1);</em> SVector2 c2 = m.<strong>SubCol</strong><SVector2> (1,0); <em>// return a sub-matrix 2x2 with the upper left corner at the values (1,1)</em> SMatrix22 subM = m.<strong>Sub</strong><SMatrix22> (1,1); <em>// return the diagonal element in a SVector</em> SVector3 diag = m.<strong>Diagonal</strong>(); <em>// return the upper(lower) block of the matrix m</em> SVector6 vub = m.<strong>UpperBlock</strong>(); <em>// vub = [ 1, 2, 3, 5, 6, 9 ]</em> SVector6 vlb = m.<strong>LowerBlock</strong>(); <em> // vlb = [ 1, 4, 5, 7, 8, 9 ] </em> </pre> <h3>Linear Algebra Functions</h3> Only limited linear algebra functionality is available for SMatrix. It is possible for squared matrices NxN, to find the inverse or to calculate the determinant. Different inversion algorithms are used if the matrix is smaller than 6x6 or if it is symmetric. In the case of a small matrix, a faster direct inversion is used. For a large (N > 6) symmetric matrix the Bunch-Kaufman diagonal pivoting method is used while for a large (N > 6) general matrix an LU factorization is performed using the same algorithm as in the CERNLIB routine <a href="http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/f010/top.html">dinv</a>. <pre> <em>// Invert a NxN matrix. The inverted matrix replace the existing one and returns if the result is successful</em> bool ret = m.<strong>Invert</strong>() <em>// return the inverse matrix of m. If the inversion fails ifail is different than zero</em> int ifail = 0; mInv = m.<strong>Inverse</strong>(ifail); </pre> The determinant of a square matrix can be obtained as follows: <pre> double det; <em>// calculate the determinant modyfing the matrix content. Returns if the calculation was successful</em> bool ret = m.<strong>Det</strong>(det); <em>// calculate the determinant using a temporary matrix but preserving the matrix content </em> bool ret = n.<strong>Det2</strong>(det); </pre> <br> For additional Matrix functionality see the \ref MatVecFunctions page */ \ No newline at end of file diff --git a/smatrix/doc/SVector.html b/smatrix/doc/SVector.html index a1819d3a1d4..9c90b19a5f0 100644 --- a/smatrix/doc/SVector.html +++ b/smatrix/doc/SVector.html @@ -1 +1 @@ -// SVector example of usage /** \page SVectorDoc SVector Class Properties The template ROOT::Math::SVector class has 2 template parameters which define, at compile time, its properties. These are: <ul> <li> type of the contained elements, for example <em>float</em> or double. </li> <li>size of the vector.</li> </ul> <h3>Creating a Vector </h3> The following constructors are available to create a vector: <ul> <li>Default constructor for a zero vector (all elements equal to zero)</li> <li>Constructor (and assignment) from a vector expression, like v = p*q + w. Due to the expression template technique, no temporary objects are created in this operation. </li> <li>Construct a vector passing directly the elements. This is possible only for vector up to size 10. <li>Constructor from an iterator copying the data refered by the iterator. It is possible to specify the <em>begin</em> and <em>end</em> of the iterator or the <em>begin</em> and the size. Note that for the Vector the iterator is not generic and must be of type <em>T*,</em> where T is the type of the contained elements. </li> </ul> <p>Here are some examples on how to create a vector. In the following we assume that we are using the namespace ROOT::Math. </p> <pre> SVector>double,N> v; <em>// create a vector of size N, v[i]=0 </em> SVector>double,3> v(1,2,3); <em>// create a vector of size 3, v[0]=1,v[1]=2,v[2]=3 </em> double a[9] = {1,2,3,4,5,6,7,8,9}; <em>// input data</em> SVector>double,9> v(a,9); <em>// create a vector using the a[] data</em> </pre> <h3>Accessing and Setting Methods</h3> The single vector elements can be set or retrieved using the <em>operator[i]</em> , <em>operator(i)</em> or the iterator interface. Notice that the index starts from zero and not from one as in Fortran. Also no check is performed on the passed index. The elements can be accessed also by using the ROOT::Math::SVector::apply(i) function. <pre> v[0] = 1; <em> // set the first element </em> v(1) = 2; <em> // set the second element </em> *(v.<strong>begin</strong>()+3) = 3; <em> // set the third element </em> double x = m(i); <em>// return the i-th element</em> x = m.<strong>apply</strong>(i); <em>// return the i-th element </em> x = *(m.<strong>begin</strong>()+i); <em>// return the i-th element </em> </pre> In addition there are methods to place a sub-vector in a vector. If the size of the the sub-vector is larger than the vector size a static assert ( a compilation error) is produced. <pre> SVector>double,N> v; SVector>double,M> w; <em>// M <= N otherwise a compilation error is obtained later </em> <em>// place a vector of size M starting from element ioff, v[ioff + i] = w[i]</em> v.<strong>Place_at</strong>(w,ioff); <em>// return a sub-vector of size M starting from v[ioff]: w[i] = v[ioff + i]</em> w = v.Sub < SVector>double,M> > (ioff); </pre> For additional Vector functionality see the \ref MatVecFunctions page */ \ No newline at end of file +// SVector example of usage /** \page SVectorDoc SVector Class Properties The template ROOT::Math::SVector class has 2 template parameters which define, at compile time, its properties. These are: <ul> <li> type of the contained elements, for example <em>float</em> or double. </li> <li>size of the vector.</li> </ul> <h3>Creating a Vector </h3> The following constructors are available to create a vector: <ul> <li>Default constructor for a zero vector (all elements equal to zero)</li> <li>Constructor (and assignment) from a vector expression, like v = p*q + w. Due to the expression template technique, no temporary objects are created in this operation. </li> <li>Construct a vector passing directly the elements. This is possible only for vector up to size 10. <li>Constructor from an iterator copying the data refered by the iterator. It is possible to specify the <em>begin</em> and <em>end</em> of the iterator or the <em>begin</em> and the size. Note that for the Vector the iterator is not generic and must be of type <em>T*,</em> where T is the type of the contained elements. </li> </ul> <p>Here are some examples on how to create a vector. In the following we assume that we are using the namespace ROOT::Math. </p> <pre> SVector>double,N> v; <em>// create a vector of size N, v[i]=0 </em> SVector>double,3> v(1,2,3); <em>// create a vector of size 3, v[0]=1,v[1]=2,v[2]=3 </em> double a[9] = {1,2,3,4,5,6,7,8,9}; <em>// input data</em> SVector>double,9> v(a,9); <em>// create a vector using the a[] data</em> </pre> <h3>Accessing and Setting Methods</h3> The single vector elements can be set or retrieved using the <em>operator[i]</em> , <em>operator(i)</em> or the iterator interface. Notice that the index starts from zero and not from one as in FORTRAN. Also no check is performed on the passed index. Furthermore, all the matrix elements can be set also by using the ROOT::SVector::SetElements function passing a generic iterator. The elements can be accessed also by using the ROOT::Math::SVector::apply(i) function. <pre> v[0] = 1; <em> // set the first element </em> v(1) = 2; <em> // set the second element </em> *(v.<strong>begin</strong>()+3) = 3; <em> // set the third element </em> <em>// set vector elements from a std::vector<double>::iterator</em> std::vector<double> w(3); v.SetElements(w.begin(),w.end()); double x = m(i); <em>// return the i-th element</em> x = m.<strong>apply</strong>(i); <em>// return the i-th element </em> x = *(m.<strong>begin</strong>()+i); <em>// return the i-th element </em> </pre> In addition there are methods to place a sub-vector in a vector. If the size of the the sub-vector is larger than the vector size a static assert ( a compilation error) is produced. <pre> SVector>double,N> v; SVector>double,M> w; <em>// M <= N otherwise a compilation error is obtained later </em> <em>// place a vector of size M starting from element ioff, v[ioff + i] = w[i]</em> v.<strong>Place_at</strong>(w,ioff); <em>// return a sub-vector of size M starting from v[ioff]: w[i] = v[ioff + i]</em> w = v.Sub < SVector>double,M> > (ioff); </pre> For additional Vector functionality see the \ref MatVecFunctions page */ \ No newline at end of file diff --git a/smatrix/doc/main.html b/smatrix/doc/main.html index 59dea7e0c5f..3ca6920a00c 100644 --- a/smatrix/doc/main.html +++ b/smatrix/doc/main.html @@ -25,7 +25,7 @@ For a more detailed descriptions and usage examples see: <li>\ref MatVecFunctions </ul> <p> -The SMatrix package contains only header files. Normally one does not need to build any library. In the %ROOT distribution a library, <em>libSmatrix</em> is produced with the C++ dictionary information for some squared matrices and vectors. +The SMatrix package contains only header files. Normally one does not need to build any library. In the %ROOT distribution a library, <em>libSmatrix</em> is produced with the C++ dictionary information for vectors, symmetric and squared matrices for double, float types up to dimension 7. <br> The current version of SMatrix can be downloaded from <A HREF="../SMatrix.tar.gz">here</A>. If you want to install the header files or run the test <em>configure</em> script and then <em>make install</em> or <em>make check</em> to build the tests. No dictionary library is built in this case. <br> @@ -35,7 +35,6 @@ The current version of SMatrix can be downloaded from <A HREF="../SMatrix.tar.gz <li>T. Veldhuizen, <a href="http://osl.iu.edu/~tveldhui/papers/Expression-Templates/exprtmpl.html"><em>Expression Templates</em></a>, C++ Report, 1995. <li>T. Glebe, <em>SMatrix - A high performance library for Vector/Matrix calculation and Vertexing</em>, HERA-B Software Note 01-134, December 2, 2003 (<A HREF="http://seal.web.cern.ch/seal/documents/mathlib/smatrix_herab.pdf">pdf</A>)</li> <li>L. Moneta, %ROOT Math proposal for Linear Algebra, <A HREF="http://seal.cern.ch/documents/mathlib/aa_matrix_nov05.pdf">presentation</A> at the LCG Application Area meeting, November 23, 2005</li> -<li> </ol> <hr> -- GitLab