~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/elementary_functions/tests/unit_tests/cumprod.tst

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// =============================================================================
2
2
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3
3
// Copyright (C) 2010 - INRIA - Serge Steer
 
4
// Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
4
5
//
5
6
//  This file is distributed under the same license as the Scilab package.
6
7
// =============================================================================
11
12
//Empty matrices
12
13
T=list(list(),list('native'),list('double'));
13
14
for typ=T
14
 
  if cumprod([],typ(:))<>[] then pause,end
15
 
  if cumprod([],'*',typ(:))<>[] then pause,end
16
 
  if cumprod([],1,typ(:))<>[] then pause,end
17
 
  if cumprod([],2,typ(:))<>[] then pause,end
18
 
  if cumprod([],3,typ(:))<>[] then pause,end
 
15
  assert_checkequal(cumprod([],typ(:)), []);
 
16
  assert_checkequal(cumprod([],'*',typ(:)), []);
 
17
  assert_checkequal(cumprod([],1,typ(:)), []);
 
18
  assert_checkequal(cumprod([],2,typ(:)), []);
 
19
  assert_checkequal(cumprod([],3,typ(:)), []);
19
20
end
20
21
 
21
22
//=======================================================================
23
24
d=[1 10;254 9];
24
25
T=list(list(),list('native'),list('double'));
25
26
for typ=T
26
 
  if or(cumprod(d,typ(:))<>[1,2540;254,22860]) then pause,end
27
 
  if or(cumprod(d,'*',typ(:))<>[1,2540;254,22860]) then pause,end
28
 
  if or(cumprod(d,1,typ(:))<>[1,10;254,90]) then pause,end
29
 
  if or(cumprod(d,2,typ(:))<>[1,10;254,2286]) then pause,end
30
 
  if or(cumprod(d,3,typ(:))<>d) then pause,end
 
27
  assert_checkequal(cumprod(d,typ(:)), [1,2540;254,22860]);
 
28
  assert_checkequal(cumprod(d,'*',typ(:)), [1,2540;254,22860]);
 
29
  assert_checkequal(cumprod(d,1,typ(:)), [1,10;254,90]);
 
30
  assert_checkequal(cumprod(d,2,typ(:)), [1,10;254,2286]);
 
31
  assert_checkequal(cumprod(d,3,typ(:)), d);
31
32
end
32
33
 
33
34
//hypermatrices of floats
34
35
d=[1 10;254 9];d(1,1,2)=1;
35
36
T=list(list(),list('native'),list('double'));
36
37
for typ=T
37
 
  if or(cumprod(d,typ(:))<>hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0])) then pause,end
38
 
  if or(cumprod(d,'*',typ(:))<>hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0])) then pause,end
39
 
  if or(cumprod(d,1,typ(:))<>hypermat([2,2,2],[1;254;10;90;1;0;0;0])) then pause,end
40
 
  if or(cumprod(d,2,typ(:))<>hypermat([2,2,2],[1;254;10;2286;1;0;0;0])) then pause,end
41
 
  if or(cumprod(d,3,typ(:))<>hypermat([2,2,2],[1;254;10;9;1;0;0;0])) then pause,end
42
 
  if or(cumprod(d,5,typ(:))<>d) then pause,end
 
