Revision 18, 1.0 kB
(checked in by smidl, 16 years ago)
|
update
|
Line | |
---|
1 | #include <itpp/itbase.h> |
---|
2 | #include "libDS.h" |
---|
3 | |
---|
4 | using namespace itpp; |
---|
5 | |
---|
6 | void MemDS::getdata(vec &dt){ |
---|
7 | it_assert_debug(dt.length()==rowid.length(), "MemDS:getdata incompatible dt"); |
---|
8 | for(i=0;i<rowid.length();i++){ |
---|
9 | dt(i) = Data(rowid(i),time-delays(i)); |
---|
10 | } |
---|
11 | } |
---|
12 | |
---|
13 | void MemDS::getdata(vec &dt,ivec &indeces){ |
---|
14 | int j; |
---|
15 | it_assert_debug(dt.length()==indeces.length(), "MemDS:getdata incompatible dt"); |
---|
16 | for(i=0;i<indeces.length();i++){ |
---|
17 | j = indeces (i); |
---|
18 | dt(i) = Data(rowid(j),time-delays(j)); |
---|
19 | } |
---|
20 | } |
---|
21 | |
---|
22 | void MemDS::step() { |
---|
23 | if (time<Data.cols()) {time++;} |
---|
24 | } |
---|
25 | |
---|
26 | void MemDS::linkrvs(RV &drv, RV &urv) { |
---|
27 | it_assert_debug(drv.count()==rowid.length(),"MemDS::linkrvs incompatible drv"); |
---|
28 | it_assert_debug(urv.count()==0,"MemDS does not support urv."); |
---|
29 | |
---|
30 | Drv = drv; |
---|
31 | Urv = urv; |
---|
32 | } |
---|
33 | |
---|
34 | MemDS::MemDS(vec &Dat, ivec &rowid, ivec &delays){ |
---|
35 | it_assert_debug(max(rowid)<=Dat.rows,"MemDS rowid is too high for given Dat.") |
---|
36 | it_assert_debug(max(delays)<Dat.cols,"MemDS delays are too high.") |
---|
37 | |
---|
38 | time = max(delayes); |
---|
39 | Data = Dat; |
---|
40 | } |
---|