[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: octave 2.1.30 and example/make_int.cc
From: |
John W. Eaton |
Subject: |
Re: octave 2.1.30 and example/make_int.cc |
Date: |
Tue, 25 Apr 2000 01:29:37 -0500 (CDT) |
On 24-Apr-2000, address@hidden <address@hidden> wrote:
| However, I have two other questions things that are different
| in 2.1.30 than the last version I was using (2.1.19).
|
| 1. Previously, you could access global configuration
| variables with Vprefer_column_vectors. That no
| longer works.
|
| What is the new way to access global config vars?
You can still do that, I think, but Vprefer_column_vectors is now
static in ov.cc, so its scope is limited. Can you explain why you
need access to this particular variable?
| 2. vector_value() method seems to have changed.
|
| previously, I wrote
| ColumnVector a = args(1).vector_value();
|
| however 2.1.30 gives the following error
|
| make_sparse.cc: In function `class octave_value_list Fsplu(const class
octave_value_list &, int)':
| make_sparse.cc:1727: conversion from `Array<double>' to non-scalar type
`ColumnVector' requested
|
| I now have to write
| ColumnVector a = (const ColumnVector &) args(1).vector_value();
|
| it seems strange to have to cast a vector to a vector.
| Is there a new recommended method besides vector_value();
There are now column_vector_value and row_vector_value methods. The
vector_value method returns an Array<double> object, so it is not
intended to have an orientation.
You can either fix your code to use column_vector_value (if you want
to force the user to supply a column vector) or use
ColumnVector a (args(1).vector_value ());
if the row/column orientation of args(1) doesn't matter. You don't
need a cast (though the ColumnVector constructor does perform a type
conversion).
If you find yourself frequently using casts, it probably means that
you are taking the wrong approach. In the case above, you are casting
an Array<double> object to a ColumnVector object, which is derived
from MArray<double>, which is derived from Array<double>. Casting in
that direction is bad news if the derived class adds new data (you are
lucky here that ColumnVector and MArray<T> do not add new data
members, but that is not always the way things work).
jwe
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------
- User-defined Data Types, Rafael Laboissiere, 2000/04/21
- Re: User-defined Data Types, en254, 2000/04/23
- octave 2.1.30 and example/make_int.cc, en254, 2000/04/23
- Re: octave 2.1.30 and example/make_int.cc, Ben Sapp, 2000/04/24
- Re: octave 2.1.30 and example/make_int.cc, en254, 2000/04/24
- Re: octave 2.1.30 and example/make_int.cc,
John W. Eaton <=
- Re: octave 2.1.30 and example/make_int.cc, en254, 2000/04/25
- Re: octave 2.1.30 and example/make_int.cc, John W. Eaton, 2000/04/25
- Re: octave 2.1.30 and example/make_int.cc, en254, 2000/04/27
- octave 2.1.30 and example/make_int.cc, John W. Eaton, 2000/04/25