Main Page
Namespaces
Classes
Files
File List
File Members
var
build
temp
tmp.niCloInx4p
4.0-0-0
coinor-ipopt
coinor-ipopt-3.10.2
Ipopt
contrib
MatlabInterface-Old
src
arrayofmatrices.h
Go to the documentation of this file.
1
// Copyright (C) 2007 Peter Carbonetto. All Rights Reserved.
2
// This code is published under the Eclipse Public License.
3
//
4
// Author: Peter Carbonetto
5
// Dept. of Computer Science
6
// University of British Columbia
7
// May 19, 2007
8
9
#ifndef INCLUDE_ARRAYOFMATRICES
10
#define INCLUDE_ARRAYOFMATRICES
11
12
#include "
array.h
"
13
#include "
matlabmatrix.h
"
14
#include "mex.h"
15
16
// Class ArrayOfMatrices.
17
// -----------------------------------------------------------------
18
class
ArrayOfMatrices
:
public
Array
<Matrix*> {
19
public
:
20
21
// This version of the constructor behaves just like its parent.
22
explicit
ArrayOfMatrices
(
int
length
)
23
:
Array
<
Matrix
*>(length) { };
24
25
// This constructor creates an array of matrices from a Matlab
26
// array. It accepts either a matrix in double precision, or a cell
27
// array with entries that are matrices.
28
explicit
ArrayOfMatrices
(
const
mxArray* ptr);
29
30
// This constructor creates an array of matrices from a collection
31
// of Matlab arrays. The Matlab arrays must be matrices.
32
ArrayOfMatrices
(
const
mxArray* ptrs[],
int
numptrs);
33
34
// This constructor creates an array of matrices and the
35
// associated Matlab structures. The Matlab structures are
36
// matrices. The second input argument acts as a template for the
37
// creation of the matrices, but the data from "model" is not
38
// actually copied into the new ArrayOfMatrices object. It is up
39
// to the user to make sure that the array of mxArray pointers has
40
// enough room for the pointers to the Matlab arrays.
41
ArrayOfMatrices
(mxArray* ptrs[],
const
ArrayOfMatrices
& model);
42
43
// This constructor creates an array of matrices using the second
44
// input argument as a model. The input argument "data" contains
45
// the element data. Note that the information is NOT copied from
46
// the model!
47
ArrayOfMatrices
(
double
* data,
const
ArrayOfMatrices
& model);
48
49
// The copy constructor makes a shallow copy of the source object.
50
ArrayOfMatrices
(
const
ArrayOfMatrices
& source);
51
52
// The destructor.
53
~ArrayOfMatrices
();
54
55
// Copy assignment operator that observes the same behaviour as
56
// the Array copy assignment operator.
57
ArrayOfMatrices
&
operator=
(
const
ArrayOfMatrices
& source);
58
59
// Copy the data from the location in memory pointed to by "source"
60
// to the matrices in the given order. It is assumed that the input
61
// points to a valid source of data.
62
void
inject
(
const
double
* source);
63
64
// Copy the elements from all the matrices to the location in
65
// memory pointed to by "dest". It is assumed that sufficient
66
// memory is allocated for the destination.
67
void
copyto
(
double
* dest)
const
;
68
69
// Returns true if the two objects have the exact same dimensions.
70
bool
operator==
(
const
ArrayOfMatrices
& a)
const
;
71
bool
operator!=
(
const
ArrayOfMatrices
& a)
const
72
{
return
!(*
this
== a); };
73
74
// Return the total number of elements in all the matrices.
75
int
numelems
()
const
;
76
77
protected
:
78
static
int
getnummatlabmatrices
(
const
mxArray* ptr);
79
};
80
81
#endif
Generated on Mon Mar 17 2014 19:49:12 by
1.8.1.2