13 void OK() const { dat
->OK(); }
14 int cols() const { return dat
->cols(); }
15 int rows() const { return dat
->rows(); }
17 /// return the size of a matrix
21 the matrix needs to be square.
24 // Matrix() { dat = 0; }
25 ~Matrix() { delete dat
; }
31 void set_diag(Real d
);
33 void set_diag(Vector d
);
35 void unit() { set_diag(1.0); }
37 void operator+=(const Matrix
&m
);
38 void operator-=(const Matrix
&m
);
39 void operator*=(Real a
);
40 void operator/=(Real a
) { (*this) *= 1/a
; }
43 void insert_row(Vector v
,int k
);
45 add a row to the matrix before row k
52 void delete_row(int k
) { dat
->delete_row(k
); }
54 delete a row from this matrix.
59 void delete_column(int k
) { dat
->delete_column(k
); }
63 square n matrix, initialised to null
68 n x m matrix, init to 0
70 Matrix(const Matrix
&m
);
72 /// dyadic product: v * w.transpose
73 Matrix(Vector v
, Vector w
);
74 void operator=(const Matrix
&m
);
77 Real
operator()(int i
,int j
) const;
80 Real
&operator()(int i
, int j
);
82 /// Matrix multiply with vec (from right)
83 Vector
operator *(const Vector
&v
) const;
85 /// set this to m1*m2.
86 void set_product(const Matrix
&m1
, const Matrix
&m2
);
89 Vector
left_multiply(Vector
const &) const;
91 Matrix
operator-() const;
96 /// return a transposed copy.
97 Matrix
transposed() const ;
101 void swap_columns(int c1
, int c2
);
108 void swap_rows(int c1
, int c2
);
115 Vector
row(int ) const;
116 Vector
col(int) const;
118 operator String() const;
122 /** This is a class for a nonsquare block of #Real#s. The
123 implementation of sparse matrices is done in the appropriate #smat#
124 class. Matrix only does the mathematical actions (adding,
129 implement ref counting? */
133 operator *(Vector
&v
, const Matrix
& m
) { return m
.left_multiply(v
); }
134 Matrix
operator *(const Matrix
& m1
,const Matrix
&m2
);
135 Matrix
operator /(const Matrix
&m1
,Real a
);
136 inline Matrix
operator -(Matrix m1
,const Matrix m2
)