-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleListInitializer.h
More file actions
96 lines (74 loc) · 1.87 KB
/
SimpleListInitializer.h
File metadata and controls
96 lines (74 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef SIMPLELISTINITIALIZER
#define SIMPLELISTINITIALIZER
#include <Eigen/Dense>
class SimpleListInitializer
{
public:
SimpleListInitializer (Eigen::MatrixXd * M_input, int row_input, int col_input)
:M(M_input), row(row_input), col(col_input)
{}
SimpleListInitializer operator, (double x)
{
// M->conservativeResize(M->rows(),M->cols()+1);
(*M)(row,col) = x;
return SimpleListInitializer(M,row,col+1);
}
SimpleListInitializer operator, (complex<double> x)
{
// M->conservativeResize(M->rows(),M->cols()+2);
(*M)(row,col) = x.real();
(*M)(row,col+1) = x.imag();
return SimpleListInitializer(M,row,col+2);
}
private:
SimpleListInitializer();
protected:
int row;
int col;
Eigen::MatrixXd * M;
};
//template<typename ScalarType, typename IteratorType>
//class SimpleListInitializer
//{
//public:
// SimpleListInitializer (IteratorType Iterator_input)
// :storedIterator(Iterator_input)
// {}
// SimpleListInitializer<ScalarType,IteratorType> operator, (ScalarType x)
// {
// *storedIterator = x;
// return SimpleListInitializer<ScalarType,IteratorType> (storedIterator+1);
// }
//private:
// SimpleListInitializer();
//protected:
// IteratorType storedIterator;
//};
//class Aarray
//{
//public:
//
// Aarray (std::size_t size = 10) : data_(new double[size])
// {
// }
// ~Aarray()
// {
// delete [] data_;
// }
// SimpleListInitializer<double,double*> operator<< (double x)
// {
//// cout << x << endl;
// data_[0] = x;
//// cout << data_[0] << endl;
// return SimpleListInitializer<double,double*>(data_+1);
//// cout << data_[0] << endl;
// }
//
// void print()
// {
// cout << "data: " << data_[0] << "\t" << data_[1] << endl;
// }
//private:
// double* data_;
//};
#endif