1 /*
2
3 Copyright (C) 2014, The University of Texas at Austin
4
5 This file is part of libflame and is available under the 3-Clause
6 BSD license, which can be found in the LICENSE file at the top-level
7 directory, or at http://opensource.org/licenses/BSD-3-Clause
8
9 */
10
11 #include "FLAME.h"
12
FLA_Norm1(FLA_Obj A,FLA_Obj norm)13 FLA_Error FLA_Norm1( FLA_Obj A, FLA_Obj norm )
14 {
15 FLA_Obj AL, AR, A0, a1, A2;
16
17 FLA_Obj b;
18 FLA_Obj bL, bR, b0, beta1, b2;
19
20 if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
21 FLA_Norm1_check( A, norm );
22
23 FLA_Obj_create( FLA_Obj_datatype( A ), 1, FLA_Obj_width( A ), 0, 0, &b );
24
25 FLA_Part_1x2( A, &AL, &AR, 0, FLA_LEFT );
26
27 FLA_Part_1x2( b, &bL, &bR, 0, FLA_LEFT );
28
29 while ( FLA_Obj_width( AL ) < FLA_Obj_width( A ) ){
30
31 FLA_Repart_1x2_to_1x3( AL, /**/ AR, &A0, /**/ &a1, &A2,
32 1, FLA_RIGHT );
33
34 FLA_Repart_1x2_to_1x3( bL, /**/ bR, &b0, /**/ &beta1, &b2,
35 1, FLA_RIGHT );
36
37 /*------------------------------------------------------------*/
38
39 FLA_Asum( a1, beta1 );
40
41 /*------------------------------------------------------------*/
42
43 FLA_Cont_with_1x3_to_1x2( &AL, /**/ &AR, A0, a1, /**/ A2,
44 FLA_LEFT );
45
46 FLA_Cont_with_1x3_to_1x2( &bL, /**/ &bR, b0, beta1, /**/ b2,
47 FLA_LEFT );
48 }
49
50 FLA_Max_abs_value( b, norm );
51
52 FLA_Obj_free( &b );
53
54 return FLA_SUCCESS;
55 }
56
57