mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
- optimized determinant calculations for small matrices (size <= 4)
(only 30 muls for size 4) - rework the matrix inversion: now using cofactor technique for size<=3, so the ugly unrolling is only used for size 4 anymore, and even there I'm looking to get rid of it.
This commit is contained in:
@@ -392,16 +392,12 @@ Block<Derived> MatrixBase<Derived>
|
||||
{
|
||||
case TopLeft:
|
||||
return Block<Derived>(derived(), 0, 0, cRows, cCols);
|
||||
break;
|
||||
case TopRight:
|
||||
return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
|
||||
break;
|
||||
case BottomLeft:
|
||||
return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
|
||||
break;
|
||||
case BottomRight:
|
||||
return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
|
||||
break;
|
||||
default:
|
||||
ei_assert(false && "Bad corner type.");
|
||||
}
|
||||
@@ -416,16 +412,12 @@ const Block<Derived> MatrixBase<Derived>
|
||||
{
|
||||
case TopLeft:
|
||||
return Block<Derived>(derived(), 0, 0, cRows, cCols);
|
||||
break;
|
||||
case TopRight:
|
||||
return Block<Derived>(derived(), 0, cols() - cCols, cRows, cCols);
|
||||
break;
|
||||
case BottomLeft:
|
||||
return Block<Derived>(derived(), rows() - cRows, 0, cRows, cCols);
|
||||
break;
|
||||
case BottomRight:
|
||||
return Block<Derived>(derived(), rows() - cRows, cols() - cCols, cRows, cCols);
|
||||
break;
|
||||
default:
|
||||
ei_assert(false && "Bad corner type.");
|
||||
}
|
||||
@@ -452,16 +444,12 @@ Block<Derived, CRows, CCols> MatrixBase<Derived>
|
||||
{
|
||||
case TopLeft:
|
||||
return Block<Derived, CRows, CCols>(derived(), 0, 0);
|
||||
break;
|
||||
case TopRight:
|
||||
return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
|
||||
break;
|
||||
case BottomLeft:
|
||||
return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
|
||||
break;
|
||||
case BottomRight:
|
||||
return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
|
||||
break;
|
||||
default:
|
||||
ei_assert(false && "Bad corner type.");
|
||||
}
|
||||
@@ -477,16 +465,12 @@ const Block<Derived, CRows, CCols> MatrixBase<Derived>
|
||||
{
|
||||
case TopLeft:
|
||||
return Block<Derived, CRows, CCols>(derived(), 0, 0);
|
||||
break;
|
||||
case TopRight:
|
||||
return Block<Derived, CRows, CCols>(derived(), 0, cols() - CCols);
|
||||
break;
|
||||
case BottomLeft:
|
||||
return Block<Derived, CRows, CCols>(derived(), rows() - CRows, 0);
|
||||
break;
|
||||
case BottomRight:
|
||||
return Block<Derived, CRows, CCols>(derived(), rows() - CRows, cols() - CCols);
|
||||
break;
|
||||
default:
|
||||
ei_assert(false && "Bad corner type.");
|
||||
}
|
||||
|
||||
@@ -513,6 +513,7 @@ template<typename Derived> class MatrixBase
|
||||
//@{
|
||||
const Inverse<Derived, true> inverse() const;
|
||||
const Inverse<Derived, false> quickInverse() const;
|
||||
Scalar determinant() const;
|
||||
//@}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user