이전 질문 게시판은 새 글 쓰기를 막았습니다. [질문 게시판]을 이용바랍니다.
Date |
2010/06/27 15:46:55 |
Name |
Ibiza |
Subject |
C언어로 행렬의 Determinant를 구하는 알고리듬 하나 질문드립니다. |
안녕하세요!
뒤늦게 C언어를 배우고 있는 유학생입니다.
문제는 다음과 같습니다.
The minor of an element a_i,j(a_i,j stards for a sub i and j) of a matrix A is the determinant of the matrix obtained by removing the row and column to which the given element a_i,j belongs. Thus, if the original matrix has four rows and columns, the minor is the determinant of a matrix with three rows and columns. Write a function to compute the minor of a square matrix with four rows and four columns. The input arguments should be the matrix A and the values of i and j.
Assume that the corresponding function prototype is
(행렬 A의 성분 Aij의 마이너는 그 성분 Aij가 속하는 행과 열을 제거한 행렬의 디터미넌트이다. 만약 본래의 행렬이 4 x 4의 형태라면 마이너는 3x3행렬의 디터미넌트이다.. 행렬 A와 i,j에 해당하는 값을 입력할수 있는 4x4행렬의 마이너를 계산하는 함수를 작성하여라. 함수원형은 다음과 같다고 가정하여라.)
double minor( double a[4][4], int i, int j);
이상이구요.
제가 맨처음 생각한 알고리듬은 if statement를 사용하여 i,j 의 값을 가정한다음에 그에 대응하는 determinant를 계산하는 거였는데
하다보니 이 풀이는 가독성에서나 길이로 볼때 옳은 풀이가 아니라는 생각이 들더라구요.
좀더 체계적인 방법(알고리듬)이 없을까요?
피지알 능력자 분들 도와주세요!
|
통합규정 1.3 이용안내 인용
"Pgr은 '명문화된 삭제규정'이 반드시 필요하지 않은 분을 환영합니다.
법 없이도 사는 사람, 남에게 상처를 주지 않으면서 같이 이야기 나눌 수 있는 분이면 좋겠습니다."
|