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 00017 dvector& dvector::operator+=(const dvector& v1) 00018 { 00019 if (indexmin() != v1.indexmin() || indexmax() != v1.indexmax()) 00020 { 00021 cerr << " Incompatible array bounds in " 00022 "dvector& operator += (const dvector&)\n"; 00023 ad_exit(21); 00024 } 00025 00026 { 00027 for (int i=indexmin();i<=indexmax();i++) 00028 { 00029 elem(i) += v1.elem(i); 00030 } 00031 } 00032 return(*this); 00033 } 00034 00039 dvector& dvector::operator-=(const dvector& v1) 00040 { 00041 if (indexmin() != v1.indexmin() || indexmax() != v1.indexmax()) 00042 { 00043 cerr << " Incompatible array bounds in " 00044 "dvector& operator -= (const dvector&)\n"; 00045 ad_exit(21); 00046 } 00047 00048 { 00049 for (int i=indexmin();i<=indexmax();i++) 00050 { 00051 elem(i) -= v1.elem(i); 00052 } 00053 } 00054 return(*this); 00055 } 00056 00061 dvector& dvector::operator+=(const double d) 00062 { 00063 for (int i=indexmin();i<=indexmax();i++) 00064 { 00065 elem(i) += d; 00066 } 00067 return(*this); 00068 } 00069 00074 dvector& dvector::operator-=(const double d) 00075 { 00076 for (int i=indexmin();i<=indexmax();i++) 00077 { 00078 elem(i) -= d; 00079 } 00080 return(*this); 00081 }
Generated on Tue Mar 8 2016 19:51:32 for ADMB Documentation by 1.8.0 |