Revision 1805 trunk/src/linad99/ranfill1.cpp
ranfill1.cpp (revision 1805)  

5  5 
* Copyright (c) 20082012 Regents of the University of California 
6  6 
*/ 
7  7 
/** 
8 
* \file 

9 
* Description not yet available. 

8 
* \file ranfill1.cpp 

9 
* \brief Routines for filling objects (matrices and vectors) 

10 
* \ingroup linad99 

11 
* \author 

12 
* \author: David Fournier 

13 
* Copyright (c) 20082012 Regents of the University of California 

14 
* \date 2/28/2011 

10  15 
*/ 
11  16 
#include <fvar.hpp> 
12  17  
...  ...  
31  36 
double temp=0; 
32  37 
for (int i=indexmin(); i<=indexmax(); i++) 
33  38 
{ 
34 
elem(i)=base+temp; 

35 
temp=temp+offset; 

39 
elem(i) =base+temp;


40 
temp =temp+offset;


36  41 
} 
37  42 
RETURN_ARRAYS_DECREMENT(); 
38  43 
} 
39  
40  44 
/** 
41 
* Description not yet available. 

42 
* \param 

45 
* Fills column of a matrix with a sequence of the form base, base+offset, base+2*offset,... 

46 
\author Dave Fournier 

47 
\date 20080325 

48 
\param j the column 

49 
\param base is the starting value 

50 
\param offset base+offset,base+offset*2,..., 

51 
\return imatrix with those value 

43  52 
*/ 
53 
void imatrix::colfill_seqadd(int j, int base, int offset) 

54 
{ 

55 
int temp=0; 

56 
// RETURN_ARRAYS_INCREMENT(); 

57 
for (int i=rowmin(); i<=rowmax(); i++) 

58 
{ 

59 
// elem(i,j) = base+temp; 

60 
(*this)[i][j] = base+temp; 

61 
temp = temp+offset; 

62 
} 

63 
// RETURN_ARRAYS_DECREMENT(); 

64 
} 

65 


66 
/** 

67 
* Fills column of a matrix with a sequence of the form base, base+offset, base+2*offset,... 

68 
\author Dave Fournier 

69 
\date 20080325 

70 
\param j the column 

71 
\param base is the starting value 

72 
\param offset base+offset,base+offset*2,..., 

73 
\return dvar_matrix with those values 

74 
*/ 

75  
44  76 
void dvar_matrix::colfill_seqadd(const int& j, CGNU_DOUBLE base, 
45  77 
CGNU_DOUBLE offset) 
46  78 
{ 
...  ...  
48  80 
RETURN_ARRAYS_INCREMENT(); 
49  81 
for (int i=rowmin(); i<=rowmax(); i++) 
50  82 
{ 
51 
elem(i,j)=base+temp; 

52 
temp=temp+offset; 

83 
elem(i,j) =base+temp;


84 
temp =temp+offset;


53  85 
} 
54  86 
RETURN_ARRAYS_DECREMENT(); 
55  87 
} 
56  88  
57  89 
/** 
58 
* Description not yet available. 

59 
* \param 

90 
* Fills vector with a sequence of the form base, base+offset, base+2*offset,... 

91 
\author Dave Fournier 

92 
\date 20080325 

93 
\param base is the starting value 

94 
\param offset base+offset,base+offset*2,..., 

95 
\return dvar_vector with those value 

60  96 
*/ 
61  97 
void dvar_matrix::rowfill_seqadd(const int& i, CGNU_DOUBLE base, 
62  98 
CGNU_DOUBLE offset) 
...  ...  
65  101 
RETURN_ARRAYS_INCREMENT(); 
66  102 
for (int j=colmin(); j<=colmax(); j++) 
67  103 
{ 
68 
elem(i,j)=base+temp; 

69 
temp=temp+offset; 

104 
elem(i,j) =base+temp; 

105 
temp =temp+offset; 
Also available in: Unified diff