Amesos2 - Direct Sparse Solver Interfaces Version of the Day
basker_types.hpp
1// @HEADER
2// ***********************************************************************
3//
4// Basker: A Direct Linear Solver package
5// Copyright 2011 Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, with Sandia Corporation, the
8// U.S. Government retains certain rights in this software.
9//
10// This library is free software; you can redistribute it and/or modify
11// it under the terms of the GNU Lesser General Public License as
12// published by the Free Software Foundation; either version 2.1 of the
13// License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23// USA
24// Questions? Contact Mike A. Heroux (maherou@sandia.gov)
25//
26// ***********************************************************************
27// @HEADER
28
29
30#ifndef BASKER_TYPES_HPP
31#define BASKER_TYPES_HPP
32
33#ifdef MATLAB_MEX_FILE
34#include "matrix.h"
35#include "mex.h"
36
37#define BASKERASSERT(a) mxAssert(a,"")
38#define BASKERREALLOC(ptr,size) mxRealloc(ptr, size)
39#define BASKERCALLOC(num, size) mxCalloc(num, size)
40#define BASKERFREE(ptr)
41
42#else
43#include <cassert>
44#include <cstdlib>
45
46#define BASKERASSERT(a) assert(a)
47#define BASKERREALLOC(ptr, size) realloc(ptr, size)
48#define BASKERCALLOC(num, size) calloc(num,size)
49#define BASKERFREE(ptr) free(ptr)
50
51#endif
52
53
54
55template <class Int, class Entry>
56struct basker_matrix
57{
58 Int nrow, ncol, nnz;
59 Int *col_ptr, *row_idx;
60 Entry *val;
61
62};
63
64#endif