38
  assert_checkequal(cumprod(d,typ(:)), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
 
39
  assert_checkequal(cumprod(d,'*',typ(:)), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
 
40
  assert_checkequal(cumprod(d,1,typ(:)), hypermat([2,2,2],[1;254;10;90;1;0;0;0]));
 
41
  assert_checkequal(cumprod(d,2,typ(:)), hypermat([2,2,2],[1;254;10;2286;1;0;0;0]));
 
42
  assert_checkequal(cumprod(d,3,typ(:)), hypermat([2,2,2],[1;254;10;9;1;0;0;0]));
 
43
  assert_checkequal(cumprod(d,5,typ(:)), d);
43
44
end
44
45
 
45
46
//=======================================================================
46
47
//Integers
47
48
i=uint8([1 10;254 9]);
48
49
for typ=list(list(),list('native'));
49
 
  if or(cumprod(i,typ(:))<>uint8([1,236;254,76])) then pause,end
50
 
  if or(cumprod(i,'*',typ(:))<>uint8([1,236;254,76])) then pause,end
51
 
  if or(cumprod(i,1,typ(:))<>uint8([1,10;254,90])) then pause,end
52
 
  if or(cumprod(i,2,typ(:))<>uint8([1,10;254,238])) then pause,end
53
 
  if or(cumprod(i,3,typ(:))<>i) then pause,end
 
50
  assert_checkequal(cumprod(i,typ(:)), uint8([1,236;254,76]));
 
51
  assert_checkequal(cumprod(i,'*',typ(:)), uint8([1,236;254,76]));
 
52
  assert_checkequal(cumprod(i,1,typ(:)), uint8([1,10;254,90]));
 
53
  assert_checkequal(cumprod(i,2,typ(:)), uint8([1,10;254,238]));
 
54
  assert_checkequal(cumprod(i,3,typ(:)), double(i));
54
55
end
55
56
 
56
 
if or(cumprod(i,'double')<>[1,2540;254,22860]) then pause,end
57
 
if or(cumprod(i,'*','double')<>[1,2540;254,22860]) then pause,end
58
 
if or(cumprod(i,1,'double')<>[1,10;254,90]) then pause,end
59
 
if or(cumprod(i,2,'double')<>[1,10;254,2286]) then pause,end
60
 
if or(cumprod(i,3,'double')<>double(i)) then pause,end
 
57
assert_checkequal(cumprod(i,'double'), [1,2540;254,22860]);
 
58
assert_checkequal(cumprod(i,'*','double'), [1,2540;254,22860]);
 
59
assert_checkequal(cumprod(i,1,'double'), [1,10;254,90]);
 
60
assert_checkequal(cumprod(i,2,'double'), [1,10;254,2286]);
 
61
assert_checkequal(cumprod(i,3,'double'), double(i));
61
62
 
62
63
//with hypermatrices
63
64
i=uint8([1 10;254 9]);i(1,1,2)=uint8(1);
64
65
for typ=list(list(),list('native'));
65
 
  if or(cumprod(i,typ(:))<>hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0]))) then pause,end
66
 
  if or(cumprod(i,'*',typ(:))<>hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0]))) then pause,end
67
 
  if or(cumprod(i,1,typ(:))<>hypermat([2,2,2],uint8([1;254;10;90;1;0;0;0]))) then pause,end
68
 
  if or(cumprod(i,2,typ(:))<>hypermat([2,2,2],uint8([1;254;10;238;1;0;0;0]))) then pause,end
69
 
  if or(cumprod(i,3,typ(:))<>hypermat([2,2,2],uint8([1;254;10;9;1;0;0;0]))) then pause,end
70
 
  if or(cumprod(i,5,typ(:))<>i) then pause,end
 
66
  assert_checkequal(cumprod(i,typ(:)), hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0])));
 
67
  assert_checkequal(cumprod(i,'*',typ(:)), hypermat([2,2,2],uint8([1;254;236;76;76;0;0;0])));
 
68
  assert_checkequal(cumprod(i,1,typ(:)), hypermat([2,2,2],uint8([1;254;10;90;1;0;0;0])));
 
69
  assert_checkequal(cumprod(i,2,typ(:)), hypermat([2,2,2],uint8([1;254;10;238;1;0;0;0])));
 
70
  assert_checkequal(cumprod(i,3,typ(:)), hypermat([2,2,2],uint8([1;254;10;9;1;0;0;0])));
 
71
  assert_checkequal(cumprod(i,5,typ(:)), double(i));
71
72
end
72
73
 
73
74
 
74
 
if or(cumprod(i,'double')<>hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0])) then pause,end
75
 
if or(cumprod(i,'*','double')<>hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0])) then pause,end
76
 
if or(cumprod(i,1,'double')<>hypermat([2,2,2],[1;254;10;90;1;0;0;0])) then pause,end
77
 
if or(cumprod(i,2,'double')<>hypermat([2,2,2],[1;254;10;2286;1;0;0;0])) then pause,end
78
 
if or(cumprod(i,3,'double')<>hypermat([2,2,2],[1;254;10;9;1;0;0;0])) then pause,end
79
 
if or(cumprod(i,5,'double')<>double(i)) then pause,end
 
