mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-11-08 13:12:09 +01:00
MLPPMatrix math api rework pt4.
This commit is contained in:
parent
de8c7b2868
commit
991fb93ece
@ -609,24 +609,50 @@ void MLPPMatrix::scalar_addb(const real_t scalar, const Ref<MLPPMatrix> &A) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<MLPPMatrix> MLPPMatrix::lognm(const Ref<MLPPMatrix> &A) {
|
||||
ERR_FAIL_COND_V(!A.is_valid(), Ref<MLPPVector>());
|
||||
void MLPPMatrix::log() {
|
||||
int ds = data_size();
|
||||
|
||||
real_t *out_ptr = ptrw();
|
||||
|
||||
for (int i = 0; i < ds; ++i) {
|
||||
out_ptr[i] = Math::log(out_ptr[i]);
|
||||
}
|
||||
}
|
||||
Ref<MLPPMatrix> MLPPMatrix::logn() {
|
||||
Ref<MLPPMatrix> out;
|
||||
out.instance();
|
||||
out->resize(size());
|
||||
|
||||
int data_size = A->data_size();
|
||||
out->resize(A->size());
|
||||
int ds = data_size();
|
||||
|
||||
const real_t *a_ptr = A->ptr();
|
||||
const real_t *a_ptr = ptr();
|
||||
real_t *out_ptr = out->ptrw();
|
||||
|
||||
for (int i = 0; i < data_size; ++i) {
|
||||
for (int i = 0; i < ds; ++i) {
|
||||
out_ptr[i] = Math::log(a_ptr[i]);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
void MLPPMatrix::logb(const Ref<MLPPMatrix> &A) {
|
||||
ERR_FAIL_COND(!A.is_valid());
|
||||
|
||||
Size2i a_size = A->size();
|
||||
|
||||
if (a_size != size()) {
|
||||
resize(a_size);
|
||||
}
|
||||
|
||||
int ds = data_size();
|
||||
|
||||
const real_t *a_ptr = A->ptr();
|
||||
real_t *out_ptr = ptrw();
|
||||
|
||||
for (int i = 0; i < ds; ++i) {
|
||||
out_ptr[i] = Math::log(a_ptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Ref<MLPPMatrix> MLPPMatrix::log10nm(const Ref<MLPPMatrix> &A) {
|
||||
ERR_FAIL_COND_V(!A.is_valid(), Ref<MLPPVector>());
|
||||
|
||||
|
@ -625,7 +625,10 @@ public:
|
||||
Ref<MLPPMatrix> scalar_addn(const real_t scalar) const;
|
||||
void scalar_addb(const real_t scalar, const Ref<MLPPMatrix> &A);
|
||||
|
||||
Ref<MLPPMatrix> lognm(const Ref<MLPPMatrix> &A);
|
||||
void log();
|
||||
Ref<MLPPMatrix> logn();
|
||||
void logb(const Ref<MLPPMatrix> &A);
|
||||
|
||||
Ref<MLPPMatrix> log10nm(const Ref<MLPPMatrix> &A);
|
||||
Ref<MLPPMatrix> expnm(const Ref<MLPPMatrix> &A);
|
||||
Ref<MLPPMatrix> erfnm(const Ref<MLPPMatrix> &A);
|
||||
|
Loading…
Reference in New Issue
Block a user