/*
 * Implementation of the matrix operations.
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <math.h>

// We include the header file for the definition of the Matrix struct.
#include "matrix_lib.h"

// Create a new matrix.
Matrix newMatrix(size_t height, size_t width) {
    Matrix nm = {.data = NULL, .rows = NULL, .width = 0, .height = 0};
    if (0 == height * width) {
        return nm;
    }
    // First we allocate one pointer for the entire memory
    nm.data = calloc(width*height, sizeof(float));
    nm.height = height;
    nm.width = width;
    // TODO Now initialize rows.
    // It will be an array of pointers that point into nm.data.
    return nm;
}

// Read a matrix of unknown size from the FILE*
// You can re-use whatever number reading technique you developed in hw2
// Either figure out a way to store the numbers as you parse the file, or
// you may also parse the file twice: once to count the numbers and a second time to populate the matrix.
// Return a 0-size matrix upon failure
Matrix readMatrix(FILE* datafile) {
    // TODO
}

// Dot product of two matrices
// If the sizes don't match, meaning the left.width != right.height,
// return a matrix with NULL data and 0 size as in the addMatrix function.
Matrix dotProduct(Matrix left, Matrix right) {
    // TODO
}

