diff --git a/src/Matrix.cpp b/src/Matrix.cpp index 2afd276..1bcfb04 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -255,14 +255,22 @@ namespace Aurora { bool Matrix::isScalar() const { return (getDimSize(0) == 1 && getDimSize(1) == 1 && - getDimSize(1)); + getDimSize(2) < 2); } + double Matrix::getScalar() const { if (isNull()) return 0.0; if (isNull()) return 0.0; return getData()[0]; } + bool Matrix::isVector() const{ + if (getDimSize(2)>1) return false; + if (isScalar) return false; + return getDimSize(0) == 1 || + getDimSize(1) == 1; + } + int Matrix::getDims() const { if(mInfo[2] > 1) { diff --git a/src/Matrix.h b/src/Matrix.h index 9d4d1e1..3edf183 100644 --- a/src/Matrix.h +++ b/src/Matrix.h @@ -178,6 +178,8 @@ namespace Aurora { */ bool isNull() const; + bool isVector() const; + /** * Get dimension count of the matrix * @return dimension count