Lines 368-383
PlainObjectBase<Derived>::setConstant(In
Link Here
|
368 |
template<typename Derived> |
368 |
template<typename Derived> |
369 |
EIGEN_STRONG_INLINE Derived& |
369 |
EIGEN_STRONG_INLINE Derived& |
370 |
PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val) |
370 |
PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val) |
371 |
{ |
371 |
{ |
372 |
resize(rows, cols); |
372 |
resize(rows, cols); |
373 |
return setConstant(val); |
373 |
return setConstant(val); |
374 |
} |
374 |
} |
375 |
|
375 |
|
|
|
376 |
/** Resizes to the given number of columns, leaves the number of rows the same, and sets all coefficients in this expression to the given value \a val. |
377 |
* |
378 |
* \param cols the new number of columns |
379 |
* \param val the value to which all coefficients are set |
380 |
* |
381 |
* Example: \include Matrix_setConstant_NoChange.cpp |
382 |
* Output: \verbinclude Matrix_setConstant_NoChange.out |
383 |
* |
384 |
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) |
385 |
*/ |
386 |
template<typename Derived> |
387 |
EIGEN_STRONG_INLINE Derived& |
388 |
PlainObjectBase<Derived>::setConstant(NoChange_t, Index cols, const Scalar& val) |
389 |
{ |
390 |
resize(rows(), cols); |
391 |
return setConstant(val); |
392 |
} |
393 |
|
394 |
/** Resizes to the given number of rows, leaves the number of columns the same, and sets all coefficients in this expression to the given value \a val. |
395 |
* |
396 |
* \param rows the new number of rows |
397 |
* \param val the value to which all coefficients are set |
398 |
* |
399 |
* Example: \include Matrix_setConstant_NoChange.cpp |
400 |
* Output: \verbinclude Matrix_setConstant_NoChange.out |
401 |
* |
402 |
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) |
403 |
*/ |
404 |
template<typename Derived> |
405 |
EIGEN_STRONG_INLINE Derived& |
406 |
PlainObjectBase<Derived>::setConstant(Index rows, NoChange_t, const Scalar& val) |
407 |
{ |
408 |
resize(rows, cols()); |
409 |
return setConstant(val); |
410 |
} |
411 |
|
412 |
|
376 |
/** |
413 |
/** |
377 |
* \brief Sets a linearly spaced vector. |
414 |
* \brief Sets a linearly spaced vector. |
378 |
* |
415 |
* |
379 |
* The function generates 'size' equally spaced values in the closed interval [low,high]. |
416 |
* The function generates 'size' equally spaced values in the closed interval [low,high]. |
380 |
* When size is set to 1, a vector of length 1 containing 'high' is returned. |
417 |
* When size is set to 1, a vector of length 1 containing 'high' is returned. |
381 |
* |
418 |
* |
382 |
* \only_for_vectors |
419 |
* \only_for_vectors |
383 |
* |
420 |
* |
Lines 535-550
PlainObjectBase<Derived>::setZero(Index
Link Here
|
535 |
template<typename Derived> |
572 |
template<typename Derived> |
536 |
EIGEN_STRONG_INLINE Derived& |
573 |
EIGEN_STRONG_INLINE Derived& |
537 |
PlainObjectBase<Derived>::setZero(Index rows, Index cols) |
574 |
PlainObjectBase<Derived>::setZero(Index rows, Index cols) |
538 |
{ |
575 |
{ |
539 |
resize(rows, cols); |
576 |
resize(rows, cols); |
540 |
return setConstant(Scalar(0)); |
577 |
return setConstant(Scalar(0)); |
541 |
} |
578 |
} |
542 |
|
579 |
|
|
|
580 |
/** Resizes to the given size while keeping number of rows constant and sets all coefficients in this expression to zero. |
581 |
* |
582 |
* \param cols the new number of columns |
583 |
* |
584 |
* Example: \include Matrix_setZero_NoChange.cpp |
585 |
* Output: \verbinclude Matrix_setZero_NoChange.out |
586 |
* |
587 |
* \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero() |
588 |
*/ |
589 |
template<typename Derived> |
590 |
EIGEN_STRONG_INLINE Derived& |
591 |
PlainObjectBase<Derived>::setZero(NoChange_t, Index cols) |
592 |
{ |
593 |
resize(rows(), cols); |
594 |
return setConstant(Scalar(0)); |
595 |
} |
596 |
|
597 |
/** Resizes to the given size while keeping number of columns constant and sets all coefficients in this expression to zero. |
598 |
* |
599 |
* \param rows the new number of rows |
600 |
* |
601 |
* Example: \include Matrix_setZero_NoChange.cpp |
602 |
* Output: \verbinclude Matrix_setZero_NoChange.out |
603 |
* |
604 |
* \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero() |
605 |
*/ |
606 |
template<typename Derived> |
607 |
EIGEN_STRONG_INLINE Derived& |
608 |
PlainObjectBase<Derived>::setZero(Index rows, NoChange_t) |
609 |
{ |
610 |
resize(rows, cols()); |
611 |
return setConstant(Scalar(0)); |
612 |
} |
613 |
|
614 |
|
543 |
// ones: |
615 |
// ones: |
544 |
|
616 |
|
545 |
/** \returns an expression of a matrix where all coefficients equal one. |
617 |
/** \returns an expression of a matrix where all coefficients equal one. |
546 |
* |
618 |
* |
547 |
* The parameters \a rows and \a cols are the number of rows and of columns of |
619 |
* The parameters \a rows and \a cols are the number of rows and of columns of |
548 |
* the returned matrix. Must be compatible with this MatrixBase type. |
620 |
* the returned matrix. Must be compatible with this MatrixBase type. |
549 |
* |
621 |
* |
550 |
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types, |
622 |
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types, |
Lines 661-676
PlainObjectBase<Derived>::setOnes(Index
Link Here
|
661 |
template<typename Derived> |
733 |
template<typename Derived> |
662 |
EIGEN_STRONG_INLINE Derived& |
734 |
EIGEN_STRONG_INLINE Derived& |
663 |
PlainObjectBase<Derived>::setOnes(Index rows, Index cols) |
735 |
PlainObjectBase<Derived>::setOnes(Index rows, Index cols) |
664 |
{ |
736 |
{ |
665 |
resize(rows, cols); |
737 |
resize(rows, cols); |
666 |
return setConstant(Scalar(1)); |
738 |
return setConstant(Scalar(1)); |
667 |
} |
739 |
} |
668 |
|
740 |
|
|
|
741 |
/** Resizes to the given size, and sets all coefficients in this expression to one. |
742 |
* |
743 |
* \param cols the new number of columns |
744 |
* |
745 |
* Example: \include Matrix_setOnes_NoChange.cpp |
746 |
* Output: \verbinclude Matrix_setOnes_NoChange.out |
747 |
* |
748 |
* \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones() |
749 |
*/ |
750 |
template<typename Derived> |
751 |
EIGEN_STRONG_INLINE Derived& |
752 |
PlainObjectBase<Derived>::setOnes(NoChange_t, Index cols) |
753 |
{ |
754 |
resize(rows(), cols); |
755 |
return setConstant(Scalar(1)); |
756 |
} |
757 |
|
758 |
/** Resizes to the given size, and sets all coefficients in this expression to one. |
759 |
* |
760 |
* \param rows the new number of rows |
761 |
* |
762 |
* Example: \include Matrix_setOnes_NoChange.cpp |
763 |
* Output: \verbinclude Matrix_setOnes_NoChange.out |
764 |
* |
765 |
* \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones() |
766 |
*/ |
767 |
template<typename Derived> |
768 |
EIGEN_STRONG_INLINE Derived& |
769 |
PlainObjectBase<Derived>::setOnes(Index rows, NoChange_t) |
770 |
{ |
771 |
resize(rows, cols()); |
772 |
return setConstant(Scalar(1)); |
773 |
} |
774 |
|
669 |
// Identity: |
775 |
// Identity: |
670 |
|
776 |
|
671 |
/** \returns an expression of the identity matrix (not necessarily square). |
777 |
/** \returns an expression of the identity matrix (not necessarily square). |
672 |
* |
778 |
* |
673 |
* The parameters \a rows and \a cols are the number of rows and of columns of |
779 |
* The parameters \a rows and \a cols are the number of rows and of columns of |
674 |
* the returned matrix. Must be compatible with this MatrixBase type. |
780 |
* the returned matrix. Must be compatible with this MatrixBase type. |
675 |
* |
781 |
* |
676 |
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types, |
782 |
* This variant is meant to be used for dynamic-size matrix types. For fixed-size types, |