/* * main */ void main(void) { char in[80]; zerom(in, 0); while(1) { zerom(in, 0); puts("Input a number"); gets(in); if(atof(in)==0) break; chopandspit(in); } }
/* * Test 1 * */ void provaCalcS(){ printf("halloo, probando probando!!\n"); vector pc = zerov(2); vector pcPrimes = zerov(2); matrix S = zerom(2, 3); pc.v[0] = 50; pc.v[1] = 200; //Test in matlab //S = [ 0 0.0003495 0.002; 0.0018 0.0338 0.0207]; S.m[0][0] = 0; S.m[0][1] = 0.0003495; S.m[0][2] = 0.002; S.m[1][0] = 0.0018; S.m[1][1] = 0.0338; S.m[1][2] = 0.0207; int numPrimes = (int)(pc.v[pc.x - 1] / pc.v[0]); intvector numsPrimesReason = primes(numPrimes); int i, j; for(i = 0; i < numsPrimesReason.x; ++i){ printf("i: %d\n", numsPrimesReason.v[i]); int primeNum = numsPrimesReason.v[i]; for(j = 0; j < pcPrimes.x; ++j){ pcPrimes.v[j] = pc.v[j] * primeNum; } printf("\nArray pcPrimes:\n"); printv(pcPrimes); matrix SnInterp = interp1Mat(pc, pcPrimes, S, 0); printf("\nResult S\n"); printm(SnInterp); } }