Main Page
Modules
Namespaces
Classes
Files
File List
File Members
sm
lib
egsl
egsl_test.c
Go to the documentation of this file.
1
#include <math.h>
2
#include <gsl/gsl_math.h>
3
#include "
egsl_macros.h
"
4
5
int
main
() {
6
egsl_push
();
7
8
/* Creates a vector from a double array */
9
double
p
[2] = {1,2};
10
val
vp =
egsl_vFa
(2,p);
11
12
/* Creates a matrix from a double array */
13
double
md[4] = {
14
1, 2,
15
0, -1
16
};
17
val
m
=
egsl_vFda
(2,2,md);
18
19
/* Creates a rotation matrix */
20
val
R =
rot
(
M_PI
/2);
21
22
/* Multiplies the three together */
23
val
vrot =
m3
(R, m, vp);
24
25
/* Displays the results */
26
egsl_print
(
"R"
, R);
27
egsl_print
(
"vp"
, vp);
28
egsl_print
(
"vrot"
, vrot);
29
30
/* Create a semidifinite matrix (symmetric part of R) */
31
val
A =
sc
(0.5,
sum
(m,
tr
(m)) );
32
33
/* Displays spectrum */
34
egsl_print
(
"A"
,A);
35
egsl_print_spectrum
(
"A"
,A);
36
37
egsl_pop
();
38
39
return
0;
40
}
41
m3
#define m3(v1, v2, v3)
Definition:
egsl_macros.h:14
egsl_pop
void egsl_pop()
Definition:
egsl.c:89
egsl_val
Definition:
egsl.h:12
egsl_push
void egsl_push()
Definition:
egsl.c:88
M_PI
#define M_PI
Definition:
math_utils.h:7
tr
#define tr(v)
Definition:
egsl_macros.h:12
m
#define m(v1, v2)
Definition:
egsl_macros.h:13
p
struct @0 p
sc
#define sc(d, v)
Definition:
egsl_macros.h:24
rot
#define rot(theta)
Definition:
egsl_macros.h:22
egsl_print_spectrum
void egsl_print_spectrum(const char *s, val v)
Definition:
egsl_misc.c:31
egsl_macros.h
egsl_vFa
val egsl_vFa(size_t rows, const double *)
Definition:
egsl_conversions.c:14
sum
#define sum(v1, v2)
Definition:
egsl_macros.h:10
main
int main()
Definition:
egsl_test.c:5
egsl_print
void egsl_print(const char *str, val v)
Definition:
egsl.c:251
egsl_vFda
val egsl_vFda(size_t rows, size_t columns, const double *)
Definition:
egsl_conversions.c:3
csm
Author(s): Andrea Censi
autogenerated on Tue May 11 2021 02:18:23