Add isVector and fix isScalar function to Matrix.
This commit is contained in:
@@ -255,14 +255,22 @@ namespace Aurora {
|
|||||||
bool Matrix::isScalar() const {
|
bool Matrix::isScalar() const {
|
||||||
return (getDimSize(0) == 1 &&
|
return (getDimSize(0) == 1 &&
|
||||||
getDimSize(1) == 1 &&
|
getDimSize(1) == 1 &&
|
||||||
getDimSize(1));
|
getDimSize(2) < 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Matrix::getScalar() const {
|
double Matrix::getScalar() const {
|
||||||
if (isNull()) return 0.0;
|
if (isNull()) return 0.0;
|
||||||
if (isNull()) return 0.0;
|
if (isNull()) return 0.0;
|
||||||
return getData()[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 {
|
int Matrix::getDims() const {
|
||||||
if(mInfo[2] > 1)
|
if(mInfo[2] > 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ namespace Aurora {
|
|||||||
*/
|
*/
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
|
|
||||||
|
bool isVector() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get dimension count of the matrix
|
* Get dimension count of the matrix
|
||||||
* @return dimension count
|
* @return dimension count
|
||||||
|
|||||||
Reference in New Issue
Block a user