동적 할당을 이용한 LU분해법 c프로그래밍
- 최초 등록일
- 2015.04.29
- 최종 저작일
- 2015.04
- 5페이지/ 한컴오피스
- 가격 3,000원
목차
없음
본문내용
#include <stdio.h> #include <stdlib.h>#include <math.h>#pragma warning(disable:4996)
void LU_div(float **matrix, float **L, float **U, float **ans, int n, int k);void printout(int n, float **matrix);int main(void){int i, n;//input number of nxn matrix int k = 0; int x, y;//line x,row y float **matrix; //define matrix[x][y] float **L; //matrix to save L float **U; //matrix to save U float **ans; //matrix for answer printf("NxN matrix enter the size of N.\n"); scanf("%d", &n);matrix = malloc(sizeof(float *) * n); // int* number x primary structure if (matrix == NULL){ printf("malloc failed\n"); exit(1); } for (i = 0; i < n; i++){ matrix[i] = malloc(sizeof(float) * n); if (matrix[i] == NULL){ printf("malloc failed\n"); exit(1); }} //build matrix[x][y(size of x)] structure L = malloc(sizeof(float *) * n); // int* number x primary structure if (L == NULL){ printf("malloc failed\n"); exit(1); } for (i = 0; i
참고 자료
없음