comparison src/data.cc @ 7093:e5005117103d

[project @ 2007-10-31 23:41:37 by jwe]
author jwe
date Wed, 31 Oct 2007 23:41:37 +0000
parents 405cf85b435c
children a627f27c1e8e
comparison
equal deleted inserted replaced
7092:62930dfd99fd 7093:e5005117103d
2682 else if (x_arg.ndims () == 2) 2682 else if (x_arg.ndims () == 2)
2683 { 2683 {
2684 if ((x_arg.rows () == 1 || x_arg.columns () == 1) 2684 if ((x_arg.rows () == 1 || x_arg.columns () == 1)
2685 && ! (x_arg.is_sparse_type () || x_arg.is_integer_type ())) 2685 && ! (x_arg.is_sparse_type () || x_arg.is_integer_type ()))
2686 { 2686 {
2687 double p_val; 2687 double p_val = 2;
2688 2688
2689 octave_value p_arg; 2689 if (nargin == 2)
2690
2691 if (nargin == 1)
2692 p_arg = 2;
2693 else
2694 p_arg = args(1);
2695
2696 if (p_arg.is_string ())
2697 { 2690 {
2698 std::string p = args(1).string_value (); 2691 octave_value p_arg = args(1);
2699 2692
2700 if (p == "inf") 2693 if (p_arg.is_string ())
2701 p_val = octave_Inf; 2694 {
2702 else if (p == "fro") 2695 std::string p = args(1).string_value ();
2703 p_val = -1; 2696
2697 if (p == "inf")
2698 p_val = octave_Inf;
2699 else if (p == "fro")
2700 p_val = -1;
2701 else
2702 error ("norm: unrecognized norm `%s'", p.c_str ());
2703 }
2704 else 2704 else
2705 error ("norm: unrecognized norm `%s'", p.c_str ()); 2705 {
2706 } 2706 p_val = p_arg.double_value ();
2707 else 2707
2708 { 2708 if (error_state)
2709 p_val = p_arg.double_value (); 2709 error ("norm: unrecognized norm value");
2710 2710 }
2711 if (error_state)
2712 error ("norm: unrecognized norm value");
2713 } 2711 }
2714 2712
2715 if (! error_state) 2713 if (! error_state)
2716 { 2714 {
2717 if (x_arg.is_real_type ()) 2715 if (x_arg.is_real_type ())