yat
0.8.3pre
|
00001 #ifndef _theplu_yat_utility_vector_ 00002 #define _theplu_yat_utility_vector_ 00003 00004 // $Id: Vector.h 2119 2009-12-12 23:11:43Z peter $ 00005 00006 /* 00007 Copyright (C) 2003 Daniel Dalevi, Peter Johansson 00008 Copyright (C) 2004 Jari Häkkinen, Peter Johansson 00009 Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér 00010 Copyright (C) 2006 Jari Häkkinen, Markus Ringnér 00011 Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér 00012 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 00013 Copyright (C) 2009 Peter Johansson 00014 00015 This file is part of the yat library, http://dev.thep.lu.se/yat 00016 00017 The yat library is free software; you can redistribute it and/or 00018 modify it under the terms of the GNU General Public License as 00019 published by the Free Software Foundation; either version 3 of the 00020 License, or (at your option) any later version. 00021 00022 The yat library is distributed in the hope that it will be useful, 00023 but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00025 General Public License for more details. 00026 00027 You should have received a copy of the GNU General Public License 00028 along with yat. If not, see <http://www.gnu.org/licenses/>. 00029 */ 00030 00031 #include "VectorMutable.h" 00032 #include "Exception.h" 00033 00034 #include <cstddef> // size_t 00035 #include <iosfwd> 00036 #include <stdexcept> 00037 00038 #include <gsl/gsl_vector.h> 00039 00040 namespace theplu { 00041 namespace yat { 00042 namespace utility { 00043 00044 class matrix; 00045 00059 class Vector : public VectorMutable 00060 { 00061 public: 00065 Vector(void); 00066 00073 explicit Vector(size_t n, double init_value=0); 00074 00081 Vector(const Vector& other); 00082 00089 explicit Vector(const VectorBase& other); 00090 00103 explicit Vector(std::istream &, char sep='\0') 00104 throw(utility::IO_error, std::exception); 00105 00109 ~Vector(void); 00110 00114 bool isview(void) const; 00115 00126 void resize(size_t, double init_value=0); 00127 00137 const Vector& operator=(const Vector&); 00138 00148 const Vector& operator=(const VectorBase&); 00149 00150 private: 00151 const Vector& assign(const VectorBase& other); 00152 00164 gsl_vector* create_gsl_vector_copy(const VectorBase&) const; 00165 00177 gsl_vector* create_gsl_vector(size_t n) const; 00178 00179 void delete_allocated_memory(void); 00180 }; 00181 00191 void swap(Vector&, Vector&); 00192 00193 }}} // of namespace utility, yat, and theplu 00194 00195 #endif