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 FLASH_Norm1(FLA_Obj H,FLA_Obj norm)13FLA_Error FLASH_Norm1( FLA_Obj H, FLA_Obj norm ) 14 { 15 FLA_Obj F; 16 17 // Exit early if one dimension is zero. 18 if ( FLA_Obj_has_zero_dim( H ) ) 19 { 20 FLA_Set( FLA_ZERO, norm ); 21 return FLA_SUCCESS; 22 } 23 24 // Create a temporary flat copy of the hierarchical object. 25 FLASH_Obj_create_flat_copy_of_hier( H, &F ); 26 27 // Compute the 1-norm of F and store it in norm. 28 FLA_Norm1( F, norm ); 29 30 // Free the temporary flat object. 31 FLA_Obj_free( &F ); 32 33 return FLA_SUCCESS; 34 } 35 36