00001 #ifndef SCALARBATCH_H 00002 #define SCALARBATCH_H 00003 00004 #include "SundanceDefs.h" 00005 00006 #include "ListBatchBase.h" 00007 00008 00009 namespace Sundance 00010 { 00011 00012 using namespace TSF; 00013 using std::string; 00014 00015 using std::ostream; 00016 00017 /** \ingroup LowLevelSymbolics 00018 * A batch of values of a scalar-valued expr 00019 */ 00020 class ScalarBatch : public ListBatchBase 00021 { 00022 public: 00023 /** \name Developer-only functions */ 00024 //@{ 00025 /** no detailed doc */ 00026 ScalarBatch(const DenseSerialVector& v); 00027 /** */ 00028 virtual ~ScalarBatch(){;} 00029 00030 /** */ 00031 virtual int listLength() const {return 1;} 00032 /** */ 00033 virtual int nPoints() const {return data_.length();} 00034 /** */ 00035 virtual int listSize() const {return 1;} 00036 00037 /** */ 00038 virtual const ListBatch& listElement(int i) const ; 00039 /** */ 00040 virtual ListBatch& listElement(int i) ; 00041 00042 /** */ 00043 virtual const DenseSerialVector& value() const {return data_;} 00044 /** */ 00045 virtual void setValue(const DenseSerialVector& v) {data_ = v;} 00046 /** */ 00047 virtual ExprValue sliceAt(int i) const {return ExprValue(data_[i]);} 00048 /** */ 00049 virtual ExprValue sum(const DenseSerialVector& weights) const ; 00050 00051 /** */ 00052 virtual bool isScalar() const {return true;} 00053 //@} 00054 private: 00055 DenseSerialVector data_; 00056 static ListBatch dummyListBatch_; 00057 }; 00058 00059 } 00060 #endif