Mercurial > hg > octave-nkf
comparison src/ov.cc @ 3419:e71b3d1dd327
[project @ 2000-01-12 05:23:34 by jwe]
author | jwe |
---|---|
date | Wed, 12 Jan 2000 05:23:37 +0000 |
parents | ca92c9d3f882 |
children | 996bb7ea4507 |
comparison
equal
deleted
inserted
replaced
3418:ca92c9d3f882 | 3419:e71b3d1dd327 |
---|---|
752 { | 752 { |
753 return rep->list_value (); | 753 return rep->list_value (); |
754 } | 754 } |
755 | 755 |
756 ColumnVector | 756 ColumnVector |
757 octave_value::column_vector_value (bool force_string_conv, | |
758 bool force_vector_conversion) const | |
759 { | |
760 ColumnVector retval; | |
761 | |
762 Matrix m = matrix_value (force_string_conv); | |
763 | |
764 if (error_state) | |
765 return retval; | |
766 | |
767 int nr = m.rows (); | |
768 int nc = m.columns (); | |
769 | |
770 if (nc == 1) | |
771 { | |
772 retval.resize (nr); | |
773 for (int i = 0; i < nr; i++) | |
774 retval (i) = m (i, 0); | |
775 } | |
776 else | |
777 { | |
778 string tn = type_name (); | |
779 gripe_invalid_conversion (tn.c_str (), "real column vector"); | |
780 } | |
781 | |
782 return retval; | |
783 } | |
784 | |
785 ComplexColumnVector | |
786 octave_value::complex_column_vector_value (bool force_string_conv, | |
787 bool force_vector_conversion) const | |
788 { | |
789 ComplexColumnVector retval; | |
790 | |
791 ComplexMatrix m = complex_matrix_value (force_string_conv); | |
792 | |
793 if (error_state) | |
794 return retval; | |
795 | |
796 int nr = m.rows (); | |
797 int nc = m.columns (); | |
798 | |
799 if (nc == 1) | |
800 { | |
801 retval.resize (nc); | |
802 for (int i = 0; i < nc; i++) | |
803 retval (i) = m (i, 0); | |
804 } | |
805 else | |
806 { | |
807 string tn = type_name (); | |
808 gripe_invalid_conversion (tn.c_str (), "complex column vector"); | |
809 } | |
810 | |
811 return retval; | |
812 } | |
813 | |
814 RowVector | |
815 octave_value::row_vector_value (bool force_string_conv, | |
816 bool force_vector_conversion) const | |
817 { | |
818 RowVector retval; | |
819 | |
820 Matrix m = matrix_value (force_string_conv); | |
821 | |
822 if (error_state) | |
823 return retval; | |
824 | |
825 int nr = m.rows (); | |
826 int nc = m.columns (); | |
827 | |
828 if (nr == 1) | |
829 { | |
830 retval.resize (nc); | |
831 for (int i = 0; i < nc; i++) | |
832 retval (i) = m (0, i); | |
833 } | |
834 else | |
835 { | |
836 string tn = type_name (); | |
837 gripe_invalid_conversion (tn.c_str (), "real row vector"); | |
838 } | |
839 | |
840 return retval; | |
841 } | |
842 | |
843 ComplexRowVector | |
844 octave_value::complex_row_vector_value (bool force_string_conv, | |
845 bool force_vector_conversion) const | |
846 { | |
847 ComplexRowVector retval; | |
848 | |
849 ComplexMatrix m = complex_matrix_value (force_string_conv); | |
850 | |
851 if (error_state) | |
852 return retval; | |
853 | |
854 int nr = m.rows (); | |
855 int nc = m.columns (); | |
856 | |
857 if (nr == 1) | |
858 { | |
859 retval.resize (nc); | |
860 for (int i = 0; i < nc; i++) | |
861 retval (i) = m (0, i); | |
862 } | |
863 else | |
864 { | |
865 string tn = type_name (); | |
866 gripe_invalid_conversion (tn.c_str (), "complex row vector"); | |
867 } | |
868 | |
869 return retval; | |
870 } | |
871 | |
872 // Sloppy... | |
873 | |
874 Array<double> | |
757 octave_value::vector_value (bool force_string_conv, | 875 octave_value::vector_value (bool force_string_conv, |
758 bool force_vector_conversion) const | 876 bool force_vector_conversion) const |
759 { | 877 { |
760 ColumnVector retval; | 878 Array<double> retval; |
761 | 879 |
762 Matrix m = matrix_value (force_string_conv); | 880 Matrix m = matrix_value (force_string_conv); |
763 | 881 |
764 if (error_state) | 882 if (error_state) |
765 return retval; | 883 return retval; |
795 } | 913 } |
796 | 914 |
797 return retval; | 915 return retval; |
798 } | 916 } |
799 | 917 |
800 ComplexColumnVector | 918 Array<Complex> |
801 octave_value::complex_vector_value (bool force_string_conv, | 919 octave_value::complex_vector_value (bool force_string_conv, |
802 bool force_vector_conversion) const | 920 bool force_vector_conversion) const |
803 { | 921 { |
804 ComplexColumnVector retval; | 922 Array<Complex> retval; |
805 | 923 |
806 ComplexMatrix m = complex_matrix_value (force_string_conv); | 924 ComplexMatrix m = complex_matrix_value (force_string_conv); |
807 | 925 |
808 if (error_state) | 926 if (error_state) |
809 return retval; | 927 return retval; |