75
assert_checkequal(cumprod(i,'double'), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
 
76
assert_checkequal(cumprod(i,'*','double'), hypermat([2,2,2],[1;254;2540;22860;22860;0;0;0]));
 
77
assert_checkequal(cumprod(i,1,'double'), hypermat([2,2,2],[1;254;10;90;1;0;0;0]));
 
78
assert_checkequal(cumprod(i,2,'double'), hypermat([2,2,2],[1;254;10;2286;1;0;0;0]));
 
79
assert_checkequal(cumprod(i,3,'double'), hypermat([2,2,2],[1;254;10;9;1;0;0;0]));
 
80
assert_checkequal(cumprod(i,5,'double'), double(i));
80
81
 
81
82
//=======================================================================
82
 
//Matrices of Polynomials 
 
83
//Matrices of Polynomials
83
84
s=%s;p=[s s+1;s^2 0];
84
85
T=list(list(),list('native'),list('double'));
85
86
for typ=T
86
 
  if or(cumprod(p,typ(:))<>[s,s^3+s^4;s^3,0*s]) then pause,end
87
 
  if or(cumprod(p,'*',typ(:))<>[s,s^3+s^4;s^3,0*s]) then pause,end
88
 
  if or(cumprod(p,1,typ(:))<>[s,1+s;s^3,0*s]) then pause,end
89
 
  if or(cumprod(p,2,typ(:))<>[s,s+s^2;s^2,0*s]) then pause,end
90
 
  if or(cumprod(p,3,typ(:))<>p) then pause,end
 
87
  assert_checkequal(cumprod(p,typ(:)), [s,s^3+s^4;s^3,0*s]);
 
88
  assert_checkequal(cumprod(p,'*',typ(:)), [s,s^3+s^4;s^3,0*s]);
 
89
  assert_checkequal(cumprod(p,1,typ(:)), [s,1+s;s^3,0*s]);
 
90
  assert_checkequal(cumprod(p,2,typ(:)), [s,s+s^2;s^2,0*s]);
 
91
  assert_checkequal(cumprod(p,3,typ(:)), p);
91
92
end
92
93
 
93
94
//with hypermatrices
94
95
s=%s;p=[s s+1;s^2 0];p(1,1,2)=-1;
95
96
T=list(list(),list('native'),list('double'));
96
97
for typ=T
97
 
  if or(cumprod(p,typ(:))<>hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s])) then pause,end
98
 
  if or(cumprod(p,'*',typ(:))<>hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s])) then pause,end
99
 
  if or(cumprod(p,1,typ(:))<>hypermat([2,2,2],[s;s^3;1+s;0*s;-1;0*s;0*s;0*s])) then pause,end
100
 
  if or(cumprod(p,2,typ(:))<>hypermat([2,2,2],[s;s^2;s+s^2;0*s;-1;0*s;0*s;0*s])) then pause,end
101
 
  if or(cumprod(p,3,typ(:))<>hypermat([2,2,2],[s;s^2;1+s;0*s;-s;0*s;0*s;0*s])) then pause,end
102
 
  if or(cumprod(p,5,typ(:))<>p) then pause,end
 
98
  assert_checkequal(cumprod(p,typ(:)), hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s]));
 
99
  assert_checkequal(cumprod(p,'*',typ(:)), hypermat([2,2,2],[s;s^3;s^3+s^4;0*s;0*s;0*s;0*s;0*s]));
 
100
  assert_checkequal(cumprod(p,1,typ(:)), hypermat([2,2,2],[s;s^3;1+s;0*s;-1;0*s;0*s;0*s]));
 
101
  assert_checkequal(cumprod(p,2,typ(:)), hypermat([2,2,2],[s;s^2;s+s^2;0*s;-1;0*s;0*s;0*s]));
 
102
  assert_checkequal(cumprod(p,3,typ(:)), hypermat([2,2,2],[s;s^2;1+s;0*s;-s;0*s;0*s;0*s]));
 
103
  assert_checkequal(cumprod(p,5,typ(:)), p);
103
104
end
104
105
//=======================================================================
105
106
//Matrices of rationals
106
107
s=%s;r=1.0 ./[s s+1;s^2 1];
107
108
T=list(list(),list('native'),list('double'));
108
109
for typ=T
109
 
  if or(cumprod(r,typ(:))<>[1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]) then pause,end
110
 
  if or(cumprod(r,'*',typ(:))<>[1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]) then pause,end
111
 
  if or(cumprod(r,1,typ(:))<>[1,1;1,1]./[s,1+s;s^3,1+s]) then pause,end
112
 
  if or(cumprod(r,2,typ(:))<>[1,1;1,1]./[s,s+s^2;s^2,s^2]) then pause,end
113
 
  if or(cumprod(r,3,typ(:))<>r) then pause,end
 
110
  assert_checkequal(cumprod(r,typ(:)), [1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]);
 
111
  assert_checkequal(cumprod(r,'*',typ(:)), [1,1;1,1]./[s,s^3+s^4;s^3,s^3+s^4]);
 
112
  assert_checkequal(cumprod(r,1,typ(:)), [1,1;1,1]./[s,1+s;s^3,1+s]);
 
113
  assert_checkequal(cumprod(r,2,typ(:)), [1,1;1,1]./[s,s+s^2;s^2,s^2]);
 
114
  assert_checkequal(cumprod(r,3,typ(:)), r);
114
115
end
115
116
 
