[ create a new paste ] login | about

Link: http://codepad.org/D59ZuQYB    [ raw code | output | fork ]

C, pasted on Apr 5:
#include <stdlib.h>
#include <math.h>


main(void)
{
//First(Weights)
     float weights[6][16] = {
{0.6446 ,-0.0429 ,0.3335 ,2.1453 ,-0.4138 ,-0.0296 ,1.5447,-0.8560 ,0.3331 ,2.5709 ,-0.3338 ,-0.7728 ,0.6723,-1.3570,-1.1214,-1.9477},
{-1.9396,-0.7811 ,-1.6281 ,-3.1797 ,-1.4832 ,-0.7111 ,-0.8326 ,-0.9095 ,-1.1712 ,-1.9414 ,-1.3150 ,-2.2072 ,-2.0472 ,-1.5701 ,-2.2697 ,-1.2374},
{-8.1191,-0.2189 ,-5.8589 ,-1.8591 ,-9.3577 ,5.4080 ,-0.3060 ,-5.0676,-10.3375 ,8.6141 ,0.0224 ,-4.7077 ,-6.0208 ,1.1708 ,-5.7074 ,-2.7187},
{1.2224 ,1.2799 ,0.2989 ,1.9690 ,1.3680 ,0.7347 ,1.4483 ,1.3656 ,1.7153 ,1.6081 ,0.4722 ,-0.5118 ,2.5876 ,0.3123 ,0.1718 ,1.8092},
{-1.7414,-0.6238,-0.6486,-0.7508 ,-2.1770 ,-0.5455 ,-0.7970 ,-0.1595 ,-0.1899 ,-2.2912 ,0.1043 ,-1.2227 ,-1.6443 ,-1.4594 ,-0.5043 ,-1.3427},
{1.8925 ,7.0083 ,6.4832 ,7.8696 ,-5.2889 ,-4.9960 ,2.0700 ,1.0095 ,1.5075 ,-6.7171 ,-3.2165 ,-6.3554 ,1.7404 ,0.0769 ,1.9157 ,3.6587}
     };
int X[16]={1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1};
float next[16]={-2.7194,-3.2500,-1.7990,-0.8667,-2.1351,1.5000};


// apply a = 2/(1+exp(-2*n))-1 on dot product (n) between weights and input array = new array[]

  
      
//Apply Second(Weights)

 
//int
//main(void)
//{
//        int a[3] = {1, 3, -5};
//        int b[3] = {4, -2, -1};
// 
//        printf("%d\n", dot_product(a, b, sizeof(a) / sizeof(a[0])));
// 
//        return EXIT_SUCCESS;
//}

float dot_product(double *, double *, size_t); 

float 
dot_product(double * weights[6][16], double * X[16], size_t n)
{
        float Net[6]={0,0,0,0,0,0};
        size_t i;
 
        for (i = 1; i < 16; i++) {
             Net[1] += weights[1][i] * X[i];
             Net[2] += weights[2][i] * X[i];
             Net[3] += weights[3][i] * X[i];
             Net[4] += weights[4][i] * X[i];
             Net[5] += weights[5][i] * X[i];
             Net[6] += weights[6][i] * X[i];
        }
        return Net[6];

}
// apply b = n to dot product between weights and new array = final array[]





//loop to determine and print output square(1), horizontal sides (2), verticle sides (3), leftdiagnonal (4), right diagnonal (5) x-shape(6), smallright diagonal (7) random (8)       

}

//int dot_product(int *, int *, size_t);
 
//int
//main(void)
//{
//        int a[3] = {1, 3, -5};
//        int b[3] = {4, -2, -1};
 
//        printf("%d\n", dot_product(a, b, sizeof(a) / sizeof(a[0])));
 
//        return EXIT_SUCCESS;
//}
 
//int
//dot_product(int *a, int *b, size_t n)
//{
//        int sum = 0;
//        size_t i;
 
//        for (i = 0; i < n; i++) {
//                sum += a[i] * b[i];
//        }
// 
//        return sum;
//}

//	}
//}


Output:
1
2
3
4
5
6
7
8
9
10
In function 'main':
Line 42: error: conflicting types for 'dot_product'
Line 38: error: previous declaration of 'dot_product' was here
In function 'dot_product':
Line 47: error: invalid operands to binary *
Line 48: error: invalid operands to binary *
Line 49: error: invalid operands to binary *
Line 50: error: invalid operands to binary *
Line 51: error: invalid operands to binary *
Line 52: error: invalid operands to binary *


Create a new paste based on this one


Comments: