Something went wrong on our end
Select Git revision
-
Nick Kralevich authored
See https://groups.google.com/d/msg/android-ndk/BbEOA9pnR-I/HgLkGy5qAgAJ Addresses the following denial: avc: denied { lock } for path="/data/data/com.mypackage/files/somefilename" dev="mmcblk0p28" ino=114736 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 While I'm here, also add lock to w_file_perms. Change-Id: I2568a228099c4e112e4a8b80da3bfcf2e35eb0ea
Nick Kralevich authoredSee https://groups.google.com/d/msg/android-ndk/BbEOA9pnR-I/HgLkGy5qAgAJ Addresses the following denial: avc: denied { lock } for path="/data/data/com.mypackage/files/somefilename" dev="mmcblk0p28" ino=114736 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0 While I'm here, also add lock to w_file_perms. Change-Id: I2568a228099c4e112e4a8b80da3bfcf2e35eb0ea
matrix.h 1.43 KiB
#ifndef __MATRIX_H__
#define __MATRIX_H__
#include <vector>
#include <iostream>
namespace magic {
using std::vector;
// This is a custom Matrix type to allow for matrix multiplication
class Matrix {
public:
Matrix(uint8_t rows, uint8_t columns) {
this->_rows = rows;
this->_columns = columns;
this->entries.assign(rows, vector<int32_t>(columns, 0));
}
void setValue(uint8_t i, uint8_t j, int32_t value) {
entries[i][j] = value;
}
int32_t getValue(uint8_t i, uint8_t j) {
return entries[i][j];
}
// Calculate the matrix product with another matrix
Matrix multiply(Matrix &other) {
// Create the result matrix
Matrix result(this->_rows, other._columns);
// Calculate all entries in the resulting matrix
for (uint8_t r = 0; r < this->_rows; r++) {
for (uint8_t c = 0; c < other._columns; c++) {
for (uint8_t link = 0; link < this->_columns; link++) {
int32_t res = result.getValue(r, c) + this->getValue(r, link) * other.getValue(link, c);
result.setValue(r, c, res);
}
}
}
// Return the resulting matrix
return result;
}
// Output the matrix to screen
void print() {
using std::cout;
using std::endl;
for (uint8_t r = 0; r < this->_rows; r++) {
for (uint8_t c = 0; c < this->_columns; c++) {
cout << entries[r][c] << '\t';
}
cout << endl;
}
}
private:
uint8_t _rows;
uint8_t _columns;
vector<vector<int32_t>> entries;
};
}
#endif