Sparse-C.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2004-2012 David Bateman
00004 Copyright (C) 1998-2004 Andy Adler
00005 
00006 This file is part of Octave.
00007 
00008 Octave is free software; you can redistribute it and/or modify it
00009 under the terms of the GNU General Public License as published by the
00010 Free Software Foundation; either version 3 of the License, or (at your
00011 option) any later version.
00012 
00013 Octave is distributed in the hope that it will be useful, but WITHOUT
00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00016 for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with Octave; see the file COPYING.  If not, see
00020 <http://www.gnu.org/licenses/>.
00021 
00022 */
00023 
00024 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027 
00028 // Instantiate Sparse matrix of complex values.
00029 
00030 #include "oct-cmplx.h"
00031 #include "lo-mappers.h"
00032 #include "lo-ieee.h"
00033 #include "Sparse.h"
00034 #include "Sparse.cc"
00035 
00036 
00037 static double
00038 xabs (const Complex& x)
00039 {
00040   return (xisinf (x.real ()) || xisinf (x.imag ())) ? octave_Inf : abs (x);
00041 }
00042 
00043 
00044 template <>
00045 bool
00046 sparse_ascending_compare<Complex> (const Complex& a, const Complex& b)
00047 {
00048   return (xisnan (b) || (xabs (a) < xabs (b))
00049           || ((xabs (a) == xabs (b)) && (arg (a) < arg (b))));
00050 }
00051 
00052 template <>
00053 bool
00054 sparse_descending_compare<Complex> (const Complex& a, const Complex& b)
00055 {
00056   return (xisnan (a) || (xabs (a) > xabs (b))
00057           || ((xabs (a) == xabs (b)) && (arg (a) > arg (b))));
00058 }
00059 
00060 INSTANTIATE_SPARSE (Complex, OCTAVE_API);
00061 
00062 #if 0
00063 template std::ostream& operator << (std::ostream&, const Sparse<Complex>&);
00064 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines