Code Search for Developers
 
 
  

dense.c from Oscill8 at Krugle


Show dense.c syntax highlighted

/*
 * -----------------------------------------------------------------
 * $Revision: 1.1 $
 * $Date: 2005/05/02 03:39:30 $
 * -----------------------------------------------------------------
 * Programmer(s): Scott D. Cohen, Alan C. Hindmarsh and
 *                Radu Serban @ LLNL
 * -----------------------------------------------------------------
 * Copyright (c) 2002, The Regents of the University of California.
 * Produced at the Lawrence Livermore National Laboratory.
 * All rights reserved.
 * For details, see sundials/shared/LICENSE.
 * -----------------------------------------------------------------
 * This is the implementation file for a generic DENSE linear
 * solver package.
 * -----------------------------------------------------------------
 */ 

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

#include "dense.h"
#include "smalldense.h"
#include "sundialsmath.h"
#include "sundialstypes.h"

#define ZERO RCONST(0.0)
#define ONE  RCONST(1.0)

/* Implementation */

DenseMat DenseAllocMat(long int N)
{
  DenseMat A;

  if (N <= 0) return(NULL);

  A = (DenseMat) malloc(sizeof *A);
  if (A==NULL) return (NULL);
  
  A->data = denalloc(N);
  if (A->data == NULL) {
    free(A);
    return(NULL);
  }

  A->size = N;

  return(A);
}

long int *DenseAllocPiv(long int N)
{
  if (N <= 0) return(NULL);

  return((long int *) malloc(N * sizeof(long int)));
}

long int DenseFactor(DenseMat A, long int *p)
{
  return(gefa(A->data, A->size, p));
}

void DenseBacksolve(DenseMat A, long int *p, realtype *b)
{
  gesl(A->data, A->size, p, b);
}

void DenseZero(DenseMat A)
{
  denzero(A->data, A->size);
}

void DenseCopy(DenseMat A, DenseMat B)
{
  dencopy(A->data, B->data, A->size);
}

void DenseScale(realtype c, DenseMat A)
{
  denscale(c, A->data, A->size);
}

void DenseAddI(DenseMat A)
{
  denaddI(A->data, A->size);
}

void DenseFreeMat(DenseMat A)
{
  denfree(A->data);
  free(A);
}

void DenseFreePiv(long int *p)
{  
  free(p);
}

void DensePrint(DenseMat A)
{
  denprint(A->data, A->size);
}




See more files for this project here

Oscill8

Oscill8 is a suite of tools for analyzing dynamical systems which concentrates on understanding how the dynamical behavior depends on the parameters using bifurcation theory and reaction network theory.

Project homepage: http://sourceforge.net/projects/oscill8
Programming language(s): C,C#,C++
License: other

  ReadMe.txt
  band.c
  band.h
  cvband.c
  cvband.h
  cvband_impl.h
  cvbandpre.c
  cvbandpre.h
  cvbandpre_impl.h
  cvbbdpre.c
  cvbbdpre.h
  cvbbdpre_impl.h
  cvdense.c
  cvdense.h
  cvdense_impl.h
  cvdiag.c
  cvdiag.h
  cvdiag_impl.h
  cvodea.c
  cvodea.h
  cvodea_impl.h
  cvodes.c
  cvodes.h
  cvodes.vcproj
  cvodes_impl.h
  cvodesio.c
  cvspgmr.c
  cvspgmr.h
  cvspgmr_impl.h
  dense.c
  dense.h
  iterative.c
  iterative.h
  nvector.c
  nvector.h
  nvector_serial.c
  nvector_serial.h
  smalldense.c
  smalldense.h
  spgmr.c
  spgmr.h
  sundials_config.h
  sundialsmath.c
  sundialsmath.h
  sundialstypes.h