1 //=================================================================================================
2 /*!
3 //  \file blaze/math/lapack/clapack/org2l.h
4 //  \brief Header file for the CLAPACK org2l wrapper functions
5 //
6 //  Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved
7 //
8 //  This file is part of the Blaze library. You can redistribute it and/or modify it under
9 //  the terms of the New (Revised) BSD License. Redistribution and use in source and binary
10 //  forms, with or without modification, are permitted provided that the following conditions
11 //  are met:
12 //
13 //  1. Redistributions of source code must retain the above copyright notice, this list of
14 //     conditions and the following disclaimer.
15 //  2. Redistributions in binary form must reproduce the above copyright notice, this list
16 //     of conditions and the following disclaimer in the documentation and/or other materials
17 //     provided with the distribution.
18 //  3. Neither the names of the Blaze development group nor the names of its contributors
19 //     may be used to endorse or promote products derived from this software without specific
20 //     prior written permission.
21 //
22 //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
23 //  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 //  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 //  SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 //  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27 //  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 //  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 //  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 //  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 //  DAMAGE.
32 */
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_LAPACK_CLAPACK_ORG2L_H_
36 #define _BLAZE_MATH_LAPACK_CLAPACK_ORG2L_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/blas/Types.h>
44 #include <blaze/util/Complex.h>
45 #include <blaze/util/StaticAssert.h>
46 
47 
48 //=================================================================================================
49 //
50 //  LAPACK FORWARD DECLARATIONS
51 //
52 //=================================================================================================
53 
54 //*************************************************************************************************
55 /*! \cond BLAZE_INTERNAL */
56 #if !defined(INTEL_MKL_VERSION)
57 extern "C" {
58 
59 void sorg2l_( blaze::blas_int_t* m, blaze::blas_int_t* n, blaze::blas_int_t* k, float* A,
60               blaze::blas_int_t* lda, float* tau, float* work, blaze::blas_int_t* info );
61 void dorg2l_( blaze::blas_int_t* m, blaze::blas_int_t* n, blaze::blas_int_t* k, double* A,
62               blaze::blas_int_t* lda, double* tau, double* work, blaze::blas_int_t* info );
63 
64 }
65 #endif
66 /*! \endcond */
67 //*************************************************************************************************
68 
69 
70 
71 
72 namespace blaze {
73 
74 //=================================================================================================
75 //
76 //  LAPACK FUNCTIONS TO RECONSTRUCT Q FROM A QL DECOMPOSITION (ORG2L)
77 //
78 //=================================================================================================
79 
80 //*************************************************************************************************
81 /*!\name LAPACK functions to reconstruct Q from a QL decomposition (org2l) */
82 //@{
83 void org2l( blas_int_t m, blas_int_t n, blas_int_t k, float* A, blas_int_t lda,
84             const float* tau, float* work, blas_int_t* info );
85 
86 void org2l( blas_int_t m, blas_int_t n, blas_int_t k, double* A, blas_int_t lda,
87             const double* tau, double* work, blas_int_t* info );
88 //@}
89 //*************************************************************************************************
90 
91 
92 //*************************************************************************************************
93 /*!\brief LAPACK kernel for the reconstruction of the orthogonal matrix Q from a QL decomposition.
94 // \ingroup lapack_decomposition
95 //
96 // \param m The number of rows of the given matrix \f$[0..\infty)\f$.
97 // \param n The number of columns of the given matrix \f$[0..m)\f$.
98 // \param k The number of elementary reflectors, whose product defines the matrix \f$[0..n)\f$.
99 // \param A Pointer to the first element of the single precision column-major matrix.
100 // \param lda The total number of elements between two columns of the matrix \f$[0..\infty)\f$.
101 // \param tau Array for the scalar factors of the elementary reflectors; size >= min( \a m, \a n ).
102 // \param work Auxiliary array; size == \a n.
103 // \param info Return code of the function call.
104 // \return void
105 //
106 // This function generates all or part of the orthogonal matrix Q from a QL decomposition based on
107 // the LAPACK sorg2l() function for single precision column-major matrices that have already been
108 // factorized by the sgeqlf() function. The \a info argument provides feedback on the success of
109 // the function call:
110 //
111 //   - = 0: The decomposition finished successfully.
112 //   - < 0: The i-th argument had an illegal value.
113 //
114 // For more information on the sorg2l() function, see the LAPACK online documentation browser:
115 //
116 //        http://www.netlib.org/lapack/explore-html/
117 //
118 // \note This function can only be used if a fitting LAPACK library, which supports this function,
119 // is available and linked to the executable. Otherwise a call to this function will result in a
120 // linker error.
121 */
org2l(blas_int_t m,blas_int_t n,blas_int_t k,float * A,blas_int_t lda,const float * tau,float * work,blas_int_t * info)122 inline void org2l( blas_int_t m, blas_int_t n, blas_int_t k, float* A, blas_int_t lda,
123                    const float* tau, float* work, blas_int_t* info )
124 {
125 #if defined(INTEL_MKL_VERSION)
126    BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
127 #endif
128 
129    sorg2l_( &m, &n, &k, A, &lda, const_cast<float*>( tau ), work, info );
130 }
131 //*************************************************************************************************
132 
133 
134 //*************************************************************************************************
135 /*!\brief LAPACK kernel for the reconstruction of the orthogonal matrix Q from a QL decomposition.
136 // \ingroup lapack_decomposition
137 //
138 // \param m The number of rows of the given matrix \f$[0..\infty)\f$.
139 // \param n The number of columns of the given matrix \f$[0..m)\f$.
140 // \param k The number of elementary reflectors, whose product defines the matrix \f$[0..n)\f$.
141 // \param A Pointer to the first element of the double precision column-major matrix.
142 // \param lda The total number of elements between two columns of the matrix \f$[0..\infty)\f$.
143 // \param tau Array for the scalar factors of the elementary reflectors; size >= min( \a m, \a n ).
144 // \param work Auxiliary array; size == \a n.
145 // \param info Return code of the function call.
146 // \return void
147 //
148 // This function generates all or part of the orthogonal matrix Q from a QL decomposition based on
149 // the LAPACK dorg2l() function for double precision column-major matrices that have already been
150 // factorized by the dgeqlf() function. The \a info argument provides feedback on the success of
151 // the function call:
152 //
153 //   - = 0: The decomposition finished successfully.
154 //   - < 0: The i-th argument had an illegal value.
155 //
156 // For more information on the dorg2l() function, see the LAPACK online documentation browser:
157 //
158 //        http://www.netlib.org/lapack/explore-html/
159 //
160 // \note This function can only be used if a fitting LAPACK library, which supports this function,
161 // is available and linked to the executable. Otherwise a call to this function will result in a
162 // linker error.
163 */
org2l(blas_int_t m,blas_int_t n,blas_int_t k,double * A,blas_int_t lda,const double * tau,double * work,blas_int_t * info)164 inline void org2l( blas_int_t m, blas_int_t n, blas_int_t k, double* A, blas_int_t lda,
165                    const double* tau, double* work, blas_int_t* info )
166 {
167 #if defined(INTEL_MKL_VERSION)
168    BLAZE_STATIC_ASSERT( sizeof( MKL_INT ) == sizeof( blas_int_t ) );
169 #endif
170 
171    dorg2l_( &m, &n, &k, A, &lda, const_cast<double*>( tau ), work, info );
172 }
173 //*************************************************************************************************
174 
175 } // namespace blaze
176 
177 #endif
178