00001 /* 00002 * $Id$ 00003 * 00004 * Author: David Fournier 00005 * Copyright (c) 2008-2012 Regents of the University of California 00006 */ 00011 #include "fvar.hpp" 00012 00018 dmatrix trans(const dmatrix& m1) 00019 { 00020 dmatrix tmp(m1.colmin(),m1.colmax(),m1.rowmin(),m1.rowmax()); 00021 00022 for (int i=m1.rowmin(); i<=m1.rowmax(); i++) 00023 { 00024 for (int j=m1.colmin(); j<=m1.colmax(); j++) 00025 { 00026 tmp[j][i]=m1[i][j]; 00027 } 00028 } 00029 return (tmp); 00030 } 00031 00032 00038 double norm(const dmatrix& m1) 00039 { 00040 double tmp = 0; 00041 //double tmp1; 00042 for (int i=m1.rowmin(); i<=m1.rowmax(); i++) 00043 { 00044 tmp+=norm2(m1.elem(i)); 00045 } 00046 return(sqrt(tmp)); 00047 } 00048 00054 double norm2(const dmatrix& m1) 00055 { 00056 double tmp = 0; 00057 for (int i=m1.rowmin(); i<=m1.rowmax(); i++) 00058 { 00059 tmp+=norm2(m1.elem(i)); 00060 } 00061 return(tmp); 00062 } 00063 double sumsq(const dmatrix& m1) { return(norm2(m1)); }
Generated on Tue Mar 8 2016 19:51:32 for ADMB Documentation by 1.8.0 |