Permalink
Browse files

removed test inside cpp

  • Loading branch information...
1 parent 6b3118f commit 3f42a674233d9d1afdeb88cd6b8844b8ba231f8d @yglee committed Aug 27, 2012
Showing with 0 additions and 321 deletions.
  1. +0 −46 cpp/test/\
  2. BIN cpp/test/fastslam
  3. +0 −78 cpp/test/main.cpp
  4. +0 −56 cpp/test/makefile
  5. +0 −100 cpp/test/particle.cpp
  6. +0 −41 cpp/test/particle.h
View
@@ -1,46 +0,0 @@
-#include <Eigen/Dense>
-#include <Eigen/Cholesky>
-#include <stdio.h>
-#include <iostream>
-
-using namespace std;
-using namespace Eigen;
-
-void helper(MatrixXf *t) {
- MatrixXf A(2,2);
- A<<1.0,2.0,1.0,2.0;
-
- *t = A;
-}
-
-int main (int argc, char*argv[])
-{
- MatrixXf S(3,3);
- S << 4.0,-1.0,2.0, -1.0,6.0,0.0, 2.0,0.0,5.0;
-
- helper(&S);
-
- cout<<"S"<<endl;
- cout<<S<<endl;
-
-
- MatrixXf A(2,2);
- A << 2,1,2,1;
-#if 0
- MatrixXf L = S.llt().matrixL();
-
- cout << "The Cholesky factor L is" << endl << L << endl;
- cout << "To check this, let us compute L * L.transpose()" << endl;
- cout << L * L.transpose() << endl;
- cout<< "complex conjugate"<<endl;
- MatrixXf A = L.transpose();
- cout<< A * A.transpose() << endl;
- cout << "This should equal the matrix S" << endl;
-
- Vector3f vec;
- vec << 1,2,3;
-
- cout<<"A is "<<endl;
- cout<<vec<<endl;
-#endif
-}
View
Binary file not shown.
View
@@ -1,78 +0,0 @@
-#include <Eigen/Dense>
-#include <Eigen/Cholesky>
-#include <stdio.h>
-#include <iostream>
-#include <vector>
-#include "particle.h"
-
-using namespace std;
-using namespace Eigen;
-
-#include <Eigen/SVD>
-
-#if 0
-void test(Particle **a)
-{
- Particle *particles2 = new Particle[4];
- for (int i =0; i< 4; i++) {
- particles2[i].x = 1;
- }
- *a = particles2;
-}
-#endif
-
-int main (int argc, char*argv[])
-{
-
-#if 0
- Particle *particles = new Particle[10];
-
- for (int j=0;j< 10; j++) {
- particles[j].x = 2;
- }
-
- for (int k=0; k<20; k++) {
- cout<<particles[k].x<<" ";
- }
- cout<<" "<<endl;
-
- test(&particles);
-
- for (int m=0; m<10; m++) {
- cout<<particles[m].x<<" ";
- }
-
- cout<<" "<<endl;
-
- vector<Particle> newPart(3);
- newPart[2].x = 300;
- cout<<newPart[0].x<<" " <<newPart[1].x<<endl;
-
- vector<Particle> oldPart = vector<Particle>(newPart);
- newPart[2].x = 1000;
- oldPart[2].x = 500;
- cout<<oldPart[2].x<<endl;
- cout<<newPart[2].x<<endl;
-#endif
-
- MatrixXf test(3,3);
- test<<5.59645e-05, -3.26374e-06, -8.15936e-07,
- -3.26374e-06, 1.89453e-05, 4.73632e-06,
- -8.15936e-07, 4.73632e-06, 1.18408e-06;
-
- test<<5.5964464991120621562e-05, -3.2637426556902937591e-06, -8.1593566392257343978e-07,
--3.2637424283166183159e-06, 1.8945262127090245485e-05, 4.7363155317725613713e-06,
--8.1593560707915457897e-07, 4.7363155317725613713e-06, 1.1840788829431403428e-06;
-
- MatrixXf Pv(test);
-
- cout<<"Pv"<<endl;
- cout<<Pv<<endl;
- cout<<"Pv.inverse()"<<endl;
- cout<<Pv.inverse()<<endl;
-
- MatrixXf A_inv = Pv.llt().solve(MatrixXf::Identity(Pv.rows(),Pv.cols()));
- cout<<"A_inv"<<endl;
- cout<<A_inv<<endl;
-
-}
View
@@ -1,56 +0,0 @@
-#Code -------------------------------
-
-### YOU CAN CHANGE THESE VARIABLES AS YOU ADD CODE:
-TARGET := fastslam
-SOURCES := $(wildcard ./*.cpp)
-
-#Libraries -------------------------------
-
-#Check for OSX. Works on 10.5 (and 10.4 but untested)
-#This line still kicks out an annoying error on Solaris.
-ifeq ($(shell sw_vers 2>/dev/null | grep Mac | awk '{ print $$2}'),Mac)
- #Assume Mac
- INCLUDE := -I./include/ -I/usr/X11/include -I/opt/local/include -I/opt/local/include/eigen2
- LIBRARY := -L"/System/Library/Frameworks/OpenGL.framework/Libraries" \
- -lGL -lGLU -lm -lstdc++
- FRAMEWORK := -framework GLUT -framework OpenGL
- MACROS := -DOSX
- PLATFORM := Mac
-else
- #Assume X11
- INCLUDE := -I./include/ -I/usr/X11R6/include -I/sw/include \
- -I/usr/sww/include -I/usr/sww/pkg/Mesa/include -I/usr/include/eigen3
- LIBRARY := -L./lib/nix -L/usr/X11R6/lib -L/sw/lib -L/usr/sww/lib \
- -L/usr/sww/bin -L/usr/sww/pkg/Mesa/lib -lglut -lGLU -lGL -lX11
- FRAMEWORK :=
- MACROS :=
- PLATFORM := *Nix
-endif
-
-#Basic Stuff -----------------------------
-
-CC := gcc
-CXX := g++
-CXXFLAGS := -g -Wall -O3 -fmessage-length=0 -DGL_GLEXT_PROTOTYPES $(INCLUDE) $(MACROS)
-LDFLAGS := $(FRAMEWORK) $(LIBRARY)
-#-----------------------------------------
-%.o : %.cpp
- @echo "Compiling .cpp to .o for $(PLATFORM) Platform: $<"
- @$(CXX) -c -Wall $(CXXFLAGS) $< -o $@
-
-OBJECTS = $(SOURCES:.cpp=.o)
-
-$(TARGET): $(OBJECTS)
- @echo "Linking .o files into: $(TARGET)"
- @$(CXX) $(LDFLAGS) $(OBJECTS) -o $(TARGET)
-
-default: $(TARGET)
-
-all: default
-
-clean:
- @echo "Removing compiled files: $<"
- /bin/rm -f $(OBJECTS) $(TARGET)
-
-
-
View
@@ -1,100 +0,0 @@
-#include <iostream>
-#include "particle.h"
-#include <algorithm>
-
-/*************
-** Particle
-*************/
-
-Particle::Particle()
-{
- _w = 1.0;
- _xv = VectorXf(3,1);
- _Pv = MatrixXf(3,3);
- _Pv.setZero();
- _xf = MatrixXf(0,0);
- _da = NULL;
-}
-
-Particle::Particle(float w, VectorXf xv, MatrixXf Pv, MatrixXf xf, vector<MatrixXf> Pf, float* da)
-{
- _w = w;
- _xv = xv;
- _Pv = Pv;
- _xf = xf;
- _Pf = vector<MatrixXf>(Pf);
- _da = da;
-}
-
-Particle::~Particle()
-{
-}
-
-//getters
-float Particle::w() const
-{
- return _w;
-}
-
-VectorXf Particle::xv() const
-{
- return _xv;
-}
-
-MatrixXf Particle::Pv() const
-{
- return _Pv;
-}
-
-MatrixXf Particle::xf() const
-{
- return _xf;
-}
-
-vector<MatrixXf> Particle::Pf() const
-{
- return _Pf;
-}
-
-float* Particle::da() const
-{
- return _da;
-}
-
-//setters
-void Particle::setW(float w)
-{
- _w = w;
-}
-
-void Particle::setXv(VectorXf xv)
-{
- for (int s=0; s<xv.size(); s++) {
- _xv(s) = xv(s); //copy over the values
- }
-}
-
-void Particle::setPv(MatrixXf Pv)
-{
- for (int r=0; r<Pv.rows(); r++){
- for (int j=0; j<Pv.cols(); j++){
- _Pv(r,j) = Pv(r,j); //copy over the values
- }
- }
-}
-
-void Particle::setXf(MatrixXf xf)
-{
- _xf = xf;
-}
-
-void Particle::setPf(vector<MatrixXf> Pf)
-{
- _Pf = vector<MatrixXf>(Pf);
-}
-
-void Particle::setDa(float* da)
-{
- _da = da;
-}
-
View
@@ -1,41 +0,0 @@
-#ifndef PARTICLES_H
-#define PARTICLES_H
-
-#include <Eigen/Dense>
-#include <vector>
-
-using namespace Eigen;
-using namespace std;
-
-class Particle{
-public:
- Particle();
- Particle(float w, VectorXf xv, MatrixXf Pv, MatrixXf xf, vector<MatrixXf> Pf, float* da);
- ~Particle();
-
- //getters
- float w() const;
- VectorXf xv() const;
- MatrixXf Pv() const;
- MatrixXf xf() const;
- vector<MatrixXf> Pf() const;
- float* da() const;
-
- //setters
- void setW(float w);
- void setXv(VectorXf xv);
- void setPv(MatrixXf Pv);
- void setXf(MatrixXf xf);
- void setPf(vector<MatrixXf> Pf);
- void setDa(float* da);
-
-private:
- float _w;
- VectorXf _xv;
- MatrixXf _Pv;
- MatrixXf _xf;
- vector<MatrixXf> _Pf;
- float* _da;
-};
-
-#endif //PARTICLES_H

0 comments on commit 3f42a67

Please sign in to comment.