1 //=================================================================================================
2 /*!
3 //  \file blaze/math/adaptors/uppermatrix/UpperProxy.h
4 //  \brief Header file for the UpperProxy class
5 //
6 //  Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved
7 //
8 //  This file is part of the Blaze library. You can redistribute it and/or modify it under
9 //  the terms of the New (Revised) BSD License. Redistribution and use in source and binary
10 //  forms, with or without modification, are permitted provided that the following conditions
11 //  are met:
12 //
13 //  1. Redistributions of source code must retain the above copyright notice, this list of
14 //     conditions and the following disclaimer.
15 //  2. Redistributions in binary form must reproduce the above copyright notice, this list
16 //     of conditions and the following disclaimer in the documentation and/or other materials
17 //     provided with the distribution.
18 //  3. Neither the names of the Blaze development group nor the names of its contributors
19 //     may be used to endorse or promote products derived from this software without specific
20 //     prior written permission.
21 //
22 //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
23 //  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 //  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 //  SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 //  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27 //  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 //  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 //  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 //  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 //  DAMAGE.
32 */
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UPPERMATRIX_UPPERPROXY_H_
36 #define _BLAZE_MATH_ADAPTORS_UPPERMATRIX_UPPERPROXY_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
44 #include <blaze/math/constraints/Computation.h>
45 #include <blaze/math/constraints/Hermitian.h>
46 #include <blaze/math/constraints/Lower.h>
47 #include <blaze/math/constraints/Matrix.h>
48 #include <blaze/math/constraints/Symmetric.h>
49 #include <blaze/math/constraints/Transformation.h>
50 #include <blaze/math/constraints/Upper.h>
51 #include <blaze/math/constraints/View.h>
52 #include <blaze/math/Exception.h>
53 #include <blaze/math/InitializerList.h>
54 #include <blaze/math/proxy/Proxy.h>
55 #include <blaze/math/RelaxationFlag.h>
56 #include <blaze/math/shims/Clear.h>
57 #include <blaze/math/shims/IsDefault.h>
58 #include <blaze/math/shims/IsOne.h>
59 #include <blaze/math/shims/IsReal.h>
60 #include <blaze/math/shims/IsZero.h>
61 #include <blaze/math/shims/Reset.h>
62 #include <blaze/util/constraints/Const.h>
63 #include <blaze/util/constraints/Pointer.h>
64 #include <blaze/util/constraints/Reference.h>
65 #include <blaze/util/constraints/Volatile.h>
66 #include <blaze/util/typetraits/AddConst.h>
67 #include <blaze/util/typetraits/AddLValueReference.h>
68 #include <blaze/util/Types.h>
69 
70 
71 namespace blaze {
72 
73 //=================================================================================================
74 //
75 //  CLASS DEFINITION
76 //
77 //=================================================================================================
78 
79 //*************************************************************************************************
80 /*!\brief Access proxy for upper triangular matrices.
81 // \ingroup upper_matrix
82 //
83 // The UpperProxy provides controlled access to the elements of a non-const upper triangular
84 // matrix. It guarantees that the upper matrix invariant is not violated, i.e. that elements
85 // in the lower part of the matrix remain default values. The following example illustrates
86 // this by means of a \f$ 3 \times 3 \f$ dense upper matrix:
87 
88    \code
89    // Creating a 3x3 upper dense matrix
90    blaze::UpperMatrix< blaze::DynamicMatrix<int> > A( 3UL );
91 
92    A(0,0) = -2;  //        ( -2 3 0 )
93    A(0,1) =  3;  // => A = (  0 0 5 )
94    A(1,2) =  5;  //        (  0 0 0 )
95 
96    A(2,0) =  7;  // Invalid assignment to lower matrix element; results in an exception!
97    \endcode
98 */
99 template< typename MT >  // Type of the adapted matrix
100 class UpperProxy
101    : public Proxy< UpperProxy<MT>, ElementType_t<MT> >
102 {
103  private:
104    //**Type definitions****************************************************************************
105    //! Reference type of the underlying matrix type.
106    using ReferenceType = AddConst_t< typename MT::Reference >;
107    //**********************************************************************************************
108 
109  public:
110    //**Type definitions****************************************************************************
111    using RepresentedType = ElementType_t<MT>;                    //!< Type of the represented matrix element.
112    using RawReference    = AddLValueReference_t<ReferenceType>;  //!< Reference-to-non-const to the represented element.
113    using ConstReference  = const RepresentedType&;               //!< Reference-to-const to the represented element.
114    //**********************************************************************************************
115 
116    //**Constructors********************************************************************************
117    /*!\name Constructors */
118    //@{
119    inline UpperProxy( MT& matrix, size_t row, size_t column );
120 
121    UpperProxy( const UpperProxy& ) = default;
122    //@}
123    //**********************************************************************************************
124 
125    //**Destructor**********************************************************************************
126    /*!\name Destructor */
127    //@{
128    ~UpperProxy() = default;
129    //@}
130    //**********************************************************************************************
131 
132    //**Assignment operators************************************************************************
133    /*!\name Assignment operators */
134    //@{
135    inline const UpperProxy& operator=( const UpperProxy& up ) const;
136 
137    template< typename T >
138    inline const UpperProxy& operator=( initializer_list<T> list ) const;
139 
140    template< typename T >
141    inline const UpperProxy& operator=( initializer_list< initializer_list<T> > list ) const;
142 
143    template< typename T > inline const UpperProxy& operator= ( const T& value ) const;
144    template< typename T > inline const UpperProxy& operator+=( const T& value ) const;
145    template< typename T > inline const UpperProxy& operator-=( const T& value ) const;
146    template< typename T > inline const UpperProxy& operator*=( const T& value ) const;
147    template< typename T > inline const UpperProxy& operator/=( const T& value ) const;
148    template< typename T > inline const UpperProxy& operator%=( const T& value ) const;
149    //@}
150    //**********************************************************************************************
151 
152    //**Access operators****************************************************************************
153    /*!\name Access operators */
154    //@{
155    inline const UpperProxy* operator->() const noexcept;
156    //@}
157    //**********************************************************************************************
158 
159    //**Utility functions***************************************************************************
160    /*!\name Utility functions */
161    //@{
162    inline RawReference get()          const noexcept;
163    inline bool         isRestricted() const noexcept;
164    //@}
165    //**********************************************************************************************
166 
167    //**Conversion operator*************************************************************************
168    /*!\name Conversion operator */
169    //@{
170    inline operator ConstReference() const noexcept;
171    //@}
172    //**********************************************************************************************
173 
174  private:
175    //**Member variables****************************************************************************
176    /*!\name Member variables */
177    //@{
178    ReferenceType value_;    //!< Reference to the accessed matrix element.
179    const bool restricted_;  //!< Access flag for the accessed matrix element.
180                             /*!< The flag indicates if access to the matrix element is
181                                  restricted. It is \a true in case the proxy represents
182                                  an element in the lower part of the matrix. */
183    //@}
184    //**********************************************************************************************
185 
186    //**Compile time checks*************************************************************************
187    /*! \cond BLAZE_INTERNAL */
188    BLAZE_CONSTRAINT_MUST_BE_MATRIX_TYPE              ( MT );
189    BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE       ( MT );
190    BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE         ( MT );
191    BLAZE_CONSTRAINT_MUST_NOT_BE_CONST                ( MT );
192    BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE             ( MT );
193    BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE            ( MT );
194    BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE     ( MT );
195    BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE  ( MT );
196    BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE( MT );
197    BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE( MT );
198    BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE    ( MT );
199    BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE    ( MT );
200    /*! \endcond */
201    //**********************************************************************************************
202 };
203 //*************************************************************************************************
204 
205 
206 
207 
208 //=================================================================================================
209 //
210 //  CONSTRUCTORS
211 //
212 //=================================================================================================
213 
214 //*************************************************************************************************
215 /*!\brief Initialization constructor for a UpperProxy.
216 //
217 // \param matrix Reference to the adapted matrix.
218 // \param row The row-index of the accessed matrix element.
219 // \param column The column-index of the accessed matrix element.
220 */
221 template< typename MT >  // Type of the adapted matrix
UpperProxy(MT & matrix,size_t row,size_t column)222 inline UpperProxy<MT>::UpperProxy( MT& matrix, size_t row, size_t column )
223    : value_     ( matrix( row, column ) )  // Reference to the accessed matrix element
224    , restricted_( column < row )           // Access flag for the accessed matrix element
225 {}
226 //*************************************************************************************************
227 
228 
229 
230 
231 //=================================================================================================
232 //
233 //  OPERATORS
234 //
235 //=================================================================================================
236 
237 //*************************************************************************************************
238 /*!\brief Copy assignment operator for UpperProxy.
239 //
240 // \param up Upper proxy to be copied.
241 // \return Reference to the assigned proxy.
242 // \exception std::invalid_argument Invalid assignment to lower matrix element.
243 //
244 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
245 // exception is thrown.
246 */
247 template< typename MT >  // Type of the adapted matrix
248 inline const UpperProxy<MT>& UpperProxy<MT>::operator=( const UpperProxy& up ) const
249 {
250    if( restricted_ ) {
251       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
252    }
253 
254    value_ = up.value_;
255 
256    return *this;
257 }
258 //*************************************************************************************************
259 
260 
261 //*************************************************************************************************
262 /*!\brief Initializer list assignment to the accessed matrix element.
263 //
264 // \param list The list to be assigned to the matrix element.
265 // \return Reference to the assigned proxy.
266 // \exception std::invalid_argument Invalid assignment to lower matrix element.
267 //
268 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
269 // exception is thrown.
270 */
271 template< typename MT >  // Type of the adapted matrix
272 template< typename T >   // Type of the right-hand side value
273 inline const UpperProxy<MT>& UpperProxy<MT>::operator=( initializer_list<T> list ) const
274 {
275    if( restricted_ ) {
276       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
277    }
278 
279    value_ = list;
280 
281    return *this;
282 }
283 //*************************************************************************************************
284 
285 
286 //*************************************************************************************************
287 /*!\brief Initializer list assignment to the accessed matrix element.
288 //
289 // \param list The list to be assigned to the matrix element.
290 // \return Reference to the assigned proxy.
291 // \exception std::invalid_argument Invalid assignment to lower matrix element.
292 //
293 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
294 // exception is thrown.
295 */
296 template< typename MT >  // Type of the adapted matrix
297 template< typename T >   // Type of the right-hand side value
298 inline const UpperProxy<MT>& UpperProxy<MT>::operator=( initializer_list< initializer_list<T> > list ) const
299 {
300    if( restricted_ ) {
301       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
302    }
303 
304    value_ = list;
305 
306    return *this;
307 }
308 //*************************************************************************************************
309 
310 
311 //*************************************************************************************************
312 /*!\brief Assignment to the accessed matrix element.
313 //
314 // \param value The new value of the matrix element.
315 // \return Reference to the assigned proxy.
316 // \exception std::invalid_argument Invalid assignment to lower matrix element.
317 //
318 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
319 // exception is thrown.
320 */
321 template< typename MT >  // Type of the adapted matrix
322 template< typename T >   // Type of the right-hand side value
323 inline const UpperProxy<MT>& UpperProxy<MT>::operator=( const T& value ) const
324 {
325    if( restricted_ ) {
326       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
327    }
328 
329    value_ = value;
330 
331    return *this;
332 }
333 //*************************************************************************************************
334 
335 
336 //*************************************************************************************************
337 /*!\brief Addition assignment to the accessed matrix element.
338 //
339 // \param value The right-hand side value to be added to the matrix element.
340 // \return Reference to the assigned proxy.
341 // \exception std::invalid_argument Invalid assignment to lower matrix element.
342 //
343 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
344 // exception is thrown.
345 */
346 template< typename MT >  // Type of the adapted matrix
347 template< typename T >   // Type of the right-hand side value
348 inline const UpperProxy<MT>& UpperProxy<MT>::operator+=( const T& value ) const
349 {
350    if( restricted_ ) {
351       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
352    }
353 
354    value_ += value;
355 
356    return *this;
357 }
358 //*************************************************************************************************
359 
360 
361 //*************************************************************************************************
362 /*!\brief Subtraction assignment to the accessed matrix element.
363 //
364 // \param value The right-hand side value to be subtracted from the matrix element.
365 // \return Reference to the assigned proxy.
366 // \exception std::invalid_argument Invalid assignment to lower matrix element.
367 //
368 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
369 // exception is thrown.
370 */
371 template< typename MT >  // Type of the adapted matrix
372 template< typename T >   // Type of the right-hand side value
373 inline const UpperProxy<MT>& UpperProxy<MT>::operator-=( const T& value ) const
374 {
375    if( restricted_ ) {
376       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
377    }
378 
379    value_ -= value;
380 
381    return *this;
382 }
383 //*************************************************************************************************
384 
385 
386 //*************************************************************************************************
387 /*!\brief Multiplication assignment to the accessed matrix element.
388 //
389 // \param value The right-hand side value for the multiplication.
390 // \return Reference to the assigned proxy.
391 // \exception std::invalid_argument Invalid assignment to lower matrix element.
392 //
393 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
394 // exception is thrown.
395 */
396 template< typename MT >  // Type of the adapted matrix
397 template< typename T >   // Type of the right-hand side value
398 inline const UpperProxy<MT>& UpperProxy<MT>::operator*=( const T& value ) const
399 {
400    if( restricted_ ) {
401       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
402    }
403 
404    value_ *= value;
405 
406    return *this;
407 }
408 //*************************************************************************************************
409 
410 
411 //*************************************************************************************************
412 /*!\brief Division assignment to the accessed matrix element.
413 //
414 // \param value The right-hand side value for the division.
415 // \return Reference to the assigned proxy.
416 // \exception std::invalid_argument Invalid assignment to lower matrix element.
417 //
418 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
419 // exception is thrown.
420 */
421 template< typename MT >  // Type of the adapted matrix
422 template< typename T >   // Type of the right-hand side value
423 inline const UpperProxy<MT>& UpperProxy<MT>::operator/=( const T& value ) const
424 {
425    if( restricted_ ) {
426       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
427    }
428 
429    value_ /= value;
430 
431    return *this;
432 }
433 //*************************************************************************************************
434 
435 
436 //*************************************************************************************************
437 /*!\brief Modulo assignment to the accessed matrix element.
438 //
439 // \param value The right-hand side value for the modulo operation.
440 // \return Reference to the assigned proxy.
441 // \exception std::invalid_argument Invalid assignment to lower matrix element.
442 //
443 // In case the proxy represents an element in the lower matrix, a \a std::invalid_argument
444 // exception is thrown.
445 */
446 template< typename MT >  // Type of the adapted matrix
447 template< typename T >   // Type of the right-hand side value
448 inline const UpperProxy<MT>& UpperProxy<MT>::operator%=( const T& value ) const
449 {
450    if( restricted_ ) {
451       BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix element" );
452    }
453 
454    value_ %= value;
455 
456    return *this;
457 }
458 //*************************************************************************************************
459 
460 
461 
462 
463 //=================================================================================================
464 //
465 //  ACCESS OPERATORS
466 //
467 //=================================================================================================
468 
469 //*************************************************************************************************
470 /*!\brief Direct access to the accessed matrix element.
471 //
472 // \return Pointer to the accessed matrix element.
473 */
474 template< typename MT >  // Type of the adapted matrix
475 inline const UpperProxy<MT>* UpperProxy<MT>::operator->() const noexcept
476 {
477    return this;
478 }
479 //*************************************************************************************************
480 
481 
482 
483 
484 //=================================================================================================
485 //
486 //  UTILITY FUNCTIONS
487 //
488 //=================================================================================================
489 
490 //*************************************************************************************************
491 /*!\brief Returning the value of the accessed matrix element.
492 //
493 // \return Direct/raw reference to the accessed matrix element.
494 */
495 template< typename MT >  // Type of the adapted matrix
get()496 inline typename UpperProxy<MT>::RawReference UpperProxy<MT>::get() const noexcept
497 {
498    return value_;
499 }
500 //*************************************************************************************************
501 
502 
503 //*************************************************************************************************
504 /*!\brief Returns whether the proxy represents a restricted matrix element..
505 //
506 // \return \a true in case access to the matrix element is restricted, \a false if not.
507 */
508 template< typename MT >  // Type of the adapted matrix
isRestricted()509 inline bool UpperProxy<MT>::isRestricted() const noexcept
510 {
511    return restricted_;
512 }
513 //*************************************************************************************************
514 
515 
516 
517 
518 //=================================================================================================
519 //
520 //  CONVERSION OPERATOR
521 //
522 //=================================================================================================
523 
524 //*************************************************************************************************
525 /*!\brief Conversion to the accessed matrix element.
526 //
527 // \return Reference-to-const to the accessed matrix element.
528 */
529 template< typename MT >  // Type of the adapted matrix
ConstReference()530 inline UpperProxy<MT>::operator ConstReference() const noexcept
531 {
532    return static_cast<ConstReference>( value_ );
533 }
534 //*************************************************************************************************
535 
536 
537 
538 
539 //=================================================================================================
540 //
541 //  GLOBAL FUNCTIONS
542 //
543 //=================================================================================================
544 
545 //*************************************************************************************************
546 /*!\name UpperProxy global functions */
547 //@{
548 template< typename MT >
549 void reset( const UpperProxy<MT>& proxy );
550 
551 template< typename MT >
552 void clear( const UpperProxy<MT>& proxy );
553 
554 template< RelaxationFlag RF, typename MT >
555 bool isDefault( const UpperProxy<MT>& proxy );
556 
557 template< RelaxationFlag RF, typename MT >
558 bool isReal( const UpperProxy<MT>& proxy );
559 
560 template< RelaxationFlag RF, typename MT >
561 bool isZero( const UpperProxy<MT>& proxy );
562 
563 template< RelaxationFlag RF, typename MT >
564 bool isOne( const UpperProxy<MT>& proxy );
565 //@}
566 //*************************************************************************************************
567 
568 
569 //*************************************************************************************************
570 /*!\brief Resetting the represented element to the default initial values.
571 // \ingroup upper_matrix
572 //
573 // \param proxy The given access proxy.
574 // \return void
575 //
576 // This function resets the element represented by the access proxy to its default initial
577 // value.
578 */
579 template< typename MT >
reset(const UpperProxy<MT> & proxy)580 inline void reset( const UpperProxy<MT>& proxy )
581 {
582    using blaze::reset;
583 
584    reset( proxy.get() );
585 }
586 //*************************************************************************************************
587 
588 
589 //*************************************************************************************************
590 /*!\brief Clearing the represented element.
591 // \ingroup upper_matrix
592 //
593 // \param proxy The given access proxy.
594 // \return void
595 //
596 // This function clears the element represented by the access proxy to its default initial
597 // state.
598 */
599 template< typename MT >
clear(const UpperProxy<MT> & proxy)600 inline void clear( const UpperProxy<MT>& proxy )
601 {
602    using blaze::clear;
603 
604    clear( proxy.get() );
605 }
606 //*************************************************************************************************
607 
608 
609 //*************************************************************************************************
610 /*!\brief Returns whether the represented element is in default state.
611 // \ingroup upper_matrix
612 //
613 // \param proxy The given access proxy
614 // \return \a true in case the represented element is in default state, \a false otherwise.
615 //
616 // This function checks whether the element represented by the access proxy is in default state.
617 // In case it is in default state, the function returns \a true, otherwise it returns \a false.
618 */
619 template< RelaxationFlag RF, typename MT >
isDefault(const UpperProxy<MT> & proxy)620 inline bool isDefault( const UpperProxy<MT>& proxy )
621 {
622    using blaze::isDefault;
623 
624    return isDefault<RF>( proxy.get() );
625 }
626 //*************************************************************************************************
627 
628 
629 //*************************************************************************************************
630 /*!\brief Returns whether the matrix element represents a real number.
631 // \ingroup upper_matrix
632 //
633 // \param proxy The given access proxy.
634 // \return \a true in case the matrix element represents a real number, \a false otherwise.
635 //
636 // This function checks whether the element represented by the access proxy represents the a
637 // real number. In case the element is of built-in type, the function returns \a true. In case
638 // the element is of complex type, the function returns \a true if the imaginary part is equal
639 // to 0. Otherwise it returns \a false.
640 */
641 template< RelaxationFlag RF, typename MT >
isReal(const UpperProxy<MT> & proxy)642 inline bool isReal( const UpperProxy<MT>& proxy )
643 {
644    using blaze::isReal;
645 
646    return isReal<RF>( proxy.get() );
647 }
648 //*************************************************************************************************
649 
650 
651 //*************************************************************************************************
652 /*!\brief Returns whether the represented element is 0.
653 // \ingroup upper_matrix
654 //
655 // \param proxy The given access proxy.
656 // \return \a true in case the represented element is 0, \a false otherwise.
657 //
658 // This function checks whether the element represented by the access proxy represents the numeric
659 // value 0. In case it is 0, the function returns \a true, otherwise it returns \a false.
660 */
661 template< RelaxationFlag RF, typename MT >
isZero(const UpperProxy<MT> & proxy)662 inline bool isZero( const UpperProxy<MT>& proxy )
663 {
664    using blaze::isZero;
665 
666    return isZero<RF>( proxy.get() );
667 }
668 //*************************************************************************************************
669 
670 
671 //*************************************************************************************************
672 /*!\brief Returns whether the represented element is 1.
673 // \ingroup upper_matrix
674 //
675 // \param proxy The given access proxy.
676 // \return \a true in case the represented element is 1, \a false otherwise.
677 //
678 // This function checks whether the element represented by the access proxy represents the numeric
679 // value 1. In case it is 1, the function returns \a true, otherwise it returns \a false.
680 */
681 template< RelaxationFlag RF, typename MT >
isOne(const UpperProxy<MT> & proxy)682 inline bool isOne( const UpperProxy<MT>& proxy )
683 {
684    using blaze::isOne;
685 
686    return isOne<RF>( proxy.get() );
687 }
688 //*************************************************************************************************
689 
690 } // namespace blaze
691 
692 #endif
693