annotate test_vector.c @ 102:31b24eaf05cc

remove .o
author Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
date Thu, 02 Jun 2011 23:11:44 +0900
parents 1033fece71ce
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdio.h>
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "ps2util.h"
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include "libps2.h"
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 void init_FVECTOR(FVECTOR v, float num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 void init_FMATRIX(FMATRIX m, float num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 void output_FVECTOR(FVECTOR v);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 void output_FMATRIX(FMATRIX m);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 void all_init(FVECTOR v0, FVECTOR v1, FMATRIX m0, FMATRIX m1, float num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
97
afddacdf30dd compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
11
afddacdf30dd compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
12 /*
afddacdf30dd compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
13 ps2util.c にある、vector 計算のテスト用処理です。
afddacdf30dd compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
14 */
afddacdf30dd compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents: 96
diff changeset
15
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 int main(){
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 FVECTOR resultV;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 FMATRIX resultM;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 float resultf;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 FVECTOR v0,v1;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 FMATRIX m0,m1;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 float f0 = 0.5;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 float num = 0.1;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 int i,j;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 int lim1 = 4;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 //v0,v1,m0,m1 を初期化
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 printf("v0\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 output_FVECTOR(v0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 printf("v1\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 output_FVECTOR(v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 printf("m0\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 output_FMATRIX(m0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 printf("m1\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 output_FMATRIX(m1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 /*-----------ps2util.c test----------*/
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 ps2_vu0_copy_vector(v0, v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 printf("ps2_vu0_copy_vector(v0, v1)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 output_FVECTOR(v0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 output_FVECTOR(v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 ps2_vu0_unit_matrix(m0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 printf("ps2_vu0_unit_matrix(m0)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 output_FMATRIX(m0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 ps2_vu0_rot_matrix_y(resultM, m0, f0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 printf("ps2_vu0_rot_matrix_y(resultM, m0, f0)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 output_FMATRIX(resultM);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 ps2_vu0_apply_matrix(resultV, m0, v0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 printf("ps2_vu0_apply_matrix(resultV, m0, v0)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 output_FVECTOR(resultV);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 ps2_vu0_scale_vector(resultV, v0, f0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 printf("ps2_vu0_sacle_vector(resultV, v0, f0)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 output_FVECTOR(resultV);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 ps2_vu0_add_vector(resultV, v0, v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 printf("ps2_vu0_add_vector(resultV, v0, v1)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 output_FVECTOR(resultV);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 ps2_vu0_outer_product(resultV, v0, v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 printf("ps2_vu0_outer_product(resultV, v0, v1)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 output_FVECTOR(resultV);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 resultf = ps2_vu0_inner_product(v0, v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 printf("ps2_vu0_inner_product(v0, v1)\n");
98
1033fece71ce text_vector
e085768
parents: 97
diff changeset
99 printf("resultf = %10f\n",resultf);
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 ps2_vu0_mul_matrix(resultM, m0, m1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 printf("ps2_vu0_mul_matrix(resultM, m0, m1)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 output_FMATRIX(resultM);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 ps2_vu0_copy_matrix(m0, m1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 printf("ps2_vu0_copy_matrix(m0, m1)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 output_FMATRIX(m0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 output_FMATRIX(m0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 ps2_vu0_sub_vector(resultV, v0, v1);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 printf("ps2_vu0_sub_vector(resultV, v0, v1)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 output_FVECTOR(resultV);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 ps2_vu0_normalize(resultV, v0);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 printf("ps2_vu0_normalize(result, v0)\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 output_FVECTOR(resultV);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 all_init(v0, v1, m0, m1, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 //使用する値の初期化 FVECTOR
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 void init_FVECTOR(FVECTOR v, float num){
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 int i;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 int lim1=4;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 for ( i=0; i<lim1; i++ ) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 v[i] = num + ( (float)i * num * 0.3 ) ;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 }
98
1033fece71ce text_vector
e085768
parents: 97
diff changeset
140 v[3] = 1;
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 //使用する値の初期化 FMATRIX
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 void init_FMATRIX(FMATRIX m, float num){
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 int i,j;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 int lim1=4;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 for ( i=0; i<lim1; i++ ) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 for ( j=0; j<lim1; j++ ) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 m[i][j] = ( num * (float)j ) + ( (float)i * num*4.0 ) ;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 }
98
1033fece71ce text_vector
e085768
parents: 97
diff changeset
152 m[0][3] = m[1][3] = m[2][3] = 0;
1033fece71ce text_vector
e085768
parents: 97
diff changeset
153
1033fece71ce text_vector
e085768
parents: 97
diff changeset
154 m[3][0] = m[3][1] = m[3][2] = 0;
1033fece71ce text_vector
e085768
parents: 97
diff changeset
155 m[3][3] = 1;
96
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
157
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 //--------出力---------
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 void output_FVECTOR(FVECTOR v){
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 int i;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 int lim1 = 4;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 for ( i=0; i<lim1; i++ ) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 printf("%10f ",v[i]);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 printf("\n\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 //--------出力---------
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 void output_FMATRIX(FMATRIX m){
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 int i,j;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 int lim1 = 4;
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 for ( i=0; i<lim1; i++ ) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 for ( j=0; j<lim1; j++ ) {
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 printf("%10f",m[i][j]);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 printf("\n");
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 }
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
181
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
182
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 //全部を初期値に戻す。
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 void all_init(FVECTOR v0, FVECTOR v1, FMATRIX m0, FMATRIX m1, float num){
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 init_FVECTOR(v0, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 init_FVECTOR(v1, num*2);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 init_FMATRIX(m0, num);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 init_FMATRIX(m1, num*2);
0b65ca27f113 compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 }