This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sparse Matrices | |
#include <stdio.h> | |
#include <stdlib.h> | |
void PrintMatrix(int** twoDimensionalArray, unsigned numRows, unsigned numColumns); | |
// COO: coordinate format. We store tuples of (row, column, value). | |
// Ex: | |
// For matrix M = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Demo of a FSM using function pointers. | |
#include <stdio.h> | |
enum return_codes { ok, fail, repeat }; | |
int entry_state() { return ok; } | |
int foo_state() { return ok; } | |
int bar_state() { return ok; } | |
int end_state() { return ok; } | |
int unknown_state() { return ok; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <vector> | |
// num_columns refers to the number of columns in the original matrix, not the | |
// desired column count post transpose. | |
void Transpose(int* begin, int* end, const std::size_t num_columns) { | |
const int64_t size = (end-begin-1); // num_elements-1 | |
const int64_t num_rows = (end-begin)/num_columns; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prompt customization | |
# PROMPT_COMMAND='echo' | |
PS1='\w $ ' | |
export PS1 | |
export EDITOR="vim" | |
alias e="vim" | |
alias vi="vim" | |
session_name="main" |