1 /*
2    Copyright (c) 2009-2014, Jack Poulson
3    All rights reserved.
4 
5    This file is part of Elemental and is under the BSD 2-Clause License,
6    which can be found in the LICENSE file in the root directory, or at
7    http://opensource.org/licenses/BSD-2-Clause
8 */
9 #pragma once
10 #ifndef ELEM_HAAR_HPP
11 #define ELEM_HAAR_HPP
12 
13 #include ELEM_QR_INC
14 #include ELEM_GAUSSIAN_INC
15 
16 namespace elem {
17 
18 template<typename F>
19 inline void
Haar(Matrix<F> & A,Int n)20 Haar( Matrix<F>& A, Int n )
21 {
22     DEBUG_ONLY(CallStackEntry cse("Haar"))
23     // TODO: Replace this with a quadratic scheme similar to Stewart's, which
24     //       essentially generates random Householder reflectors
25     Gaussian( A, n, n );
26     qr::Explicit( A );
27 }
28 
29 template<typename F>
30 inline void
ImplicitHaar(Matrix<F> & A,Matrix<F> & t,Matrix<Base<F>> & d,Int n)31 ImplicitHaar( Matrix<F>& A, Matrix<F>& t, Matrix<Base<F>>& d, Int n )
32 {
33     DEBUG_ONLY(CallStackEntry cse("ImplicitHaar"))
34     // TODO: Replace this with a quadratic scheme similar to Stewart's, which
35     //       essentially generates random Householder reflectors
36     Gaussian( A, n, n );
37     QR( A, t, d );
38 }
39 
40 template<typename F>
41 inline void
Haar(DistMatrix<F> & A,Int n)42 Haar( DistMatrix<F>& A, Int n )
43 {
44     DEBUG_ONLY(CallStackEntry cse("Haar"))
45     // TODO: Replace this with a quadratic scheme similar to Stewart's, which
46     //       essentially generates random Householder reflectors
47     Gaussian( A, n, n );
48     qr::Explicit( A );
49 }
50 
51 template<typename F>
52 inline void
ImplicitHaar(DistMatrix<F> & A,DistMatrix<F,MD,STAR> & t,DistMatrix<Base<F>,MD,STAR> & d,Int n)53 ImplicitHaar
54 ( DistMatrix<F>& A, DistMatrix<F,MD,STAR>& t, DistMatrix<Base<F>,MD,STAR>& d,
55   Int n )
56 {
57     DEBUG_ONLY(CallStackEntry cse("Haar"))
58     // TODO: Replace this with a quadratic scheme similar to Stewart's, which
59     //       essentially generates random Householder reflectors
60     Gaussian( A, n, n );
61     QR( A, t, d );
62 }
63 
64 } // namespace elem
65 
66 #endif // ifndef ELEM_HAAR_HPP
67