Skip to content
Snippets Groups Projects
Select Git revision
  • 9fa8823cdf2d5a8ff55114b95cdd67af8e9e926a
  • master default protected
  • android-7.1.2_r28_klist
  • pie-cts-release
  • pie-vts-release
  • pie-cts-dev
  • oreo-mr1-iot-release
  • sdk-release
  • oreo-m6-s4-release
  • oreo-m4-s12-release
  • pie-release
  • pie-r2-release
  • pie-r2-s1-release
  • oreo-vts-release
  • oreo-cts-release
  • oreo-dev
  • oreo-mr1-dev
  • pie-gsi
  • pie-platform-release
  • pie-dev
  • oreo-cts-dev
  • android-o-mr1-iot-release-1.0.4
  • android-9.0.0_r8
  • android-9.0.0_r7
  • android-9.0.0_r6
  • android-9.0.0_r5
  • android-8.1.0_r46
  • android-8.1.0_r45
  • android-n-iot-release-smart-display-r2
  • android-vts-8.1_r5
  • android-cts-8.1_r8
  • android-cts-8.0_r12
  • android-cts-7.1_r20
  • android-cts-7.0_r24
  • android-o-mr1-iot-release-1.0.3
  • android-cts-9.0_r1
  • android-8.1.0_r43
  • android-8.1.0_r42
  • android-n-iot-release-smart-display
  • android-p-preview-5
  • android-9.0.0_r3
41 results

file_contexts

Blame
    • ynwang's avatar
      9fa8823c
      Storaged permission setting · 9fa8823c
      ynwang authored
      Allowing storaged for reading from pseudo filesystems and debugfs.
      
      Bug: 32221677
      
      Change-Id: I837cead9a68f0b399703b64d724cb9c4b205c335
      9fa8823c
      History
      Storaged permission setting
      ynwang authored
      Allowing storaged for reading from pseudo filesystems and debugfs.
      
      Bug: 32221677
      
      Change-Id: I837cead9a68f0b399703b64d724cb9c4b205c335
    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