검색어 입력폼

# 최적화 행렬 곱셈, Strassen’s algorithm, 스트라슨 알고리즘

등록일 2004.09.21 압축파일 (zip) | 가격 1,000원

## 소개글

최적화 행렬 곱셈 알고리즘 스트라슨의 방법을 C로 구현해 보았습니다..

## 컴파일 실행환경

Visual C,
multiply2mat.c, input.txt, output.txt
그냥 실행후에 output.txt를 점검하세요

## 본문내용

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <conio.h>

#define randomize() srand((unsigned) time(NULL))
#define random(num) (rand()%(num));

//#define BLOCK_SIZE 3 // Block size : 2^n
#define STRASS_SIZE 2
#define CMAJOR(A, L, i, j) (*(A + i + j*L))
#define RMAJOR(A, L, i, j) (*(A + i*L + j))

#define MAX(a, b) (a>b? a: b)
#define MAX3(a, b, c) (a>b? MAX(a, c): MAX(b, c))
#define MIN(a, b) (a<b? a: b)
#define MIN3(a, b, c) (a<b? MIN(a, c): MIN(b, c))

#define DIGIT_SIZE 20

#define FALSE 0
#define TRUE 1

FILE *fin, *fout;
double* allocMatrix (int msize);

////////////////////////////////////////////////////////
// To clear the matrix with "zero"

void matrixClear (double *M, int msize)
{
memset (M, 0, msize * sizeof (double));
}

////////////////////////////////////////////////////////
// To add two matrices

double* matrixAdd (const int lda, const int ldb, const int ldc, double *A, double *B, int row, int col)
{
int i,j;
double *C=allocMatrix (row*col);
for (i=0; i<row; i++)
for (j=0; j<col; j++)
RMAJOR(C, ldc, i, j) = RMAJOR(A, lda, i, j) + RMAJOR(B, ldb, i, j);
return C;
}

aa.txt
goutput.txt
input.txt
multiply2mat.c
multiply2mat.dsp
multiply2mat.dsw
multiply2mat.ncb
multiply2mat.opt
multiply2mat.plg
output.txt
output16.txt
output8.txt
strassen.c
temp.h
temp2.h

없음