src/matrix_operators.cpp
Matrix<long double>* matrix_operators::multiply(const Matrix<long double> *first, const NeuralMatrix *other)  {
    if(first -> M == other -> N) {
        Matrix<long double> *product = new Matrix<long double>(first -> N, other -> M);
        if(product == nullptr) {
            return nullptr;
        }
        register size_t i, j, k;
        for(i = 0; i < first -> N; ++i) {
            for(j = 0; j < other -> M; ++j) {
                product -> matrix[i][j] = 0;
                for(k = 0; k < first -> M; ++k) {
                    product -> matrix[i][j] += first -> matrix[i][k] * other -> matrix[k][j] -> function;
                }
            }
        }
        return product;
    } else {
        throw std::length_error("Dimension mismatch");
    }
}
// there's likely a better way to do these multiplications than to write specific cases for the matrices
// using something like iterators for data members and then just iterating through and returning a vector of
// doubles which is the resuult of whatever multiplicatios
there's likely a better way to do these multiplications than to write specific cases for the matrices
using something like iterators for data members and then just iterating through and returning a vector of
doubles which is the resuult of whatever multiplicatios
there ' s likely a better way to do these multiplications than to write specific cases for the matrices using something like iterators for data members and then just iterating through and returning a vector of doubles which is the resuult of whatever multiplicatios
Matrix<long double>* matrix_operators::multiply(const Matrix<long double> *first, const NeuralMatrix *other)  {
    if(first -> M == other -> N) {
        Matrix<long double> *product = new Matrix<long double>(first -> N, other -> M);
        if(product == nullptr) {
            return nullptr;
        }
        register size_t i, j, k;
        for(i = 0; i < first -> N; ++i) {
            for(j = 0; j < other -> M; ++j) {
                product -> matrix[i][j] = 0;
                for(k = 0; k < first -> M; ++k) {
                    product -> matrix[i][j] += first -> matrix[i][k] * other -> matrix[k][j] -> function;
                }
            }
        }
        return product;
    } else {
        throw std::length_error("Dimension mismatch");
    }
}
Matrix < long double > * matrix_operators :: multiply ( const Matrix < long double > * first , const NeuralMatrix * other ) { if ( first -> M == other -> N ) { Matrix < long double > * product = new Matrix < long double > ( first -> N , other -> M ) ; if ( product == nullptr ) { return nullptr ; } register size_t i , j , k ; for ( i = 0 ; i < first -> N ; ++ i ) { for ( j = 0 ; j < other -> M ; ++ j ) { product -> matrix [ i ] [ j ] = 0 ; for ( k = 0 ; k < first -> M ; ++ k ) { product -> matrix [ i ] [ j ] += first -> matrix [ i ] [ k ] * other -> matrix [ k ] [ j ] -> function ; } } } return product ; } else { throw std :: length_error ( " " ) ; } }
there's likely a better way to do these multiplications than to write specific cases for the matrices
using something like iterators for data members and then just iterating through and returning a vector of
doubles which is the resuult of whatever multiplicatios
there ' s likely a better way to do these multiplications than to write specific cases for the matrices using something like iterators for data members and then just iterating through and returning a vector of doubles which is the resuult of whatever multiplicatios