116
117
//=======================================================================
118
119
 
119
120
b=[%t %t;%f %t];
120
121
for typ=list(list(),list('double'));
121
 
  if or(cumprod(b,typ(:))<>[1,0;0,0]) then pause,end
122
 
  if or(cumprod(b,'*',typ(:))<>[1,0;0,0]) then pause,end
123
 
  if or(cumprod(b,1,typ(:))<>[1,1;0,1]) then pause,end
124
 
  if or(cumprod(b,2,typ(:))<>[1,1;0,0]) then pause,end
125
 
  if or(cumprod(b,3,typ(:))<>double(b)) then pause,end
 
122
  assert_checkequal(cumprod(b,typ(:)), [1,0;0,0]);
 
123
  assert_checkequal(cumprod(b,'*',typ(:)), [1,0;0,0]);
 
124
  assert_checkequal(cumprod(b,1,typ(:)), [1,1;0,1]);
 
125
  assert_checkequal(cumprod(b,2,typ(:)), [1,1;0,0]);
 
126
  assert_checkequal(cumprod(b,3,typ(:)), double(b));
126
127
end
127
 
if or(cumprod(b,'native')<>[%t,%f;%f,%f]) then pause,end
128
 
if or(cumprod(b,'*','native')<>[%t,%f;%f,%f]) then pause,end
129
 
if or(cumprod(b,1,'native')<>[%t,%t;%f,%t]) then pause,end
130
 
if or(cumprod(b,2,'native')<>[%t,%t;%f,%f]) then pause,end
131
 
if or(cumprod(b,3,'native')<>b) then pause,end
 
128
assert_checkequal(cumprod(b,'native'), [%t,%f;%f,%f]);
 
129
assert_checkequal(cumprod(b,'*','native'), [%t,%f;%f,%f]);
 
130
assert_checkequal(cumprod(b,1,'native'), [%t,%t;%f,%t]);
 
131
assert_checkequal(cumprod(b,2,'native'), [%t,%t;%f,%f]);
 
132
assert_checkequal(cumprod(b,3,'native'), b);
132
133
 
133
134
//with hypermatrices
134
135
b=[%t %t;%f %t];b(1,1,2)=%f;
135
136
for typ=list(list(),list('double'));
136
 
  if or(cumprod(b,typ(:))<>hypermat([2,2,2],[1;0;0;0;0;0;0;0])) then pause,end
137
 
  if or(cumprod(b,'*',typ(:))<>hypermat([2,2,2],[1;0;0;0;0;0;0;0])) then pause,end
138
 
  if or(cumprod(b,1,typ(:))<>hypermat([2,2,2],[1;0;1;1;0;0;0;0])) then pause,end
139
 
  if or(cumprod(b,2,typ(:))<>hypermat([2,2,2],[1;0;1;0;0;0;0;0])) then pause,end
140
 
  if or(cumprod(b,3,typ(:))<>hypermat([2,2,2],[1;0;1;1;0;0;0;0])) then pause,end
141
 
  if or(cumprod(b,5,typ(:))<>double(b)) then pause,end
 
137
  assert_checkequal(cumprod(b,typ(:)), hypermat([2,2,2],[1;0;0;0;0;0;0;0]));
 
138
  assert_checkequal(cumprod(b,'*',typ(:)), hypermat([2,2,2],[1;0;0;0;0;0;0;0]));
 
139
  assert_checkequal(cumprod(b,1,typ(:)), hypermat([2,2,2],[1;0;1;1;0;0;0;0]));
 
140
  assert_checkequal(cumprod(b,2,typ(:)), hypermat([2,2,2],[1;0;1;0;0;0;0;0]));
 
141
  assert_checkequal(cumprod(b,3,typ(:)), hypermat([2,2,2],[1;0;1;1;0;0;0;0]));
 
142
  assert_checkequal(cumprod(b,5,typ(:)), double(b));
142
143
end
143
144
 
144
 
if or(cumprod(b,'native')<>hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f])) then pause,end
145
 
if or(cumprod(b,'*','native')<>hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f])) then pause,end
146
 
if or(cumprod(b,1,'native')<>hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f])) then pause,end
147
 
if or(cumprod(b,2,'native')<>hypermat([2,2,2],[%t;%f;%t;%f;%f;%f;%f;%f])) then pause,end
148
 
if or(cumprod(b,3,'native')<>hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f])) then pause,end
149
 
if or(cumprod(b,5,'native')<>b) then pause,end
 
145
assert_checkequal(cumprod(b,'native'), hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f]));
 
146
assert_checkequal(cumprod(b,'*','native'), hypermat([2,2,2],[%t;%f;%f;%f;%f;%f;%f;%f]));
 
