1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/* Copyright (C) 2016 - IIT Bombay - FOSSEE
This file must be used under the terms of the CeCILL.
This source file is licensed as described in the file COPYING, which
you should have received as part of this distribution. The terms
are also available at
http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
Author: Abhinav Dronamraju
Organization: FOSSEE, IIT Bombay
Email: toolbox@scilab.in
*/
#include "hank.h"
#include "types.h"
#include "ones.h"
#include "kron.h"
#include "addition.h"
#include "matrix.h"
void shanka(int m, int n, float*seq_conv, int row, int col, float*out)
{
int mr, nr;
mr= m* row;
nr= n* row;
float ones1[1*nr];
float ones2[m*1];
float temp1[mr*1];
float temp2[1*nr];
float middle1[m*nr];
float middle2[m*nr];
float index[m*nr];
float final[row*m*nr];
sonesa(ones1, 1 , nr);
sonesa(ones2, m , 1);
int j=0;
for(int i=1; i< mr+1; i= i+row)
{
temp1[j]=i;
j++;
//printf("%d", i);
}
for(int j=0;j< nr; j++)
temp2[j]=j;
skrona(ones1, 1 , nr, temp1, m , 1 , middle1);
skrona(temp2, 1 , nr, ones2, m , 1 , middle2);
sadda(middle1, m*nr, middle2, m*nr, index);
for(int i=0; i< m*nr; i++)
{
for(int j=0; j<row; j++)
{
int rank=index[i];
final[(i*row)+j]= seq_conv[ j+(rank-1)*row];
}
}
/*
printf("ones1\n");
for(int k=0; k<1*nr; k++)
printf("%f\t", ones1[k]);
printf("\n");
printf("ones2\n");
for(int k=0; k<m*1; k++)
printf("%f\t", ones2[k]);
printf("\n");
printf("temp1\n");
for(int k=0; k<m*1; k++)
printf("%f\t", temp1[k]);
printf("\n");
printf("temp2\n");
for(int k=0; k<nr*1; k++)
printf("%f\t", temp2[k]);
printf("\n");
printf("middle1\n");
for(int k=0; k<m*nr; k++)
printf("%f\t", middle1[k]);
printf("\n");
printf("middle2\n");
for(int k=0; k<m*nr; k++)
printf("%f\t", middle2[k]);
printf("\n");
printf("index\n");
for(int k=0; k<m*nr; k++)
printf("%f\t", index[k]);
printf("\n");
printf("final\n");
for(int k=0; k<row*m*nr; k++)
printf("%f\t", final[k]);
printf("\n");
*/
smatrixa(final, row, m*nr, mr, (row*m*nr)/mr, out);
}
|