File: matops_c.h

package info (click to toggle)
r-cran-rspectra 0.16-0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 736 kB
  • sloc: cpp: 4,917; ansic: 256; makefile: 2
file content (61 lines) | stat: -rw-r--r-- 1,367 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef MATOPS_C_H
#define MATOPS_C_H

#include <SpectraC.h>

class CMatProd: public MatProd
{
private:
    mat_op    op;
    const int n;
    void*     data;
public:
    CMatProd(mat_op op_, int n_, void *data_) :
        op(op_),
        n(n_),
        data(data_)
    {}
    int rows() const { return n; }
    int cols() const { return n; }
    void perform_op(const double* x_in, double* y_out) { op(x_in, y_out, n, data); }
    void perform_tprod(const double* x_in, double* y_out) {}
};

class CRealShift: public RealShift
{
private:
    mat_op    op;
    const int n;
    void*     data;
public:
    CRealShift(mat_op op_, int n_, void *data_) :
        op(op_),
        n(n_),
        data(data_)
    {}
    int rows() const { return n; }
    int cols() const { return n; }
    void set_shift(double sigma) {}
    void perform_op(const double* x_in, double* y_out) { op(x_in, y_out, n, data); }
};

class CComplexShift: public ComplexShift
{
private:
    mat_op    op;
    const int n;
    void*     data;
public:
    CComplexShift(mat_op op_, int n_, void *data_) :
        op(op_),
        n(n_),
        data(data_)
    {}
    int rows() const { return n; }
    int cols() const { return n; }
    void set_shift(double sigmar, double sigmai) {}
    void perform_op(const double* x_in, double* y_out) { op(x_in, y_out, n, data); }
};


#endif // MATOPS_C_H