git-svn-id: http://moon:8086/svn/software/trunk/projects/armadillo_eval@557 b431acfa-c32f-4a4a-93f1-934dc6c82436
34 lines
851 B
C++
34 lines
851 B
C++
#include <cstdio>
|
|
#include <cmath>
|
|
#include <armadillo>
|
|
|
|
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<arma::mat>(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;
|
|
} |