00001 // $Id$ 00002 // Copyright (C) 2003 Klaas Gadeyne <first dot last at gmail dot com> 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU Lesser General Public License as published by 00006 // the Free Software Foundation; either version 2.1 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 // 00018 00019 // This file only contains template specialisation code 00020 #include "sample.h" 00021 #include <cassert> 00022 00023 namespace BFL 00024 { 00025 using namespace MatrixWrapper; 00026 00027 00028 // Template Specialisation for T =ColumnVector 00029 template <> inline 00030 Sample<ColumnVector>::Sample (unsigned int dimension) 00031 : Value(dimension) 00032 {}; 00033 00034 00035 template <> inline unsigned int 00036 Sample<ColumnVector>::DimensionGet() const 00037 { 00038 return Value.rows(); 00039 }; 00040 00041 template <> inline void 00042 Sample<ColumnVector>::DimensionSet(unsigned int dim) 00043 { 00044 return Value.resize(dim); 00045 }; 00046 00047 // Template Specialisation for T = double 00048 template <> inline unsigned int 00049 Sample<double>::DimensionGet() const 00050 { 00051 return 1; 00052 }; 00053 00054 template <> inline void 00055 Sample<double>::DimensionSet(unsigned int dim) 00056 { 00057 assert(dim == 1); 00058 }; 00059 00060 // Template Specialisation for T = int 00061 template <> inline unsigned int 00062 Sample<int>::DimensionGet() const 00063 { 00064 return 1; 00065 }; 00066 00067 template <> inline void 00068 Sample<int>::DimensionSet(unsigned int dim) 00069 { 00070 assert(dim == 1); 00071 }; 00072 } 00073 00074 00075 00076 00077