147
assert_checkequal(cumprod(b,1,'native'), hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f]));
 
148
assert_checkequal(cumprod(b,2,'native'), hypermat([2,2,2],[%t;%f;%t;%f;%f;%f;%f;%f]));
 
149
assert_checkequal(cumprod(b,3,'native'), hypermat([2,2,2],[%t;%f;%t;%t;%f;%f;%f;%f]));
 
150
assert_checkequal(cumprod(b,5,'native'), b);
150
151
 
151
152
//=======================================================================
152
153
//sparse matrices of floats
153
154
s=sparse([1 10 0;-1 0 9]);
154
155
T=list(list(),list('native'),list('double'));
155
156
for typ=T
156
 
  if or(cumprod(s,typ(:))<>sparse([1,1;1,2;2,1],[1;-10;-1],[2,3])) then pause,end
157
 
  if or(cumprod(s,'*',typ(:))<>sparse([1,1;1,2;2,1],[1;-10;-1],[2,3])) then pause,end
158
 
  if or(cumprod(s,1,typ(:))<>sparse([1,1;1,2;2,1],[1;10;-1],[2,3])) then pause,end
159
 
  if or(cumprod(s,2,typ(:))<>sparse([1,1;1,2;2,1],[1;10;-1],[2,3])) then pause,end
160
 
  if or(cumprod(s,3,typ(:))<>s) then pause,end
 
157
  assert_checkequal(cumprod(s,typ(:)), sparse([1,1;1,2;2,1],[1;-10;-1],[2,3]));
 
158
  assert_checkequal(cumprod(s,'*',typ(:)), sparse([1,1;1,2;2,1],[1;-10;-1],[2,3]));
 
159
  assert_checkequal(cumprod(s,1,typ(:)), sparse([1,1;1,2;2,1],[1;10;-1],[2,3]));
 
160
  assert_checkequal(cumprod(s,2,typ(:)), sparse([1,1;1,2;2,1],[1;10;-1],[2,3]));
 
161
  assert_checkequal(cumprod(s,3,typ(:)), s);
161
162
end
162
163
 
163
164
//=======================================================================
164
165
//sparse  matrices of boolean
165
166
bs=sparse([%t %t %f;%t %t %t]);
166
167
for typ=list(list(),list('double'));
167
 
  if or(cumprod(bs,typ(:))<>sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3])) then pause,end
168
 
  if or(cumprod(bs,'*',typ(:))<>sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3])) then pause,end
169
 
  if or(cumprod(bs,1,typ(:))<>sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3])) then pause,end
170
 
  if or(cumprod(bs,2,typ(:))<>sparse([1,1;1,2;2,1;2,2;2,3],[1;1;1;1;1],[2,3])) then pause,end
171
 
  if or(cumprod(bs,3,typ(:))<>bool2s(bs)) then pause,end
 
168
  assert_checkequal(cumprod(bs,typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
 
169
  assert_checkequal(cumprod(bs,'*',typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
 
170
  assert_checkequal(cumprod(bs,1,typ(:)), sparse([1,1;1,2;2,1;2,2],[1;1;1;1],[2,3]));
 
171
  assert_checkequal(cumprod(bs,2,typ(:)), sparse([1,1;1,2;2,1;2,2;2,3],[1;1;1;1;1],[2,3]));
 
172
  assert_checkequal(cumprod(bs,3,typ(:)), bool2s(bs));
172
173
end
173
174
 
174
 
if or(cumprod(bs,'native')<>sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3])) then pause,end
175
 
if or(cumprod(bs,'*','native')<>sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3])) then pause,end
 
175
assert_checkequal(cumprod(bs,'native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
 
176
assert_checkequal(cumprod(bs,'*','native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
176
177
 
177
 
if or(cumprod(bs,1,'native')<>sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3])) then pause,end
178
 
if or(cumprod(bs,2,'native')<>sparse([1,1;1,2;2,1;2,2;2,3],[%t;%t;%t;%t;%t],[2,3])) then pause,end
179
 
if or(cumprod(bs,3,'native')<>bs) then pause,end
 
178
assert_checkequal(cumprod(bs,1,'native'), sparse([1,1;1,2;2,1;2,2],[%t;%t;%t;%t],[2,3]));
 
179
assert_checkequal(cumprod(bs,2,'native'), sparse([1,1;1,2;2,1;2,2;2,3],[%t;%t;%t;%t;%t],[2,3]));
 
180
assert_checkequal(cumprod(bs,3,'native'), bs);
180
181
 
181
182
// TODO : test the "m" option