Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[63c6c6]: ov-vpa.h Maximize Restore History

Download this file

ov-vpa.h    126 lines (86 with data), 2.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
Copyright (C) 2000 Benjamin Sapp
This is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You can have receive a copy of the GNU General Public License. Write
to the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#if !defined (octave_vpa_h)
#define octave_vpa_h 1
// GiNaC
#include <ginac/ginac.h>
class Octave_map;
class octave_value_list;
class tree_walker;
void install_vpa_type();
void install_vpa_ops();
// vpa values.
class
octave_vpa : public octave_base_value
{
public:
octave_vpa (void):octave_base_value()
{
scalar = GiNaC::numeric(0);
}
octave_vpa (int i):octave_base_value()
{
scalar = GiNaC::numeric(0);
}
octave_vpa (const octave_vpa& s):octave_base_value()
{
scalar = s.scalar;
}
octave_vpa (const GiNaC::numeric& s):octave_base_value()
{
scalar = s;
}
octave_vpa( const GiNaC::ex& x):octave_base_value()
{
scalar = GiNaC::ex_to_numeric(x);
}
~octave_vpa (void) { }
octave_value *clone (void) { return new octave_vpa (*this); }
#if 0
void *operator new (size_t size);
void operator delete (void *p, size_t size);
#endif
int rows (void) const { return 1; }
int columns (void) const { return 1; }
bool is_constant (void) const { return true; }
bool is_defined (void) const { return true; }
bool is_real_scalar (void) const { return true; }
octave_value all (void) const { return (double) (scalar != 0); }
octave_value any (void) const { return (double) (scalar != 0); }
bool is_real_type (void) const { return true; }
bool is_scalar_type (void) const { return true; }
bool is_vpa_type (void) const { return true; }
bool valid_as_scalar_index (void) const
{ return scalar == 1; }
bool valid_as_zero_index (void) const
{ return scalar == 0; }
bool is_true (void) const { return (scalar != 0); }
double double_value (bool = false) const { return scalar.to_double(); }
GiNaC::numeric vpa_value (bool = false) const { return scalar; }
octave_value hermitian (void) const { return new octave_vpa (scalar); }
void increment (void) { ++scalar; }
void decrement (void) { --scalar; }
void print (ostream& os, bool pr_as_read_syntax = false) const;
private:
GiNaC::numeric scalar;
DECLARE_OCTAVE_ALLOCATOR
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
};
#endif
/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/