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 DGESVJ( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,
36 $ LDV, 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_SVJ_H
55 #define FLENS_LAPACK_SVD_SVJ_H 1
56
57 #include <flens/matrixtypes/matrixtypes.h>
58 #include <flens/vectortypes/vectortypes.h>
59
60 namespace flens { namespace lapack {
61
62 namespace SVJ {
63
64 enum TypeA {
65 Lower = 'L',
66 Upper = 'U',
67 General = 'G'
68 };
69
70 enum JobU {
71 ComputeU = 'U',
72 ControlU = 'C',
73 NoU = 'N'
74 };
75
76 enum JobV {
77 ComputeV = 'V',
78 ApplyV = 'A',
79 NoV = 'N'
80 };
81 }
82
83 //== svj =======================================================================
84 template <typename MA, typename VSVA, typename MV, typename VWORK>
85 typename GeMatrix<MA>::IndexType
86 svj(SVJ::JobU jobU,
87 SVJ::JobV jobV,
88 GeMatrix<MA> &A,
89 DenseVector<VSVA> &sva,
90 GeMatrix<MV> &V,
91 DenseVector<VWORK> &work);
92
93 template <typename MA, typename VSVA, typename MV, typename VWORK>
94 typename GeMatrix<MA>::IndexType
95 svj(SVJ::JobU jobU,
96 SVJ::JobV jobV,
97 TrMatrix<MA> &A,
98 DenseVector<VSVA> &sva,
99 GeMatrix<MV> &V,
100 DenseVector<VWORK> &work);
101
102 template <typename MA, typename VSVA, typename MV, typename VWORK>
103 typename GeMatrix<MA>::IndexType
104 svj(SVJ::TypeA typeA,
105 SVJ::JobU jobU,
106 SVJ::JobV jobV,
107 GeMatrix<MA> &A,
108 DenseVector<VSVA> &sva,
109 GeMatrix<MV> &V,
110 DenseVector<VWORK> &work);
111
112 //-- forwarding ----------------------------------------------------------------
113 template <typename MA, typename VSVA, typename MV, typename VWORK>
114 typename MA::IndexType
115 svj(SVJ::TypeA typeA,
116 SVJ::JobU jobU,
117 SVJ::JobV jobV,
118 MA &&A,
119 VSVA &&sva,
120 MV &&V,
121 VWORK &&work);
122
123 template <typename MA, typename VSVA, typename MV, typename VWORK>
124 typename MA::IndexType
125 svj(SVJ::JobU jobU,
126 SVJ::JobV jobV,
127 MA &&A,
128 VSVA &&sva,
129 MV &&V,
130 VWORK &&work);
131
132 } } // namespace lapack, flens
133
134 #endif // FLENS_LAPACK_SVD_SVJ_H
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 DGESVJ( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,
36 $ LDV, 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_SVJ_H
55 #define FLENS_LAPACK_SVD_SVJ_H 1
56
57 #include <flens/matrixtypes/matrixtypes.h>
58 #include <flens/vectortypes/vectortypes.h>
59
60 namespace flens { namespace lapack {
61
62 namespace SVJ {
63
64 enum TypeA {
65 Lower = 'L',
66 Upper = 'U',
67 General = 'G'
68 };
69
70 enum JobU {
71 ComputeU = 'U',
72 ControlU = 'C',
73 NoU = 'N'
74 };
75
76 enum JobV {
77 ComputeV = 'V',
78 ApplyV = 'A',
79 NoV = 'N'
80 };
81 }
82
83 //== svj =======================================================================
84 template <typename MA, typename VSVA, typename MV, typename VWORK>
85 typename GeMatrix<MA>::IndexType
86 svj(SVJ::JobU jobU,
87 SVJ::JobV jobV,
88 GeMatrix<MA> &A,
89 DenseVector<VSVA> &sva,
90 GeMatrix<MV> &V,
91 DenseVector<VWORK> &work);
92
93 template <typename MA, typename VSVA, typename MV, typename VWORK>
94 typename GeMatrix<MA>::IndexType
95 svj(SVJ::JobU jobU,
96 SVJ::JobV jobV,
97 TrMatrix<MA> &A,
98 DenseVector<VSVA> &sva,
99 GeMatrix<MV> &V,
100 DenseVector<VWORK> &work);
101
102 template <typename MA, typename VSVA, typename MV, typename VWORK>
103 typename GeMatrix<MA>::IndexType
104 svj(SVJ::TypeA typeA,
105 SVJ::JobU jobU,
106 SVJ::JobV jobV,
107 GeMatrix<MA> &A,
108 DenseVector<VSVA> &sva,
109 GeMatrix<MV> &V,
110 DenseVector<VWORK> &work);
111
112 //-- forwarding ----------------------------------------------------------------
113 template <typename MA, typename VSVA, typename MV, typename VWORK>
114 typename MA::IndexType
115 svj(SVJ::TypeA typeA,
116 SVJ::JobU jobU,
117 SVJ::JobV jobV,
118 MA &&A,
119 VSVA &&sva,
120 MV &&V,
121 VWORK &&work);
122
123 template <typename MA, typename VSVA, typename MV, typename VWORK>
124 typename MA::IndexType
125 svj(SVJ::JobU jobU,
126 SVJ::JobV jobV,
127 MA &&A,
128 VSVA &&sva,
129 MV &&V,
130 VWORK &&work);
131
132 } } // namespace lapack, flens
133
134 #endif // FLENS_LAPACK_SVD_SVJ_H