40 |
m_data(&data), |
m_data(&data), |
41 |
m_shape(viewShape), |
m_shape(viewShape), |
42 |
m_offset(offset), |
m_offset(offset), |
43 |
m_noValues(noValues(viewShape)) |
m_noValues(DataTypes::noValues(viewShape)) |
44 |
{ |
{ |
45 |
// |
// |
46 |
// check the shape rank and size and throw an exception if a |
// check the shape rank and size and throw an exception if a |
193 |
return m_shape; |
return m_shape; |
194 |
} |
} |
195 |
|
|
196 |
int |
// int |
197 |
DataArrayView::noValues(const ShapeType& shape) |
// DataArrayView::noValues(const ShapeType& shape) |
198 |
{ |
// { |
199 |
ShapeType::const_iterator i; |
// ShapeType::const_iterator i; |
200 |
// |
// // |
201 |
// An empty shape vector means rank 0 which contains 1 value |
// // An empty shape vector means rank 0 which contains 1 value |
202 |
int noValues=1; |
// int noValues=1; |
203 |
for (i=shape.begin();i!=shape.end();i++) { |
// for (i=shape.begin();i!=shape.end();i++) { |
204 |
noValues*=(*i); |
// noValues*=(*i); |
205 |
} |
// } |
206 |
return noValues; |
// return noValues; |
207 |
} |
// } |
208 |
|
// |
209 |
int |
// int |
210 |
DataArrayView::noValues(const RegionLoopRangeType& region) |
// DataArrayView::noValues(const RegionLoopRangeType& region) |
211 |
{ |
// { |
212 |
// |
// // |
213 |
// An empty region vector means rank 0 which contains 1 value |
// // An empty region vector means rank 0 which contains 1 value |
214 |
int noValues=1; |
// int noValues=1; |
215 |
unsigned int i; |
// unsigned int i; |
216 |
for (i=0;i<region.size();i++) { |
// for (i=0;i<region.size();i++) { |
217 |
noValues*=region[i].second-region[i].first; |
// noValues*=region[i].second-region[i].first; |
218 |
} |
// } |
219 |
return noValues; |
// return noValues; |
220 |
} |
// } |
221 |
|
|
222 |
int |
int |
223 |
DataArrayView::noValues() const |
DataArrayView::noValues() const |
725 |
return temp.str(); |
return temp.str(); |
726 |
} |
} |
727 |
|
|
728 |
string |
// string |
729 |
DataArrayView::shapeToString(const DataTypes::ShapeType& shape) |
// DataArrayView::shapeToString(const DataTypes::ShapeType& shape) |
730 |
{ |
// { |
731 |
stringstream temp; |
// stringstream temp; |
732 |
temp << "("; |
// temp << "("; |
733 |
unsigned int i; |
// unsigned int i; |
734 |
for (i=0;i<shape.size();i++) { |
// for (i=0;i<shape.size();i++) { |
735 |
temp << shape[i]; |
// temp << shape[i]; |
736 |
if (i < shape.size()-1) { |
// if (i < shape.size()-1) { |
737 |
temp << ","; |
// temp << ","; |
738 |
} |
// } |
739 |
} |
// } |
740 |
temp << ")"; |
// temp << ")"; |
741 |
return temp.str(); |
// return temp.str(); |
742 |
} |
// } |
743 |
|
|
744 |
void |
void |
745 |
DataArrayView::matMult(const DataArrayView& left, |
DataArrayView::matMult(const DataArrayView& left, |