02 2013 档案
摘要:测试平台:VS2008新建工程-添加源文件和头文件main函数#include<iostream>#include"callumfpack.h"using namespace std;//int print(int **A)int main(){ //int A[2][2]={0}; //printf("%d ",A[1][1]); /*int **A=new int *[2]; for(int i=0;i<2;i++) A[i]=new int [2]; for(int i=0;i<2;i++) for(int j=0;j<
阅读全文
摘要:int main(){ int n=3;int m=3; int **A=new int *[n]; for(int i=0;i<n;i++) A[i]=new int [m];//动态生成矩阵A com( A ); //调用函数com return 0;}int com(int **A){ printf("%d\n",A[2][2]);return 0;} 通过上面几条核心代码实现二维数组的传递
阅读全文
摘要:在之前版本 改写UMFPACK算例中的压缩方式(动态) 中Ai Ax采用的是vector类型,现在修改为int和double,牺牲内存空间View Code //Data:2013-2-24//修改了Ai Ax的类型 利用最大维数n*n来保存,可以调用正确结果 不过不知系统随机分配的值 函数没有用#include <stdio.h>#include <math.h>#include "umfpack.h"#pragma comment(lib,"../lib/libamd.lib")#pragma comment(lib,&quo
阅读全文
摘要:在上篇博文基础上修改,使之A能动态View Code /* -------------------------------------------------------------------------- *//* UMFPACK Copyright (c) Timothy A. Davis, CISE, *//* Univ. of Florida. All Rights Reserved. See ../Doc/License for License. *//* web: http://www.cise.ufl.edu/r...
阅读全文
摘要:在UMFPACK的官方文档 UMFPACK Version 5.2.0 User Guide中的5.3节中的例子稀疏矩阵A和右端向量b 为 A=[2 3 0 0 0;3 0 4 0 6 ;0 -1 -3 2 0;0 0 1 0 0;0 4 2 0 1]b=[8.,45.,-3.,3.,19.] 其解为x=[1 2 3 4 5]'这个算例的源代码为View Code 1 #include <stdio.h> 2 #include "umfpack.h" 3 int n = 5 ; 4 int Ap [ ] = {0, 2, 5, 9, 10, ...
阅读全文
摘要:采用压缩稀疏行格式(CSR)存储核心代码段1 for (i=0; i<M; i++) 2 { 3 t = 0.0; 4 for (j=row_start[i]; j<row_start[i+1]; j++) { 5 t += val[j] * x[col_idx[j]]; 6 } 7 y[i]=t; //y[i]存储积的第i行8 }
阅读全文