Revision 1015
tags/admb11.1/LICENSE.txt (revision 1015)  

1 
Copyright (c) 20082013 Regents of the University of California 

2  
3 
AD Model Builder and associated libraries and documentations are 

4 
provided under the general terms of the BSD License 

5  
6 
License: 

7  
8 
Redistribution and use in source and binary forms, with or without 

9 
modification, are permitted provided that the following conditions are 

10 
met: 

11  
12 
1. Redistributions of source code must retain the above copyright 

13 
notice, this list of conditions and the following disclaimer. 

14  
15 
2. Redistributions in binary form must reproduce the above copyright 

16 
notice, this list of conditions and the following disclaimer in the 

17 
documentation and/or other materials provided with the distribution. 

18  
19 
3. Neither the name of the University of California, Otter Research, nor 

20 
the ADMB Foundation nor the names of its contributors may be used to 

21 
endorse or promote products derived from this software without specific 

22 
prior written permission. 

23  
24 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

25 
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

26 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

27 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

28 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 

29 
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

30 
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

31 
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

32 
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

33 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

34 
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

35 
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

36 
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

37  
38 
 

39 
$ID$ 
tags/admb11.1/contrib/betai/linad99/eigen_dmat.cpp (revision 1015)  

1 
/* 

2 
* $Id$ 

3 
* 

4 
* Copyright (c) 20092012 ADMB foundation 

5 
*/ 

6 
/** 

7 
* \file 

8 
* Contains routines to find eigenvectors and eigenvalues 

9 
* for constant types. 

10 
*/ 

11 
#include <fvar.hpp> 

12  
13 
void eigens(const dmatrix & m, const dmatrix & _evecs, 

14 
const dvector & _evals); 

15  
16 
/** 

17 
* \ingroup eigen 

18 
* Eigenvalues 

19 
* \param m \f$m\f$ 

20 
* \return a variable vector containing the 

21 
* eigenvalues of \f$m\f$. 

22 
*/ 

23 
dvector eigenvalues(const dmatrix &m) 

24 
{ 

25 
if (m.rowsize() != m.colsize()) 

26 
{ 

27 
cerr << 

28 
"error  non square matrix passed to dvector eigenvalues(const dmatrix& m)\n"; 

29 
ad_exit(1); 

30 
} 

31  
32 
int rmin = m.rowmin(); 

33 
int rmax = m.rowmax(); 

34  
35 
dmatrix evecs(rmin, rmax, rmin, rmax); 

36 
dvector evals(rmin, rmax); 

37  
38 
eigens(m, evecs, evals); 

39  
40 
return evals; 

41 
} 

42  
43 
/** 

44 
* \ingroup eigen 

45 
* Eigenvectors 

46 
* \param m \f$m\f$ 

47 
* \return a variable matrix with the 

48 
* eigenvectors of \f$m\f$ stored in its columns. 

49 
*/ 

50 
dmatrix eigenvectors(const dmatrix &m) 

51 
{ 

52 
if (m.rowsize() != m.colsize()) 
Also available in: Unified diff