Пример #1
0
ComplexMatrix subtract(ComplexMatrix& x, ComplexMatrix& y)
{
    if(sameDimensions(x,y))
    {
        ComplexMatrix result(x.RSize(), x.CSize());

        for (int i = 0; i < x.RSize(); i++)
        {
            for (int j = 0; j < x.CSize(); j++)
            {
                result(i, j) = x(i, j) - y(i, j);
            }
        }
        return result;
    }
    else
    {
       throw ("Matrices must be the same dimension to perform subtraction");
    }
}
Пример #2
0
//From Fransk CSharp code... a bug was fixed in this code..
bool sameDimensions(ComplexMatrix& x, ComplexMatrix& y)
{
    return ((x.RSize() == y.RSize()) && (x.CSize() == y.CSize())) ? true : false;
}