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 
#define m3(v1, v2, v3)
Definition: egsl_macros.h:14
void egsl_pop()
Definition: egsl.c:89
Definition: egsl.h:12
void egsl_push()
Definition: egsl.c:88
#define M_PI
Definition: math_utils.h:7
#define tr(v)
Definition: egsl_macros.h:12
#define m(v1, v2)
Definition: egsl_macros.h:13
struct @0 p
#define sc(d, v)
Definition: egsl_macros.h:24
#define rot(theta)
Definition: egsl_macros.h:22
void egsl_print_spectrum(const char *s, val v)
Definition: egsl_misc.c:31
val egsl_vFa(size_t rows, const double *)
#define sum(v1, v2)
Definition: egsl_macros.h:10
int main()
Definition: egsl_test.c:5
void egsl_print(const char *str, val v)
Definition: egsl.c:251
val egsl_vFda(size_t rows, size_t columns, const double *)


csm
Author(s): Andrea Censi
autogenerated on Tue May 11 2021 02:18:23