1 /*
 2  *   Copyright (c) 2012, Michael Lehn
 3  *
 4  *   All rights reserved.
 5  *
 6  *   Redistribution and use in source and binary forms, with or without
 7  *   modification, are permitted provided that the following conditions
 8  *   are met:
 9  *
10  *   1) Redistributions of source code must retain the above copyright
11  *      notice, this list of conditions and the following disclaimer.
12  *   2) Redistributions in binary form must reproduce the above copyright
13  *      notice, this list of conditions and the following disclaimer in
14  *      the documentation and/or other materials provided with the
15  *      distribution.
16  *   3) Neither the name of the FLENS development group nor the names of
17  *      its contributors may be used to endorse or promote products derived
18  *      from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /* Based on
34  *
35        SUBROUTINE DGSVJ1( JOBV, M, N, N1, A, LDA, D, SVA, MV, V, LDV,
36       $                   EPS, SFMIN, TOL, NSWEEP, WORK, LWORK, INFO )
37  *
38  *  -- LAPACK routine (version 3.3.1)                                  --
39  *
40  *  -- Contributed by Zlatko Drmac of the University of Zagreb and     --
41  *  -- Kresimir Veselic of the Fernuniversitaet Hagen                  --
42  *  -- April 2011                                                      --
43  *
44  *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
45  *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
46  *
47  * This routine is also part of SIGMA (version 1.23, October 23. 2008.)
48  * SIGMA is a library of algorithms for highly accurate algorithms for
49  * computation of SVD, PSVD, QSVD, (H,K)-SVD, and for solution of the
50  * eigenvalue problems Hx = lambda M x, H M x = lambda x with H, M > 0.
51  *
52  */
53 
54 #ifndef FLENS_LAPACK_SVD_SVJ1_H
55 #define FLENS_LAPACK_SVD_SVJ1_H 1
56 
57 #include <flens/lapack/svd/svj.h>
58 #include <flens/matrixtypes/matrixtypes.h>
59 #include <flens/vectortypes/vectortypes.h>
60 
61 namespace flens { namespace lapack {
62 
63 //== svj1 ======================================================================
64 template <typename MA, typename VD, typename VSVA, typename MV, typename VWORK>
65     typename GeMatrix<MA>::IndexType
66     svj1(SVJ::JobV                                  jobV,
67          typename GeMatrix<MA>::IndexType           n1,
68          GeMatrix<MA>                               &A,
69          DenseVector<VD>                            &d,
70          DenseVector<VSVA>                          &sva,
71          GeMatrix<MV>                               &V,
72          const typename GeMatrix<MA>::ElementType   &eps,
73          const typename GeMatrix<MA>::ElementType   &safeMin,
74          const typename GeMatrix<MA>::ElementType   &tol,
75          typename GeMatrix<MA>::IndexType           nSweep,
76          DenseVector<VWORK>                         &work);
77 
78 //-- forwarding ----------------------------------------------------------------
79 template <typename MA, typename VD, typename VSVA, typename MV, typename VWORK>
80     typename MA::IndexType
81     svj1(SVJ::JobV                                  jobV,
82          typename MA::IndexType                     n1,
83          MA                                         &&A,
84          VD                                         &&d,
85          VSVA                                       &&sva,
86          MV                                         &&V,
87          const typename MA::ElementType             &eps,
88          const typename MA::ElementType             &safeMin,
89          const typename MA::ElementType             &tol,
90          typename MA::IndexType                     nSweep,
91          VWORK                                      &&work);
92 
93 } } // namespace lapack, flens
94 
95 #endif // FLENS_LAPACK_SVD_SVJ1_H