Changeset 596


Ignore:
Timestamp:
Nov 19, 2004, 11:06:14 AM (20 years ago)
Author:
steve
Message:
 
Location:
inundation/ga/storm_surge/pyvolution
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/sparse_ext.c

    r594 r596  
    1313#include "Numeric/arrayobject.h"
    1414#include "math.h"
     15#include "stdio.h"
    1516
    1617int _csr_mv(int M,
     
    2324  long i, j, ckey;
    2425
     26  printf("test");
    2527  for (i=0; i<M; i++ )
    2628    for (ckey=row_ptr[i]; ckey<row_ptr[i+1]; ckey++) {
     
    2931    }             
    3032 
     33  printf("end");
    3134  return 0;
    3235}           
     
    5255   
    5356  int dimensions[1], M, err;
     57  int xdim, i;
    5458 
    5559  // Convert Python arguments to C 
     
    8993 
    9094  M = (row_ptr -> dimensions[0])-1;
     95
     96
     97  printf(" x.dim[0] = %i  x.dim[1] = %i \n", x -> dimensions[0], x -> dimensions[1]);
    9198   
    9299  //Allocate space for return vectors y (don't DECREF)
     
    94101  y = (PyArrayObject *) PyArray_FromDims(1, dimensions, PyArray_DOUBLE);
    95102 
     103  for (i=0;i<25;i++){
     104    printf(" data[%i]=%i\n",i,(data->data)[i]);
     105  }
     106
     107  for (i=0;i<25;i++){
     108    printf(" colind[%i]=%i\n",i,(colind->data)[i]);
     109  }
    96110  err = _csr_mv(M,
    97111                (double*) data -> data,
     
    99113                (long*)    row_ptr -> data,
    100114                (double*) x -> data,
    101                 (double*) y -> data);     
     115                (double*) y -> data);
     116
     117  for (i=0;i<25;i++){
     118    printf(" data[%i]=%i\n",i,data->data[i]);
     119  }
    102120                           
    103121  if (err != 0) {
  • inundation/ga/storm_surge/pyvolution/test_cg_solve.py

    r594 r596  
    7979
    8080    def test_solve_large_2d_csr_matrix(self):
    81         """Standard 2d laplacian"""
     81        """Standard 2d laplacian with csr format
     82        """
    8283       
    8384        n = 100
     
    102103
    103104        # Convert to csr format
    104         #print 'start covert'
     105        print 'start covert'
    105106        A = Sparse_CSR(A)
    106         #print 'finish covert'
     107        print 'finish covert'
    107108        b = A*xe
    108109        x = conjugate_gradient(A,b,b,iprint=20)
  • inundation/ga/storm_surge/pyvolution/test_sparse.py

    r586 r596  
    150150
    151151    def test_sparse_addition(self):
     152        """ Test sparse addition with dok format
     153        """
    152154       
    153155        A = Sparse(3,3)
     
    167169
    168170    def test_sparse_tocsr(self):
    169 
     171        """ Test conversion to csr format
     172        """
     173       
    170174        A = Sparse(4,3)
    171175
Note: See TracChangeset for help on using the changeset viewer.