do calculation of arrangement
arg_useful.h@2:1683e6a0002b, 2015-04-18 (annotated)
- Committer:
- hirokimineshita
- Date:
- Sat Apr 18 10:12:48 2015 +0000
- Revision:
- 2:1683e6a0002b
- Parent:
- 1:0f4bc913a3cc
2015/04/18 PM 7 be able to use int,double;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirokimineshita | 0:fe553d45f0b2 | 1 | #ifndef _ARG_USEFUL_20150418_1411_ |
hirokimineshita | 0:fe553d45f0b2 | 2 | #define _ARG_USEFUL_20150418_1411_ |
hirokimineshita | 1:0f4bc913a3cc | 3 | /** @file |
hirokimineshita | 1:0f4bc913a3cc | 4 | */ |
hirokimineshita | 0:fe553d45f0b2 | 5 | |
hirokimineshita | 0:fe553d45f0b2 | 6 | //at matrix, place is from left to right and next, from up to down |
hirokimineshita | 0:fe553d45f0b2 | 7 | |
hirokimineshita | 2:1683e6a0002b | 8 | /** (int)arg_subs : |
hirokimineshita | 2:1683e6a0002b | 9 | * |
hirokimineshita | 2:1683e6a0002b | 10 | * @bref substitution of arrangements |
hirokimineshita | 2:1683e6a0002b | 11 | * @param arg_to arrangement of what you want to submitition |
hirokimineshita | 2:1683e6a0002b | 12 | * @param arg_from arrangement of original |
hirokimineshita | 2:1683e6a0002b | 13 | * @param all_ele numbers of elements |
hirokimineshita | 2:1683e6a0002b | 14 | */ |
hirokimineshita | 2:1683e6a0002b | 15 | void arg_subs(int *arg_to,int *arg_from,int all_ele) |
hirokimineshita | 2:1683e6a0002b | 16 | { |
hirokimineshita | 2:1683e6a0002b | 17 | for(int i=0; i<all_ele; i++)arg_to[i]=arg_from[i]; |
hirokimineshita | 2:1683e6a0002b | 18 | } |
hirokimineshita | 2:1683e6a0002b | 19 | |
hirokimineshita | 2:1683e6a0002b | 20 | /** (float)arg_subs : |
hirokimineshita | 0:fe553d45f0b2 | 21 | * |
hirokimineshita | 0:fe553d45f0b2 | 22 | * @bref substitution of arrangements |
hirokimineshita | 0:fe553d45f0b2 | 23 | * @param arg_to arrangement of what you want to submitition |
hirokimineshita | 0:fe553d45f0b2 | 24 | * @param arg_from arrangement of original |
hirokimineshita | 0:fe553d45f0b2 | 25 | * @param all_ele numbers of elements |
hirokimineshita | 0:fe553d45f0b2 | 26 | */ |
hirokimineshita | 0:fe553d45f0b2 | 27 | void arg_subs(float *arg_to,float *arg_from,int all_ele) |
hirokimineshita | 0:fe553d45f0b2 | 28 | { |
hirokimineshita | 0:fe553d45f0b2 | 29 | for(int i=0; i<all_ele; i++)arg_to[i]=arg_from[i]; |
hirokimineshita | 0:fe553d45f0b2 | 30 | } |
hirokimineshita | 0:fe553d45f0b2 | 31 | |
hirokimineshita | 2:1683e6a0002b | 32 | /** (double)arg_subs : |
hirokimineshita | 2:1683e6a0002b | 33 | * |
hirokimineshita | 2:1683e6a0002b | 34 | * @bref substitution of arrangements |
hirokimineshita | 2:1683e6a0002b | 35 | * @param arg_to arrangement of what you want to submitition |
hirokimineshita | 2:1683e6a0002b | 36 | * @param arg_from arrangement of original |
hirokimineshita | 2:1683e6a0002b | 37 | * @param all_ele numbers of elements |
hirokimineshita | 2:1683e6a0002b | 38 | */ |
hirokimineshita | 2:1683e6a0002b | 39 | void arg_subs(double *arg_to,double *arg_from,int all_ele) |
hirokimineshita | 2:1683e6a0002b | 40 | { |
hirokimineshita | 2:1683e6a0002b | 41 | for(int i=0; i<all_ele; i++)arg_to[i]=arg_from[i]; |
hirokimineshita | 2:1683e6a0002b | 42 | } |
hirokimineshita | 2:1683e6a0002b | 43 | |
hirokimineshita | 2:1683e6a0002b | 44 | /** (int)arg_swap : |
hirokimineshita | 2:1683e6a0002b | 45 | * |
hirokimineshita | 2:1683e6a0002b | 46 | * @bref swap two arrangements |
hirokimineshita | 2:1683e6a0002b | 47 | * @param arg_a arrangement of what you want to swap |
hirokimineshita | 2:1683e6a0002b | 48 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 49 | * @param all_ele numbers of elements |
hirokimineshita | 2:1683e6a0002b | 50 | */ |
hirokimineshita | 2:1683e6a0002b | 51 | void arg_swap(int *arg_a,int *arg_b, int all_ele) |
hirokimineshita | 2:1683e6a0002b | 52 | { |
hirokimineshita | 2:1683e6a0002b | 53 | float c; |
hirokimineshita | 2:1683e6a0002b | 54 | for(int i=0; i<all_ele; i++){ |
hirokimineshita | 2:1683e6a0002b | 55 | c=arg_a[i]; |
hirokimineshita | 2:1683e6a0002b | 56 | arg_a[i]=arg_b[i]; |
hirokimineshita | 2:1683e6a0002b | 57 | arg_b[i]=c; |
hirokimineshita | 2:1683e6a0002b | 58 | } |
hirokimineshita | 2:1683e6a0002b | 59 | } |
hirokimineshita | 2:1683e6a0002b | 60 | |
hirokimineshita | 2:1683e6a0002b | 61 | /** (float)arg_swap : |
hirokimineshita | 0:fe553d45f0b2 | 62 | * |
hirokimineshita | 0:fe553d45f0b2 | 63 | * @bref swap two arrangements |
hirokimineshita | 0:fe553d45f0b2 | 64 | * @param arg_a arrangement of what you want to swap |
hirokimineshita | 0:fe553d45f0b2 | 65 | * @param arg_b (same as arg_a) |
hirokimineshita | 0:fe553d45f0b2 | 66 | * @param all_ele numbers of elements |
hirokimineshita | 0:fe553d45f0b2 | 67 | */ |
hirokimineshita | 0:fe553d45f0b2 | 68 | void arg_swap(float *arg_a,float *arg_b, int all_ele) |
hirokimineshita | 0:fe553d45f0b2 | 69 | { |
hirokimineshita | 0:fe553d45f0b2 | 70 | float c; |
hirokimineshita | 0:fe553d45f0b2 | 71 | for(int i=0; i<all_ele; i++){ |
hirokimineshita | 0:fe553d45f0b2 | 72 | c=arg_a[i]; |
hirokimineshita | 0:fe553d45f0b2 | 73 | arg_a[i]=arg_b[i]; |
hirokimineshita | 0:fe553d45f0b2 | 74 | arg_b[i]=c; |
hirokimineshita | 0:fe553d45f0b2 | 75 | } |
hirokimineshita | 0:fe553d45f0b2 | 76 | } |
hirokimineshita | 0:fe553d45f0b2 | 77 | |
hirokimineshita | 2:1683e6a0002b | 78 | /** (double)arg_swap : |
hirokimineshita | 2:1683e6a0002b | 79 | * |
hirokimineshita | 2:1683e6a0002b | 80 | * @bref swap two arrangements |
hirokimineshita | 2:1683e6a0002b | 81 | * @param arg_a arrangement of what you want to swap |
hirokimineshita | 2:1683e6a0002b | 82 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 83 | * @param all_ele numbers of elements |
hirokimineshita | 2:1683e6a0002b | 84 | */ |
hirokimineshita | 2:1683e6a0002b | 85 | void arg_swap(double *arg_a,double *arg_b, int all_ele) |
hirokimineshita | 2:1683e6a0002b | 86 | { |
hirokimineshita | 2:1683e6a0002b | 87 | float c; |
hirokimineshita | 2:1683e6a0002b | 88 | for(int i=0; i<all_ele; i++){ |
hirokimineshita | 2:1683e6a0002b | 89 | c=arg_a[i]; |
hirokimineshita | 2:1683e6a0002b | 90 | arg_a[i]=arg_b[i]; |
hirokimineshita | 2:1683e6a0002b | 91 | arg_b[i]=c; |
hirokimineshita | 2:1683e6a0002b | 92 | } |
hirokimineshita | 2:1683e6a0002b | 93 | } |
hirokimineshita | 2:1683e6a0002b | 94 | |
hirokimineshita | 2:1683e6a0002b | 95 | /** (int)arg_plus : |
hirokimineshita | 2:1683e6a0002b | 96 | * |
hirokimineshita | 2:1683e6a0002b | 97 | * @bref do addition of two matrix a[row][col] |
hirokimineshita | 2:1683e6a0002b | 98 | * @param ans matrix of answer |
hirokimineshita | 2:1683e6a0002b | 99 | * @param arg_a matrix of what you want to add |
hirokimineshita | 2:1683e6a0002b | 100 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 101 | * @param row numbers of elements of row |
hirokimineshita | 2:1683e6a0002b | 102 | * @param col numbers of elements of col |
hirokimineshita | 2:1683e6a0002b | 103 | */ |
hirokimineshita | 2:1683e6a0002b | 104 | void arg_plus(int *ans,int *arg_a,int *arg_b,int row,int col) |
hirokimineshita | 2:1683e6a0002b | 105 | { |
hirokimineshita | 2:1683e6a0002b | 106 | for(int i=0; i<row; i++){ |
hirokimineshita | 2:1683e6a0002b | 107 | for(int j=0; j<col; j++)ans[i*col+j] = arg_a[i*col+j]+arg_b[i*col+j]; |
hirokimineshita | 2:1683e6a0002b | 108 | } |
hirokimineshita | 2:1683e6a0002b | 109 | } |
hirokimineshita | 2:1683e6a0002b | 110 | |
hirokimineshita | 2:1683e6a0002b | 111 | /** (float)arg_plus : |
hirokimineshita | 0:fe553d45f0b2 | 112 | * |
hirokimineshita | 0:fe553d45f0b2 | 113 | * @bref do addition of two matrix a[row][col] |
hirokimineshita | 0:fe553d45f0b2 | 114 | * @param ans matrix of answer |
hirokimineshita | 0:fe553d45f0b2 | 115 | * @param arg_a matrix of what you want to add |
hirokimineshita | 0:fe553d45f0b2 | 116 | * @param arg_b (same as arg_a) |
hirokimineshita | 0:fe553d45f0b2 | 117 | * @param row numbers of elements of row |
hirokimineshita | 0:fe553d45f0b2 | 118 | * @param col numbers of elements of col |
hirokimineshita | 0:fe553d45f0b2 | 119 | */ |
hirokimineshita | 0:fe553d45f0b2 | 120 | void arg_plus(float *ans,float *arg_a,float *arg_b,int row,int col) |
hirokimineshita | 0:fe553d45f0b2 | 121 | { |
hirokimineshita | 0:fe553d45f0b2 | 122 | for(int i=0; i<row; i++){ |
hirokimineshita | 0:fe553d45f0b2 | 123 | for(int j=0; j<col; j++)ans[i*col+j] = arg_a[i*col+j]+arg_b[i*col+j]; |
hirokimineshita | 0:fe553d45f0b2 | 124 | } |
hirokimineshita | 0:fe553d45f0b2 | 125 | } |
hirokimineshita | 0:fe553d45f0b2 | 126 | |
hirokimineshita | 2:1683e6a0002b | 127 | /** (double)arg_plus : |
hirokimineshita | 2:1683e6a0002b | 128 | * |
hirokimineshita | 2:1683e6a0002b | 129 | * @bref do addition of two matrix a[row][col] |
hirokimineshita | 2:1683e6a0002b | 130 | * @param ans matrix of answer |
hirokimineshita | 2:1683e6a0002b | 131 | * @param arg_a matrix of what you want to add |
hirokimineshita | 2:1683e6a0002b | 132 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 133 | * @param row numbers of elements of row |
hirokimineshita | 2:1683e6a0002b | 134 | * @param col numbers of elements of col |
hirokimineshita | 2:1683e6a0002b | 135 | */ |
hirokimineshita | 2:1683e6a0002b | 136 | void arg_plus(double *ans,double *arg_a,double *arg_b,int row,int col) |
hirokimineshita | 2:1683e6a0002b | 137 | { |
hirokimineshita | 2:1683e6a0002b | 138 | for(int i=0; i<row; i++){ |
hirokimineshita | 2:1683e6a0002b | 139 | for(int j=0; j<col; j++)ans[i*col+j] = arg_a[i*col+j]+arg_b[i*col+j]; |
hirokimineshita | 2:1683e6a0002b | 140 | } |
hirokimineshita | 2:1683e6a0002b | 141 | } |
hirokimineshita | 2:1683e6a0002b | 142 | |
hirokimineshita | 2:1683e6a0002b | 143 | /** (int)arg_minus : |
hirokimineshita | 2:1683e6a0002b | 144 | * |
hirokimineshita | 2:1683e6a0002b | 145 | * @bref do subtraction of two matrix like a-b |
hirokimineshita | 2:1683e6a0002b | 146 | * @param ans matrix of answer |
hirokimineshita | 2:1683e6a0002b | 147 | * @param arg_a matrix of what you want to minus |
hirokimineshita | 2:1683e6a0002b | 148 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 149 | * @param row numbers of elements of row |
hirokimineshita | 2:1683e6a0002b | 150 | * @param col numbers of elements of col |
hirokimineshita | 2:1683e6a0002b | 151 | */ |
hirokimineshita | 2:1683e6a0002b | 152 | void arg_minus(int *ans,int *arg_a,int *arg_b,int row,int col) |
hirokimineshita | 2:1683e6a0002b | 153 | { |
hirokimineshita | 2:1683e6a0002b | 154 | for(int i=0; i<row; i++){ |
hirokimineshita | 2:1683e6a0002b | 155 | for(int j=0; j<col; j++)ans[i*col+j] = arg_a[i*col+j]-arg_b[i*col+j]; |
hirokimineshita | 2:1683e6a0002b | 156 | } |
hirokimineshita | 2:1683e6a0002b | 157 | } |
hirokimineshita | 2:1683e6a0002b | 158 | |
hirokimineshita | 2:1683e6a0002b | 159 | /** (float)arg_minus : |
hirokimineshita | 0:fe553d45f0b2 | 160 | * |
hirokimineshita | 0:fe553d45f0b2 | 161 | * @bref do subtraction of two matrix like a-b |
hirokimineshita | 0:fe553d45f0b2 | 162 | * @param ans matrix of answer |
hirokimineshita | 0:fe553d45f0b2 | 163 | * @param arg_a matrix of what you want to minus |
hirokimineshita | 0:fe553d45f0b2 | 164 | * @param arg_b (same as arg_a) |
hirokimineshita | 0:fe553d45f0b2 | 165 | * @param row numbers of elements of row |
hirokimineshita | 0:fe553d45f0b2 | 166 | * @param col numbers of elements of col |
hirokimineshita | 0:fe553d45f0b2 | 167 | */ |
hirokimineshita | 0:fe553d45f0b2 | 168 | void arg_minus(float *ans,float *arg_a,float *arg_b,int row,int col) |
hirokimineshita | 0:fe553d45f0b2 | 169 | { |
hirokimineshita | 0:fe553d45f0b2 | 170 | for(int i=0; i<row; i++){ |
hirokimineshita | 0:fe553d45f0b2 | 171 | for(int j=0; j<col; j++)ans[i*col+j] = arg_a[i*col+j]-arg_b[i*col+j]; |
hirokimineshita | 0:fe553d45f0b2 | 172 | } |
hirokimineshita | 0:fe553d45f0b2 | 173 | } |
hirokimineshita | 0:fe553d45f0b2 | 174 | |
hirokimineshita | 2:1683e6a0002b | 175 | /** (double)arg_minus : |
hirokimineshita | 2:1683e6a0002b | 176 | * |
hirokimineshita | 2:1683e6a0002b | 177 | * @bref do subtraction of two matrix like a-b |
hirokimineshita | 2:1683e6a0002b | 178 | * @param ans matrix of answer |
hirokimineshita | 2:1683e6a0002b | 179 | * @param arg_a matrix of what you want to minus |
hirokimineshita | 2:1683e6a0002b | 180 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 181 | * @param row numbers of elements of row |
hirokimineshita | 2:1683e6a0002b | 182 | * @param col numbers of elements of col |
hirokimineshita | 2:1683e6a0002b | 183 | */ |
hirokimineshita | 2:1683e6a0002b | 184 | void arg_minus(double *ans,double *arg_a,double *arg_b,int row,int col) |
hirokimineshita | 2:1683e6a0002b | 185 | { |
hirokimineshita | 2:1683e6a0002b | 186 | for(int i=0; i<row; i++){ |
hirokimineshita | 2:1683e6a0002b | 187 | for(int j=0; j<col; j++)ans[i*col+j] = arg_a[i*col+j]-arg_b[i*col+j]; |
hirokimineshita | 2:1683e6a0002b | 188 | } |
hirokimineshita | 2:1683e6a0002b | 189 | } |
hirokimineshita | 2:1683e6a0002b | 190 | |
hirokimineshita | 2:1683e6a0002b | 191 | /** (int)arg_multi : |
hirokimineshita | 2:1683e6a0002b | 192 | * |
hirokimineshita | 2:1683e6a0002b | 193 | * @bref do multiplication of two matrix like a*b |
hirokimineshita | 2:1683e6a0002b | 194 | * @param ans matrix of answer |
hirokimineshita | 2:1683e6a0002b | 195 | * @param arg_a matrix of what you want to minus |
hirokimineshita | 2:1683e6a0002b | 196 | * @param row_a numbers of elements of row of arg_a |
hirokimineshita | 2:1683e6a0002b | 197 | * @param col_b numbers of elements of col of arg_a |
hirokimineshita | 2:1683e6a0002b | 198 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 199 | * @param row_b numbers of elements of row of arg_b |
hirokimineshita | 2:1683e6a0002b | 200 | * @param col_b numbers of elements of col of arg_b |
hirokimineshita | 2:1683e6a0002b | 201 | * @retval 0 you can multiplication |
hirokimineshita | 2:1683e6a0002b | 202 | * @retval -1 you can't multiplication |
hirokimineshita | 2:1683e6a0002b | 203 | */ |
hirokimineshita | 2:1683e6a0002b | 204 | int arg_multi(int *ans,int *arg_a,int row_a,int col_a,int *arg_b,int row_b,int col_b) |
hirokimineshita | 2:1683e6a0002b | 205 | { |
hirokimineshita | 2:1683e6a0002b | 206 | if(col_a!=row_b)return -1; |
hirokimineshita | 2:1683e6a0002b | 207 | else{ |
hirokimineshita | 2:1683e6a0002b | 208 | for(int i=0; i<row_a; i++){ |
hirokimineshita | 2:1683e6a0002b | 209 | for(int j=0; j<col_b; j++){ |
hirokimineshita | 2:1683e6a0002b | 210 | ans[i*col_b+j]=0; |
hirokimineshita | 2:1683e6a0002b | 211 | for(int k=0; k<col_a; k++)ans[i*col_b+j]+=arg_a[i*col_a+k]*arg_b[j+col_b*k]; |
hirokimineshita | 2:1683e6a0002b | 212 | } |
hirokimineshita | 2:1683e6a0002b | 213 | } |
hirokimineshita | 2:1683e6a0002b | 214 | } |
hirokimineshita | 2:1683e6a0002b | 215 | return 0; |
hirokimineshita | 2:1683e6a0002b | 216 | } |
hirokimineshita | 2:1683e6a0002b | 217 | |
hirokimineshita | 2:1683e6a0002b | 218 | /** (float)arg_multi : |
hirokimineshita | 0:fe553d45f0b2 | 219 | * |
hirokimineshita | 0:fe553d45f0b2 | 220 | * @bref do multiplication of two matrix like a*b |
hirokimineshita | 0:fe553d45f0b2 | 221 | * @param ans matrix of answer |
hirokimineshita | 0:fe553d45f0b2 | 222 | * @param arg_a matrix of what you want to minus |
hirokimineshita | 0:fe553d45f0b2 | 223 | * @param row_a numbers of elements of row of arg_a |
hirokimineshita | 0:fe553d45f0b2 | 224 | * @param col_b numbers of elements of col of arg_a |
hirokimineshita | 0:fe553d45f0b2 | 225 | * @param arg_b (same as arg_a) |
hirokimineshita | 0:fe553d45f0b2 | 226 | * @param row_b numbers of elements of row of arg_b |
hirokimineshita | 0:fe553d45f0b2 | 227 | * @param col_b numbers of elements of col of arg_b |
hirokimineshita | 0:fe553d45f0b2 | 228 | * @retval 0 you can multiplication |
hirokimineshita | 0:fe553d45f0b2 | 229 | * @retval -1 you can't multiplication |
hirokimineshita | 0:fe553d45f0b2 | 230 | */ |
hirokimineshita | 0:fe553d45f0b2 | 231 | int arg_multi(float *ans,float *arg_a,int row_a,int col_a,float *arg_b,int row_b,int col_b) |
hirokimineshita | 0:fe553d45f0b2 | 232 | { |
hirokimineshita | 0:fe553d45f0b2 | 233 | if(col_a!=row_b)return -1; |
hirokimineshita | 0:fe553d45f0b2 | 234 | else{ |
hirokimineshita | 0:fe553d45f0b2 | 235 | for(int i=0; i<row_a; i++){ |
hirokimineshita | 0:fe553d45f0b2 | 236 | for(int j=0; j<col_b; j++){ |
hirokimineshita | 0:fe553d45f0b2 | 237 | ans[i*col_b+j]=0; |
hirokimineshita | 0:fe553d45f0b2 | 238 | for(int k=0; k<col_a; k++)ans[i*col_b+j]+=arg_a[i*col_a+k]*arg_b[j+col_b*k]; |
hirokimineshita | 0:fe553d45f0b2 | 239 | } |
hirokimineshita | 0:fe553d45f0b2 | 240 | } |
hirokimineshita | 0:fe553d45f0b2 | 241 | } |
hirokimineshita | 0:fe553d45f0b2 | 242 | return 0; |
hirokimineshita | 0:fe553d45f0b2 | 243 | } |
hirokimineshita | 0:fe553d45f0b2 | 244 | |
hirokimineshita | 2:1683e6a0002b | 245 | /** (double)arg_multi : |
hirokimineshita | 2:1683e6a0002b | 246 | * |
hirokimineshita | 2:1683e6a0002b | 247 | * @bref do multiplication of two matrix like a*b |
hirokimineshita | 2:1683e6a0002b | 248 | * @param ans matrix of answer |
hirokimineshita | 2:1683e6a0002b | 249 | * @param arg_a matrix of what you want to minus |
hirokimineshita | 2:1683e6a0002b | 250 | * @param row_a numbers of elements of row of arg_a |
hirokimineshita | 2:1683e6a0002b | 251 | * @param col_b numbers of elements of col of arg_a |
hirokimineshita | 2:1683e6a0002b | 252 | * @param arg_b (same as arg_a) |
hirokimineshita | 2:1683e6a0002b | 253 | * @param row_b numbers of elements of row of arg_b |
hirokimineshita | 2:1683e6a0002b | 254 | * @param col_b numbers of elements of col of arg_b |
hirokimineshita | 2:1683e6a0002b | 255 | * @retval 0 you can multiplication |
hirokimineshita | 2:1683e6a0002b | 256 | * @retval -1 you can't multiplication |
hirokimineshita | 2:1683e6a0002b | 257 | */ |
hirokimineshita | 2:1683e6a0002b | 258 | int arg_multi(double *ans,double *arg_a,int row_a,int col_a,double *arg_b,int row_b,int col_b) |
hirokimineshita | 2:1683e6a0002b | 259 | { |
hirokimineshita | 2:1683e6a0002b | 260 | if(col_a!=row_b)return -1; |
hirokimineshita | 2:1683e6a0002b | 261 | else{ |
hirokimineshita | 2:1683e6a0002b | 262 | for(int i=0; i<row_a; i++){ |
hirokimineshita | 2:1683e6a0002b | 263 | for(int j=0; j<col_b; j++){ |
hirokimineshita | 2:1683e6a0002b | 264 | ans[i*col_b+j]=0; |
hirokimineshita | 2:1683e6a0002b | 265 | for(int k=0; k<col_a; k++)ans[i*col_b+j]+=arg_a[i*col_a+k]*arg_b[j+col_b*k]; |
hirokimineshita | 2:1683e6a0002b | 266 | } |
hirokimineshita | 2:1683e6a0002b | 267 | } |
hirokimineshita | 2:1683e6a0002b | 268 | } |
hirokimineshita | 2:1683e6a0002b | 269 | return 0; |
hirokimineshita | 2:1683e6a0002b | 270 | } |
hirokimineshita | 2:1683e6a0002b | 271 | |
hirokimineshita | 0:fe553d45f0b2 | 272 | |
hirokimineshita | 0:fe553d45f0b2 | 273 | #endif |