comparison armadillo-3.900.4/include/armadillo_bits/fn_syl_lyap.hpp @ 49:1ec0e2823891

Switch to using subrepo copies of qm-dsp, nnls-chroma, vamp-plugin-sdk; update Armadillo version; assume build without external BLAS/LAPACK
author Chris Cannam
date Thu, 13 Jun 2013 10:25:24 +0100
parents
children
comparison
equal deleted inserted replaced
48:69251e11a913 49:1ec0e2823891
1 // Copyright (C) 2011-2012 NICTA (www.nicta.com.au)
2 // Copyright (C) 2011-2012 Conrad Sanderson
3 //
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8
9 //! \addtogroup fn_syl_lyap
10 //! @{
11
12
13 //! find the solution of the Sylvester equation AX + XB = C
14 template<typename T1, typename T2, typename T3>
15 inline
16 bool
17 syl
18 (
19 Mat <typename T1::elem_type> & out,
20 const Base<typename T1::elem_type,T1>& in_A,
21 const Base<typename T1::elem_type,T2>& in_B,
22 const Base<typename T1::elem_type,T3>& in_C,
23 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
24 )
25 {
26 arma_extra_debug_sigprint();
27 arma_ignore(junk);
28
29 typedef typename T1::elem_type eT;
30
31 const unwrap_check<T1> tmp_A(in_A.get_ref(), out);
32 const unwrap_check<T2> tmp_B(in_B.get_ref(), out);
33 const unwrap_check<T3> tmp_C(in_C.get_ref(), out);
34
35 const Mat<eT>& A = tmp_A.M;
36 const Mat<eT>& B = tmp_B.M;
37 const Mat<eT>& C = tmp_C.M;
38
39 const bool status = auxlib::syl(out, A, B, C);
40
41 if(status == false)
42 {
43 out.reset();
44 arma_bad("syl(): equation appears to be singular", false);
45 }
46
47 return status;
48 }
49
50
51
52 template<typename T1, typename T2, typename T3>
53 inline
54 Mat<typename T1::elem_type>
55 syl
56 (
57 const Base<typename T1::elem_type,T1>& in_A,
58 const Base<typename T1::elem_type,T2>& in_B,
59 const Base<typename T1::elem_type,T3>& in_C,
60 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
61 )
62 {
63 arma_extra_debug_sigprint();
64 arma_ignore(junk);
65
66 typedef typename T1::elem_type eT;
67
68 const unwrap<T1> tmp_A( in_A.get_ref() );
69 const unwrap<T2> tmp_B( in_B.get_ref() );
70 const unwrap<T3> tmp_C( in_C.get_ref() );
71
72 const Mat<eT>& A = tmp_A.M;
73 const Mat<eT>& B = tmp_B.M;
74 const Mat<eT>& C = tmp_C.M;
75
76 Mat<eT> out;
77
78 const bool status = auxlib::syl(out, A, B, C);
79
80 if(status == false)
81 {
82 out.reset();
83 arma_bad("syl(): equation appears to be singular");
84 }
85
86 return out;
87 }
88
89
90
91 //! @}