20 #include "../config.h" 21 #ifdef __MATRIXWRAPPER_LTI__ 31 MyColumnVector::ColumnVector() : ltiColumnVector() {}
32 MyColumnVector::ColumnVector(
int num_rows) : ltiColumnVector(num_rows){}
35 : ltiColumnVector(a.rows() + b.rows())
37 ltiColumnVector& opl = (*this);
42 for (i=0; i< a.rows(); i++)
46 for (i=0; i< b.rows(); i++)
47 opl.at(a.rows() + i) = b(i+1);
51 MyColumnVector::ColumnVector(
const MyMatrix &a)
52 : ltiColumnVector(a.rows())
54 assert(a.columns() == 1);
57 ltiColumnVector& opl = (*this);
58 for (
unsigned int i=0; i< a.rows(); i++)
65 MyColumnVector::~ColumnVector(){}
70 MyColumnVector::ColumnVector(
const ltiColumnVector & a) :
74 void MyColumnVector::resize(
int num_rows)
76 ltiColumnVector & op1 = (*this);
81 void MyColumnVector::assign(
int num_rows,
double value)
83 BoostColumnVector & op1 = (*this);
85 for (
unsigned int i=0; i<num_rows; i++)
90 unsigned int MyColumnVector::rows()
const {
return this->size();}
91 unsigned int MyColumnVector::columns()
const {
return 1;}
92 unsigned int MyColumnVector::capacity()
const {
return this->size();}
100 for (
unsigned int i=0; i<v1.rows(); i++)
103 for (
unsigned int i=0; i<v2.rows(); i++)
104 res(v1.rows()+i) = v2(i);
109 const bool MyColumnVector::operator==(
const MyColumnVector& a)
const 111 const ltiColumnVector& op1 = *
this;
112 const ltiColumnVector& op2 = a;
120 ltiColumnVector & op1 = (*this);
121 const ltiColumnVector & op2 = a;
128 ltiColumnVector & op1 = (*this);
129 const ltiColumnVector & op2 = a;
136 ltiColumnVector op1(*
this);
137 const ltiColumnVector & op2 = a;
138 ltiColumnVector result = (ltiColumnVector) (op1.add(op2));
144 ltiColumnVector op1(*
this);
145 const ltiColumnVector & op2 = a;
146 ltiColumnVector result = (ltiColumnVector) (op1.subtract(op2));
154 ltiColumnVector& op1 = *
this;
161 ltiColumnVector& op1 = *
this;
169 ltiColumnVector& op1 = *
this;
176 ltiColumnVector& op1 = *
this;
184 ltiColumnVector op1(*
this);
192 ltiColumnVector op1(*
this);
199 ltiColumnVector op1(*
this);
206 ltiColumnVector op1(*
this);
218 ltiRowVector transposedbase((*
this));
224 const ltiColumnVector& op1 = *
this;
225 const ltiRowVector & op2 = a;
226 ltiMatrix result(op1.size(),op2.size());
227 result.outerProduct(op1,op2);
234 ltiColumnVector * op1;
const ltiColumnVector * op2;
235 op1 =
this; op2 = &a;
244 ltiColumnVector * op1;
246 (*op1).fill(a,0,(*op1).size());
251 double &MyColumnVector::operator()(
unsigned int i)
256 return this->at(i-1);
259 const double MyColumnVector::operator()(
unsigned int i)
const 263 return this->at(i-1);
269 ltiColumnVector result(*
this,j_start-1,j_end-1);
278 MyRowVector::RowVector() : ltiRowVector() {}
279 MyRowVector::RowVector(
int num_rows) : ltiRowVector(num_rows){}
282 MyRowVector::~RowVector(){}
285 MyRowVector::RowVector(
const MyRowVector& a) : ltiRowVector(a){}
286 MyRowVector::RowVector(
const ltiRowVector & a) : ltiRowVector(a){}
289 unsigned int MyRowVector::rows()
const {
return 1;}
290 unsigned int MyRowVector::columns()
const {
return this->size();}
291 unsigned int MyRowVector::capacity()
const {
return this->size();}
293 const bool MyRowVector::operator==(
const MyRowVector& a)
const 295 const ltiRowVector& op1 = *
this;
296 const ltiRowVector& op2 = a;
304 ltiRowVector & op1 = (*this);
305 const ltiRowVector & op2 = a;
312 ltiRowVector & op1 = (*this);
313 const ltiRowVector & op2 = a;
320 ltiRowVector op1(*
this);
321 const ltiRowVector & op2 = a;
322 ltiRowVector result = (ltiRowVector) (op1.add(op2));
328 ltiRowVector op1(*
this);
329 const ltiRowVector & op2 = a;
330 ltiRowVector result = (ltiRowVector) (op1.subtract(op2));
341 ltiRowVector& op1 = *
this;
348 ltiRowVector& op1 = *
this;
356 ltiRowVector& op1 = *
this;
363 ltiRowVector& op1 = *
this;
369 MyRowVector MyRowVector::operator+ (
double a)
const 371 ltiRowVector op1(*
this);
377 MyRowVector MyRowVector::operator- (
double a)
const 379 ltiRowVector op1(*
this);
384 MyRowVector MyRowVector::operator* (
double a)
const 386 ltiRowVector op1(*
this);
391 MyRowVector MyRowVector::operator/ (
double a)
const 393 ltiRowVector op1(*
this);
399 assert(this->columns() == a.rows());
401 ltiRowVector & op1 = (*this);
402 const ltiMatrix & op2 = a;
403 ltiRowVector result = op2.leftMultiply(op1);
410 assert(this->columns() == a.rows());
412 const ltiRowVector & op1 = (*this);
413 const ltiColumnVector & op2 = a;
414 double result=op1.dot(op2);
422 const ltiRowVector * op2;
431 MyRowVector& MyRowVector::operator=(
const double a)
436 (*op1).fill(a,0,(*op1).size());
444 ltiColumnVector transposedbase((*
this));
449 double &MyRowVector::operator()(
unsigned int i)
457 const double MyRowVector::operator()(
unsigned int i)
const 460 ltiRowVector op1(*
this);
461 return ((op1.at(i-1)));
466 MyRowVector MyRowVector::sub(
int j_start ,
int j_end)
const 468 ltiRowVector result(*
this,j_start-1,j_end-1);
473 void MyRowVector::resize(
int num_cols)
475 ltiRowVector & op1 = (*this);
476 op1.resize(num_cols);
480 void MyRowVector::assign(
int num_columns,
double value)
482 ltiRowVector & op1 = (*this);
483 op1.resize(num_columns);
484 for (
unsigned int i=0; i<num_columns; i++)
490 MyRowVector::vectorAdd(
const MyRowVector& v2)
const 495 for (
unsigned int i=0; i<v1.columns(); i++)
498 for (
unsigned int i=0; i<v2.columns(); i++)
499 res(v1.columns()+i) = v2(i);