Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 97498a1c712a846028cfe0e2f484ccda52680f60)
+++ src/Makefile.am	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
@@ -1,4 +1,7 @@
 ATOMSOURCE = atom.cpp atom_atominfo.cpp atom_bondedparticle.cpp atom_bondedparticleinfo.cpp atom_graphnode.cpp atom_graphnodeinfo.cpp atom_particleinfo.cpp atom_trajectoryparticle.cpp atom_trajectoryparticleinfo.cpp
 ATOMHEADER = atom.hpp atom_atominfo.hpp atom_bondedparticle.hpp atom_bondedparticleinfo.hpp atom_graphnode.hpp atom_graphnodeinfo.hpp atom_particleinfo.hpp atom_trajectoryparticle.hpp atom_trajectoryparticleinfo.hpp
+
+LINALGSOURCE = gslvector.cpp
+LINALGHEADER = gslvector.hpp
 
 ANALYSISSOURCE = analysis_bonds.cpp analysis_correlation.cpp
@@ -11,12 +14,13 @@
 INCLUDES = -I$(top_srcdir)/src/unittests
 
-noinst_LIBRARIES = libmolecuilder.a
+noinst_LIBRARIES = libmolecuilder.a libgslwrapper.a
 bin_PROGRAMS = molecuilder joiner analyzer
 molecuilderdir = ${bindir}
 libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER}
+libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER}
 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
 molecuilder_LDFLAGS = $(BOOST_LIB)
 molecuilder_SOURCES = builder.cpp
-molecuilder_LDADD = libmolecuilder.a
+molecuilder_LDADD = libmolecuilder.a libgslwrapper.a
 joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
 joiner_LDADD = libmolecuilder.a 
Index: src/gslvector.cpp
===================================================================
--- src/gslvector.cpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
+++ src/gslvector.cpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
@@ -0,0 +1,129 @@
+/*
+ * gslvector.cpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+#include "gslvector.hpp"
+
+/** Constructor of class GSLVector.
+ * Allocates GSL structures
+ * \param m dimension of vector
+ */
+GSLVector::GSLVector(size_t m) : dimension(m)
+{
+  vector = gsl_vector_calloc(dimension);
+};
+
+/** Copy constructor of class GSLVector.
+ * Allocates GSL structures and copies components from \a *src.
+ * \param *src source vector
+ */
+GSLVector::GSLVector(const GSLVector * const src) : dimension(src->dimension)
+{
+  vector = gsl_vector_alloc(dimension);
+  gsl_vector_memcpy (vector, src->vector);
+};
+
+/** Destructor of class GSLVector.
+ * Frees GSL structures
+ */
+GSLVector::~GSLVector()
+{
+  gsl_vector_free(vector);
+  dimension = 0;
+};
+
+/* ============================ Accessing =============================== */
+/** This function sets the vector from a double array.
+ * Creates a vector view of the array and performs a memcopy.
+ * \param *x array of values (no dimension check is performed)
+ */
+void GSLVector::SetFromDoubleArray(double * x)
+{
+  gsl_vector_view m = gsl_vector_view_array (x, dimension);
+  gsl_vector_memcpy (vector, &m.vector);
+};
+
+/** This function returns the i-th element of a vector.
+ * If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and 0 is returned.
+ * \param m m-th element
+ * \return  m-th element of vector
+ */
+double GSLVector::Get(size_t m)
+{
+  return gsl_vector_get (vector, m);
+};
+
+/** This function sets the value of the \a m -th element of a vector to \a x.
+ *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked.
+ * \param m-th element to set
+ * \param x value to set to
+ */
+double GSLVector::Set(size_t m, double x)
+{
+  gsl_vector_set (vector, m, x);
+};
+
+/** These functions return a pointer to the \a m-th element of a vector.
+ *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and a null pointer is returned.
+ * \param m m-th element
+ * \return pointer to \a m-th element
+ */
+double *GSLVector::Pointer(size_t m)
+{
+  return gsl_vector_ptr (vector, m);
+};
+
+/** These functions return a constant pointer to the \a m-th element of a vector.
+ *  If \a m lies outside the allowed range of 0 to GSLVector::dimension-1 then the error handler is invoked and a null pointer is returned.
+ * \param m m-th element
+ * \return const pointer to \a m-th element
+ */
+const double *GSLVector::const_Pointer(size_t m)
+{
+  return gsl_vector_const_ptr (vector, m);
+};
+
+/* ========================== Initializing =============================== */
+/** This function sets all the elements of the vector to the value \a x.
+ * \param *x
+ */
+void GSLVector::SetAll(double x)
+{
+  gsl_vector_set_all (vector, x);
+};
+
+/** This function sets all the elements of the vector to zero.
+ */
+void GSLVector::SetZero()
+{
+  gsl_vector_set_zero (vector);
+};
+
+/** This function makes a basis vector by setting all the elements of the vector to zero except for the i-th element which is set to one.
+ * \param i i-th component to set to unity (all other to zero)
+ * \return vector set
+ */
+int GSLVector::SetBasis(size_t i)
+{
+  return gsl_vector_set_basis (vector, i);
+};
+
+/* ====================== Exchanging elements ============================ */
+/** This function exchanges the \a i-th and \a j-th elements of the vector in-place.
+ * \param i i-th element to swap with ...
+ * \param j ... j-th element to swap against
+ */
+int GSLVector::SwapElements(size_t i, size_t j)
+{
+  return gsl_vector_swap_elements (vector, i, j);
+};
+
+/** This function reverses the order of the elements of the vector.
+ */
+int GSLVector::Reverse()
+{
+  return gsl_vector_reverse (vector);
+};
Index: src/gslvector.hpp
===================================================================
--- src/gslvector.hpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
+++ src/gslvector.hpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
@@ -0,0 +1,55 @@
+/*
+ * gslvector.hpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+#ifndef GSLVECTOR_HPP_
+#define GSLVECTOR_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+#include <gsl/gsl_vector.h>
+
+/****************************************** forward declarations *****************************/
+
+class GSLVector;
+
+/********************************************** declarations *******************************/
+
+class GSLVector {
+  friend class LinearSystemOfEquations;
+
+public:
+  GSLVector(size_t m);
+  GSLVector(const GSLVector * const src);
+  ~GSLVector();
+
+  // Accessing
+  void SetFromDoubleArray(double *x);
+  double Get(size_t m);
+  double Set(size_t m, double x);
+  double *Pointer(size_t m);
+  const double *const_Pointer(size_t m);
+
+  // Initializing
+  void SetAll(double x);
+  void SetZero();
+  int SetBasis(size_t m);
+
+  // Exchanging elements
+  int SwapElements(size_t i, size_t j);
+  int Reverse();
+
+private:
+  gsl_vector *vector;
+
+  size_t dimension;
+};
+
+
+
+#endif /* GSLVECTOR_HPP_ */
Index: src/unittests/Makefile.am
===================================================================
--- src/unittests/Makefile.am	(revision 97498a1c712a846028cfe0e2f484ccda52680f60)
+++ src/unittests/Makefile.am	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
@@ -4,5 +4,22 @@
 AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
 
-TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest InfoUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest TesselationUnitTest TesselationInOutsideUnitTest VectorUnitTest
+TESTS = \
+  ActOnAllUnitTest \
+  AnalysisBondsUnitTests \
+  AnalysisCorrelationToPointUnitTest \
+  AnalysisCorrelationToSurfaceUnitTest \
+  AnalysisPairCorrelationUnitTest \
+  BondGraphUnitTest \
+  GSLVectorUnitTest \
+  InfoUnitTest \
+  ListOfBondsUnitTest \
+  LogUnitTest \
+  MemoryUsageObserverUnitTest \
+  MemoryAllocatorUnitTest \
+  StackClassUnitTest \
+  TesselationUnitTest \
+  TesselationInOutsideUnitTest \
+  VectorUnitTest
+  
 check_PROGRAMS = $(TESTS)
 noinst_PROGRAMS = $(TESTS)
@@ -26,6 +43,18 @@
 BondGraphUnitTest_LDADD = ../libmolecuilder.a
 
+GSLMatrixSymmetricUnitTest_SOURCES = gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp
+GSLMatrixSymmetricUnitTest_LDADD = ../libgslwrapper.a
+
+GSLMatrixUnitTest_SOURCES = gslmatrixunittest.cpp gslmatrixunittest.hpp
+GSLMatrixUnitTest_LDADD = ../libgslwrapper.a
+
+GSLVectorUnitTest_SOURCES = gslvectorunittest.cpp gslvectorunittest.hpp
+GSLVectorUnitTest_LDADD = ../libgslwrapper.a
+
 InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp
 InfoUnitTest_LDADD = ../libmolecuilder.a
+
+LinearSystemOfEquationsUnitTest_SOURCES = linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp
+LinearSystemOfEquationsUnitTest_LDADD = ../libgslwrapper.a ../libmolecuilder.a
 
 ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp
