From b4efb1d8f5f044d2ec7cdd4e6ba1e933f2ac0304 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Mon, 21 Oct 2019 19:15:45 +0000 Subject: [PATCH] - initial import git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@559 b431acfa-c32f-4a4a-93f1-934dc6c82436 --- Makefile | 16 ++++++++++++++++ source/main.cpp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 Makefile create mode 100644 source/main.cpp diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f79cfc5 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +SRCS := source/main.cpp +BUILD_DIR := ./build +CXXFLAGS += -o0 -std=c++11 +LIBS := -larmadillo + +all: ${BUILD_DIR}/main.elf + + +${BUILD_DIR}/main.elf: ${BUILD_DIR} ${SRCS} + g++ ${CXXFLAGS} ${SRCS} -o $@ ${LIBS} + +${BUILD_DIR}: + mkdir -p $@ + +clean: + rm -rf ${BUILD_DIR}/* \ No newline at end of file diff --git a/source/main.cpp b/source/main.cpp new file mode 100644 index 0000000..e61efef --- /dev/null +++ b/source/main.cpp @@ -0,0 +1,34 @@ +#include +#include +#include + +int main() +{ + printf("Hallo, Welt!\n"); + + // Position of a particle // | + arma::vec Pos = {{0}, // | (0,1) + {1}}; // +---x--> + + // Rotation matrix + double phi = -3.1416/2; + arma::mat RotM = {{+cos(phi), -sin(phi)}, + {+sin(phi), +cos(phi)}}; + + Pos.print("Current position of the particle:"); + std::cout << "Rotating the point " << phi*180/3.1416 << " deg" << std::endl; + + Pos = RotM*Pos; + + Pos.print("New position of the particle:"); // ^ + // x (1,0) + // | + arma::mat Z = arma::eye(4,4); + Z.print("Z:"); + printf("Z.n_rows = %d\n", (int)Z.n_rows); + printf("Z.n_cols = %d\n", (int)Z.n_cols); + printf("Z.n_elem = %d\n", (int)Z.n_elem); + // +------> + + return 0; +} \ No newline at end of file