eigen_matrixbase_addons.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 * VCGLib                                                            o o     *
00003 * Visual and Computer Graphics Library                            o     o   *
00004 *                                                                _   O  _   *
00005 * Copyright(C) 2004                                                \/)\/    *
00006 * Visual Computing Lab                                            /\/|      *
00007 * ISTI - Italian National Research Council                           |      *
00008 *                                                                    \      *
00009 * All rights reserved.                                                      *
00010 *                                                                           *
00011 * This program is free software; you can redistribute it and/or modify      *
00012 * it under the terms of the GNU General Public License as published by      *
00013 * the Free Software Foundation; either version 2 of the License, or         *
00014 * (at your option) any later version.                                       *
00015 *                                                                           *
00016 * This program is distributed in the hope that it will be useful,           *
00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020 * for more details.                                                         *
00021 *                                                                           *
00022 ****************************************************************************/
00023 
00024 #ifdef __GNUC__
00025 #warning You are including deprecated math stuff
00026 #endif
00027 
00028 typedef Scalar ScalarType;
00029 
00031 EIGEN_DEPRECATED inline unsigned int ColumnsNumber() const { return cols(); };
00032 
00033 
00035 EIGEN_DEPRECATED inline unsigned int RowsNumber() const { return rows(); };
00036 
00044 EIGEN_DEPRECATED inline Scalar ElementAt(unsigned int i, unsigned int j) const { return (*this)(i,j); };
00045 EIGEN_DEPRECATED inline Scalar& ElementAt(unsigned int i, unsigned int j) { return (*this)(i,j); };
00046 EIGEN_DEPRECATED inline Scalar V(int i) const { return (*this)[i]; };
00047 EIGEN_DEPRECATED inline Scalar& V(int i) { return (*this)[i]; };
00048 
00054 EIGEN_DEPRECATED Scalar Determinant() const { return determinant(); };
00055 
00060 EIGEN_DEPRECATED Scalar Cofactor(unsigned int i, unsigned int j) const
00061 {
00062         assert(rows() == cols());
00063         assert(rows()>2);
00064         return (((i+j)%2==0) ? 1. : -1.) * minor(i,j).determinant();
00065 };
00066 
00068 EIGEN_DEPRECATED ColXpr GetColumn(const unsigned int j) { return col(j); };
00069 
00071 EIGEN_DEPRECATED RowXpr GetRow(const unsigned int i) { return row(i); };
00072 
00074 EIGEN_DEPRECATED void SwapColumns(const unsigned int i, const unsigned int j)
00075 {
00076         if (i==j) return;
00077         col(i).swap(col(j));
00078 };
00079 
00081 EIGEN_DEPRECATED void SwapRows(const unsigned int i, const unsigned int j)
00082 {
00083         if (i==j) return;
00084         row(i).swap(row(j));
00085 };
00086 
00093 EIGEN_DEPRECATED Derived& operator+=(const Scalar k)
00094 {
00095         cwise() += k;
00096         return *this;
00097 };
00098 
00105 EIGEN_DEPRECATED Derived& operator-=(const Scalar k)
00106 {
00107         cwise() -= k;
00108         return *this;
00109 };
00110 
00117 // template <int N,int M>
00118 // EIGEN_DEPRECATED void DotProduct(Point<N,Scalar> &m,Point<M,Scalar> &result)
00119 // {
00120 //      unsigned int i, j;
00121 //      for (i=0; i<M; i++)
00122 //      { result[i]=0;
00123 //              for (j=0; j<N; j++)
00124 //                      result[i]+=(*this)[i][j]*m[j];
00125 //      }
00126 // };
00127 
00128 
00130 template <typename OtherDerived1, typename OtherDerived2>
00131 EIGEN_DEPRECATED void OuterProduct(const MatrixBase<OtherDerived1>& a, const MatrixBase<OtherDerived2>& b)
00132 { *this = a * b.adjoint(); }
00133 
00134 typedef CwiseUnaryOp<ei_scalar_add_op<Scalar>, Derived> ScalarAddReturnType;
00135 
00137 EIGEN_DEPRECATED const ScalarAddReturnType operator+(const Scalar k) { return cwise() + k; }
00138 
00140 EIGEN_DEPRECATED const ScalarAddReturnType operator-(const Scalar k) { return cwise() - k; }
00141 
00143 EIGEN_DEPRECATED void SetZero() { setZero(); };
00144 
00146 EIGEN_DEPRECATED void SetIdentity() { setIdentity(); };
00147 
00149 EIGEN_DEPRECATED void SetColumn(unsigned int j, Scalar* v)
00150 { col(j) = Map<Matrix<Scalar,RowsAtCompileTime,1> >(v,cols(),1); };
00151 
00153 template<typename OtherDerived>
00154 EIGEN_DEPRECATED void SetColumn(unsigned int j, const MatrixBase<OtherDerived>& other)
00155 { col(j) = other; };
00156 
00158 EIGEN_DEPRECATED void SetRow(unsigned int i, Scalar* v)
00159 { row(i) = Map<Matrix<Scalar,1,ColsAtCompileTime> >(v,1,rows()); };
00160 
00162 template<typename OtherDerived>
00163 EIGEN_DEPRECATED void SetRow(unsigned int j, const MatrixBase<OtherDerived>& other)
00164 { row(j) = other; };
00165 
00167 EIGEN_DEPRECATED void SetDiagonal(Scalar *v)
00168 {
00169         assert(rows() == cols());
00170         diagonal() = Map<Matrix<Scalar,RowsAtCompileTime,1> >(v,cols(),1);
00171 }
00172 
00174 EIGEN_DEPRECATED Scalar Trace() const { return trace(); }
00175 
00177 EIGEN_DEPRECATED void Dump()
00178 {
00179         unsigned int i, j;
00180         for (i=0; i<rows(); ++i)
00181         {
00182                 printf("[\t");
00183                 for (j=0; j<cols(); j++)
00184                         printf("%f\t", coeff(i,j));
00185                 printf("]\n");
00186         }
00187         printf("\n");
00188 }
00189 
00191 EIGEN_DEPRECATED inline Scalar Norm() const { return norm(); };
00193 EIGEN_DEPRECATED inline Scalar SquaredNorm() const { return squaredNorm(); };
00195 EIGEN_DEPRECATED inline Derived& Normalize() { normalize(); return derived(); };
00197 EIGEN_DEPRECATED inline const PlainMatrixType Normalize() const { return normalized(); };
00198 
00200 EIGEN_DEPRECATED inline Derived& Transpose() { transposeInPlace(); return derived(); };
00202 EIGEN_DEPRECATED inline const Eigen::Transpose<Derived> Transpose() const { return transpose(); };
00203 
00205 EIGEN_DEPRECATED inline PlainMatrixType operator ^ (const Derived& p ) const { return this->cross(p); }
00206 
00208 inline Derived& HomoNormalize()
00209 {
00210         EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
00211         enum {
00212          SubRows = (int(Flags)&RowMajorBit) ? 1 : (RowsAtCompileTime==Dynamic ? Dynamic : RowsAtCompileTime-1),
00213          SubCols = (int(Flags)&RowMajorBit) ? (ColsAtCompileTime==Dynamic ? Dynamic : ColsAtCompileTime-1) : 1,
00214         };
00215         Scalar& last = coeffRef(size()-2);
00216         if (last!=Scalar(0))
00217         {
00218                 Block<Derived,SubRows,SubCols>(derived(),0,0,
00219                         (int(Flags)&RowMajorBit) ? size()-1 : 1,
00220                         (int(Flags)&RowMajorBit) ? 1 : (size()-1)) / last;
00221                 last = Scalar(1.0);
00222         }
00223         return *this;
00224 }
00225 
00226 inline const PlainMatrixType HomoNormalize() const
00227 {
00228         PlainMatrixType res = derived();
00229         return res.HomoNormalize();
00230 }
00231 
00233 EIGEN_DEPRECATED inline Scalar NormInfinity() const { return derived().cwise().abs().maxCoeff(); }
00235 EIGEN_DEPRECATED inline Scalar NormOne() const { return derived().cwise().abs().sum(); }
00236 
00237 
00239 EIGEN_DEPRECATED inline Scalar Sum() const { return sum(); }
00241 EIGEN_DEPRECATED inline Scalar Max() const { return maxCoeff(); }
00243 EIGEN_DEPRECATED inline Scalar Min() const { return minCoeff(); }
00245 EIGEN_DEPRECATED inline int MaxI() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); int i; maxCoeff(&i,0); return i; }
00247 EIGEN_DEPRECATED inline int MinI() const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); int i; minCoeff(&i,0); return i; }
00248 
00249 
00252 inline Scalar Ext( const int i ) const
00253 {
00254         EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
00255         EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived);
00256 
00257         if(i>=0 && i<SizeAtCompileTime)
00258                 return coeff(i);
00259         else
00260                 return Scalar(0);
00261 }
00262 
00263 
00265 template<typename OtherDerived>
00266 EIGEN_DEPRECATED inline Derived& Scale(const MatrixBase<OtherDerived>& other)
00267 { this->cwise() *= other; return derived; }
00268 
00269 template<typename OtherDerived>
00270 EIGEN_DEPRECATED inline
00271 CwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, OtherDerived>
00272 Scale(const MatrixBase<OtherDerived>& other) const
00273 { return this->cwise() * other; }
00274 
00275 
00276 template<typename OtherDerived>
00277 EIGEN_DEPRECATED inline bool operator <  (const MatrixBase<OtherDerived>& other) const {
00278         EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
00279         EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived);
00280         return ei_lexi_comparison<Derived,OtherDerived,SizeAtCompileTime>::less(derived(),other.derived());
00281 }
00282 
00283 template<typename OtherDerived>
00284 EIGEN_DEPRECATED inline bool operator >  (const MatrixBase<OtherDerived>& other) const {
00285         EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
00286         EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived);
00287         return ei_lexi_comparison<Derived,OtherDerived,SizeAtCompileTime>::geater(derived(),other.derived());
00288 }
00289 
00290 template<typename OtherDerived>
00291 EIGEN_DEPRECATED inline bool operator <=  (const MatrixBase<OtherDerived>& other) const {
00292         EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
00293         EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived);
00294         return ei_lexi_comparison<Derived,OtherDerived,SizeAtCompileTime>::lessEqual(derived(),other.derived());
00295 }
00296 
00297 template<typename OtherDerived>
00298 EIGEN_DEPRECATED inline bool operator >=  (const MatrixBase<OtherDerived>& other) const {
00299         EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
00300         EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived);
00301         return ei_lexi_comparison<Derived,OtherDerived,SizeAtCompileTime>::greaterEqual(derived(),other.derived());
00302 }


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:30:47