Index: src/unittests/gslvectorunittest.cpp
===================================================================
--- src/unittests/gslvectorunittest.cpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
+++ src/unittests/gslvectorunittest.cpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
@@ -0,0 +1,136 @@
+/*
+ * gslvectorunittest.cpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "gslvectorunittest.hpp"
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( GSLVectorTest );
+
+
+void GSLVectorTest::setUp()
+{
+  v = new GSLVector(3);
+};
+
+void GSLVectorTest::tearDown()
+{
+  delete(v);
+};
+
+/** Unit test for accessing elements in the vector.
+ *
+ */
+void GSLVectorTest::AccessTest()
+{
+  // set
+  for (int i=0;i<3;i++)
+    v->Set(i,i);
+
+  // and check
+  double *ptr = NULL;
+  for (int i=0;i<3;i++) {
+    CPPUNIT_ASSERT_EQUAL( (double)i, v->Get(i) );
+    ptr = v->Pointer(i);
+    CPPUNIT_ASSERT_EQUAL( (double)i, *ptr );
+  }
+
+  // out of bounds
+  //CPPUNIT_ASSERT_EQUAL(0., v->Get(3) );
+  //CPPUNIT_ASSERT_EQUAL(0., v->Get(-1) );
+};
+
+
+/** Unit test for initializing the vector.
+ *
+ */
+void GSLVectorTest::InitializaionTest()
+{
+  // set zero
+  v->SetZero();
+  for (int i=0;i<3;i++)
+    CPPUNIT_ASSERT_EQUAL( 0., v->Get(i) );
+
+  // set basis
+  for (int i=0;i<3;i++) {
+    v->SetBasis(i);
+    for (int j=0;j<3;j++)
+      CPPUNIT_ASSERT_EQUAL( i == j ? 1. : 0. , v->Get(j) );
+  }
+
+  // set all
+  v->SetAll(1.5);
+  for (int i=0;i<3;i++)
+    CPPUNIT_ASSERT_EQUAL( 1.5, v->Get(i) );
+};
+
+/** Unit test for copying vectors.
+ *
+ */
+void GSLVectorTest::CopyTest()
+{
+  // set basis
+  GSLVector *dest = NULL;
+  for (int i=0;i<3;i++) {
+    v->SetBasis(i);
+    dest = new GSLVector(v);
+    for (int j=0;j<3;j++)
+      CPPUNIT_ASSERT_EQUAL( v->Get(j) , dest->Get(j) );
+
+    delete(dest);
+  }
+};
+
+/** Unit test for exchanging elements of a vector.
+ *
+ */
+void GSLVectorTest::ExchangeTest()
+{
+  // set basis
+  for (int i=0;i<3;i++) {
+    v->SetBasis(i);
+    v->SwapElements((i)%3,(i+1)%3);
+    for (int j=0;j<3;j++)
+      CPPUNIT_ASSERT_EQUAL( (i+1)%3 == j ? 1. : 0. , v->Get(j) );
+  }
+
+  // set to 1,2,3 and reverse
+  for (int i=0;i<3;i++)
+    v->Set(i,i+1);
+  v->Reverse();
+  for (int j=0;j<3;j++)
+    CPPUNIT_ASSERT_EQUAL( (double)(3-j), v->Get(j) );
+};
+
+
+/********************************************** Main routine **************************************/
+
+int main(int argc, char **argv)
+{
+  // Get the top level suite from the registry
+  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
+
+  // Adds the test to the list of test to run
+  CppUnit::TextUi::TestRunner runner;
+  runner.addTest( suite );
+
+  // Change the default outputter to a compiler error format outputter
+  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
+                                                       std::cerr ) );
+  // Run the tests.
+  bool wasSucessful = runner.run();
+
+  // Return error code 1 if the one of test failed.
+  return wasSucessful ? 0 : 1;
+};
Index: src/unittests/gslvectorunittest.hpp
===================================================================
--- src/unittests/gslvectorunittest.hpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
+++ src/unittests/gslvectorunittest.hpp	(revision 9fb86009e5c88cc9099c3a3d1040728ee1cd442e)
@@ -0,0 +1,41 @@
+/*
+ * gslvectorunittest.hpp
+ *
+ *  Created on: Jan 8, 2010
+ *      Author: heber
+ */
+
+#ifndef GSLVECTORUNITTEST_HPP_
+#define GSLVECTORUNITTEST_HPP_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "gslvector.hpp"
+
+/********************************************** Test classes **************************************/
+
+class GSLVectorTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( GSLVectorTest) ;
+    CPPUNIT_TEST (AccessTest );
+    CPPUNIT_TEST (InitializaionTest );
+    CPPUNIT_TEST (CopyTest );
+    CPPUNIT_TEST (ExchangeTest );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+    void setUp();
+    void tearDown();
+
+    void AccessTest();
+    void InitializaionTest();
+    void CopyTest();
+    void ExchangeTest();
+
+private:
+
+    GSLVector *v;
+};
+
+
+#endif /* GSLVECTORUNITTEST_HPP_ */
