tminres
SerialExample/SimpleVector.hpp
Go to the documentation of this file.
00001 // tminres is free software; you can redistribute it and/or modify it under the
00002 // terms of the GNU Lesser General Public License (as published by the Free
00003 // Software Foundation) version 2.1 dated February 1999.
00004 //
00005 // Authors:
00006 // - Umberto Villa, Emory University - uvilla@emory.edu
00007 // - Michael Saunders, Stanford University
00008 // - Santiago Akle, Stanford University
00009 
00016 #ifndef SIMPLEVECTOR_HPP_
00017 #define SIMPLEVECTOR_HPP_
00018 
00019 #include <iostream>
00020 
00022 
00027 class SimpleVector
00028 {
00029 public:
00030 
00032 
00035         SimpleVector(int size);
00037         virtual ~SimpleVector();
00038 
00040         SimpleVector &  operator=(const double & val);
00042         SimpleVector & operator=(const SimpleVector & RHS);
00044         void Scale(const double & val);
00046         SimpleVector * Clone();
00047 
00049         double & operator[](const int i);
00051         const double & operator[](const int i) const;
00053         const double at(const int i) const;
00054 
00056         void Randomize(int seed);
00057 
00059         void Print(std::ostream & os);
00060 
00062         friend void add(const SimpleVector & v1, const double & c2, const SimpleVector & v2, SimpleVector & result);
00064         friend void add(const double & c1, const SimpleVector & v1, const double & c2, const SimpleVector & v2, SimpleVector & result);
00066         friend void add(const double & alpha, const SimpleVector & v1, const SimpleVector & v2, SimpleVector & result);
00068         friend void add(const SimpleVector & v1, const SimpleVector & v2, const SimpleVector & v3, SimpleVector & result);
00070         friend void subtract(const SimpleVector & v1, const SimpleVector & v2, SimpleVector & result);
00072         friend double InnerProduct(const SimpleVector & v1, const SimpleVector & v2);
00073 
00074 
00075 private:
00076         double * vals;
00077         int size;
00078 };
00079 
00080 
00081 
00082 #endif /* SIMPLEVECTOR_HPP_ */
 All Classes Files Functions Friends