Exemple #1
0
matrix calc_V(int l, double R)
{
  int N = get_numer_of_zeroes(l);
  matrix V = null_matrix(N, N);
  int i, j;
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      MatrixSET(V, i, j, integrate_V(l, i, j, R));
  return V;
}
Exemple #2
0
matrix calc_T(int l, double M, double R)
{
  double hbarc = 197.3 * pow(10,-9);

  int i,
      N = get_numer_of_zeroes(l);
  matrix T = null_matrix(N, N);
  for (i = 0; i < N; i++)
    MatrixSET(T, i, i, pow(hbarc,2) / (2 * M) * pow(get_kjl(i,l,R),2));

  return T;
}
Exemple #3
0
void matrix_init(matrix_t *p1, matrix_t *p2, matrix_t *p3,
		 matrix_t *p4, matrix_t *p5, matrix_t *p6,
		 matrix_t *p7, int len)
{
    null_matrix(p1, len);
    null_matrix(p2, len);
    null_matrix(p3, len);
    null_matrix(p4, len);
    null_matrix(p5, len);
    null_matrix(p6, len);
    null_matrix(p7, len);
}
Exemple #4
0
matrix a2_matrix(int N)
{
  matrix m = null_matrix(N, N);
  int i, j;
  for (i = 0; i < N; i++)
  {
    for (j = 0; j < N; j++)
    {
      double v = ((double) N) / ((double) (i+1)+(j+1)) + (i+1) + (j+1);
      MatrixSET(m, i, j, v);
    }
  }
  return m;
}
Exemple #5
0
int main()
{
    matrix_t mat_a, mat_b;
    matrix_t mat_c;
    struct timeval start_time, end_time;
    random_matrix(&mat_a, 4);
    random_matrix(&mat_b, 4);
    null_matrix(&mat_c, 4);
    print_matrix(mat_a);
    printf("\n");
    print_matrix(mat_b);
    printf("\n");
    print_matrix(mat_c);
    gettimeofday(&start_time, 0);
    matrix_multiplication(mat_a, mat_b, mat_c);
    gettimeofday(&end_time, 0);
    printf("Normal Multiplication\n");
    print_matrix(mat_c);
    print_time_taken(start_time, end_time);
    mat_c = set_zero(mat_c);
    mat_c = matrix_multiplication_strassen(mat_a, mat_b, mat_c, 2);
    printf("Strassen Multiplication\n");
    print_matrix(mat_c);
}