mirror of
https://github.com/Relintai/pmlpp.git
synced 2025-01-02 16:29:35 +01:00
Added a static create helper for Matrix.
This commit is contained in:
parent
d39291c849
commit
9993bc9d4e
@ -1999,6 +1999,21 @@ Ref<MLPPMatrix> MLPPMatrix::identity_mat(int d) const {
|
|||||||
return identity_mat;
|
return identity_mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ref<MLPPMatrix> MLPPMatrix::create_identity_mat(int d) {
|
||||||
|
Ref<MLPPMatrix> identity_mat;
|
||||||
|
identity_mat.instance();
|
||||||
|
identity_mat->resize(Size2i(d, d));
|
||||||
|
identity_mat->fill(0);
|
||||||
|
|
||||||
|
real_t *im_ptr = identity_mat->ptrw();
|
||||||
|
|
||||||
|
for (int i = 0; i < d; i++) {
|
||||||
|
im_ptr[identity_mat->calculate_index(i, i)] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return identity_mat;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<MLPPMatrix> MLPPMatrix::cov() const {
|
Ref<MLPPMatrix> MLPPMatrix::cov() const {
|
||||||
MLPPStat stat;
|
MLPPStat stat;
|
||||||
|
|
||||||
|
@ -248,6 +248,8 @@ public:
|
|||||||
Ref<MLPPMatrix> identityn() const;
|
Ref<MLPPMatrix> identityn() const;
|
||||||
Ref<MLPPMatrix> identity_mat(int d) const;
|
Ref<MLPPMatrix> identity_mat(int d) const;
|
||||||
|
|
||||||
|
static Ref<MLPPMatrix> create_identity_mat(int d);
|
||||||
|
|
||||||
Ref<MLPPMatrix> cov() const;
|
Ref<MLPPMatrix> cov() const;
|
||||||
void covo(Ref<MLPPMatrix> out) const;
|
void covo(Ref<MLPPMatrix> out) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user