MyraMath
laplacian2.h
Go to the documentation of this file.
1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
6 #ifndef MYRAMATH_SPARSE_LAPLACIAN2_H
7 #define MYRAMATH_SPARSE_LAPLACIAN2_H
8 
29 #include <myramath/utility/detail/LIBPUBLIC.h>
31 
32 #include <utility>
33 #include <vector>
34 
35 namespace myra {
36 
37 // Forward declarations.
38 class Pattern;
39 class Permutation;
40 template<class Number> class SparseMatrix;
41 
43 class LIBPUBLIC Natural2D
44  {
45 
46  public:
47 
49  Natural2D(int in_I, int in_J);
50 
52  std::vector<int> size() const;
53 
55  int operator() (int i, int j) const;
56 
58  std::pair<Natural2D, Natural2D> i_split() const;
59 
61  std::pair<Natural2D, Natural2D> j_split() const;
62 
63  private:
64 
65  // Full constructor used by splitting methods.
66  Natural2D(int in_I, int in_i_begin, int in_i_end, int in_J, int in_j_begin, int in_j_end);
67 
68  // Private data - total size (I/J) and begin/end specification of subwindow.
69  int I, i_begin, i_end;
70  int J, j_begin, j_end;
71  };
72 
74 LIBPUBLIC Pattern stencil2(int I, int J);
75 
77 template<class Number> SparseMatrix<Number> laplacian2 (int I, int J);
78 template<> LIBPUBLIC SparseMatrix<NumberS> laplacian2<NumberS>(int I, int J);
79 template<> LIBPUBLIC SparseMatrix<NumberD> laplacian2<NumberD>(int I, int J);
80 template<> LIBPUBLIC SparseMatrix<NumberC> laplacian2<NumberC>(int I, int J);
81 template<> LIBPUBLIC SparseMatrix<NumberZ> laplacian2<NumberZ>(int I, int J);
82 
84 LIBPUBLIC Permutation bisect2 (int I, int J);
85 
87 LIBPUBLIC Pattern stencil2_unsymmetric(int I, int J, double density = 0.5);
88 
89 } // namespace myra
90 
91 #endif
Represents a Permutation matrix, used to reorder rows/columns/etc of various numeric containers...
Definition: Permutation.h:34
Definition: syntax.dox:1
Various utility functions/classes related to scalar Number types.
Holds the nonzero pattern of a sparse matrix.
Definition: Pattern.h:55
A helper class that generates a natural ordering on a 2D structured grid of size IxJ.
Definition: laplacian2.h:43
Stores an IxJ matrix A in compressed sparse column format.
Definition: bothcat.h:23