Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dseries
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dseries
Commits
c604cefb
Verified
Commit
c604cefb
authored
Sep 10, 2019
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
remove unnecessary assignments from dseries constructor
parent
3681da09
No related branches found
No related tags found
No related merge requests found
Pipeline
#1787
passed with warnings
Sep 10, 2019
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/@dseries/dseries.m
+3
-31
3 additions, 31 deletions
src/@dseries/dseries.m
with
3 additions
and
31 deletions
src/@dseries/dseries.m
+
3
−
31
View file @
c604cefb
...
@@ -50,12 +50,6 @@ methods
...
@@ -50,12 +50,6 @@ methods
switch
nargin
switch
nargin
case
0
case
0
% Return empty object.
% Return empty object.
o
.
data
=
[];
o
.
name
=
{};
o
.
tex
=
{};
o
.
dates
=
dates
();
o
.
ops
=
{};
o
.
tags
=
struct
();
return
return
case
1
case
1
if
isdates
(
varargin
{
1
})
if
isdates
(
varargin
{
1
})
...
@@ -64,24 +58,14 @@ methods
...
@@ -64,24 +58,14 @@ methods
error
(
'dseries:WrongInputArguments'
,
'Input (identified as a dates object) must be non empty!'
);
error
(
'dseries:WrongInputArguments'
,
'Input (identified as a dates object) must be non empty!'
);
case
1
case
1
% Create an empty dseries object with an initial date.
% Create an empty dseries object with an initial date.
o
.
data
=
[];
o
.
name
=
{};
o
.
tex
=
{};
o
.
dates
=
varargin
{
1
};
o
.
dates
=
varargin
{
1
};
o
.
ops
=
{};
o
.
tags
=
struct
();
otherwise
otherwise
error
(
'dseries:WrongInputArguments'
,
'Input (identified as a dates object) must have a unique element!'
);
error
(
'dseries:WrongInputArguments'
,
'Input (identified as a dates object) must have a unique element!'
);
end
end
return
return
elseif
ischar
(
varargin
{
1
})
elseif
ischar
(
varargin
{
1
})
[
init
,
data
,
varlist
,
tex
,
ops
,
tags
]
=
load_data
(
varargin
{
1
});
[
init
,
o
.
data
,
o
.
name
,
o
.
tex
,
o
.
ops
,
o
.
tags
]
=
load_data
(
varargin
{
1
});
o
.
data
=
data
;
o
.
name
=
varlist
;
o
.
dates
=
init
:
init
+
(
nobs
(
o
)
-
1
);
o
.
dates
=
init
:
init
+
(
nobs
(
o
)
-
1
);
o
.
tex
=
tex
;
o
.
ops
=
ops
;
o
.
tags
=
tags
;
elseif
~
isoctave
()
&&
~
matlab_ver_less_than
(
'8.2'
)
&&
istable
(
varargin
{
1
})
elseif
~
isoctave
()
&&
~
matlab_ver_less_than
(
'8.2'
)
&&
istable
(
varargin
{
1
})
% It is assumed that the dates are in the first column.
% It is assumed that the dates are in the first column.
o
.
name
=
varargin
{
1
}
.
Properties
.
VariableNames
(
2
:
end
);
o
.
name
=
varargin
{
1
}
.
Properties
.
VariableNames
(
2
:
end
);
...
@@ -89,14 +73,12 @@ methods
...
@@ -89,14 +73,12 @@ methods
o
.
data
=
varargin
{
1
}{:,
2
:
end
};
o
.
data
=
varargin
{
1
}{:,
2
:
end
};
o
.
dates
=
dates
(
varargin
{
1
}{
1
,
1
}{
1
})
+
(
0
:
size
(
varargin
{
1
},
1
)
-
1
);
o
.
dates
=
dates
(
varargin
{
1
}{
1
,
1
}{
1
})
+
(
0
:
size
(
varargin
{
1
},
1
)
-
1
);
o
.
ops
=
cell
(
length
(
o
.
name
),
1
);
o
.
ops
=
cell
(
length
(
o
.
name
),
1
);
o
.
tags
=
struct
();
elseif
isnumeric
(
varargin
{
1
})
&&
isequal
(
ndims
(
varargin
{
1
}),
2
)
elseif
isnumeric
(
varargin
{
1
})
&&
isequal
(
ndims
(
varargin
{
1
}),
2
)
o
.
data
=
varargin
{
1
};
o
.
data
=
varargin
{
1
};
o
.
name
=
default_name
(
vobs
(
o
));
o
.
name
=
default_name
(
vobs
(
o
));
o
.
tex
=
name2tex
(
o
.
name
);
o
.
tex
=
name2tex
(
o
.
name
);
o
.
dates
=
dates
(
1
,
1
):
dates
(
1
,
1
)
+
(
nobs
(
o
)
-
1
);
o
.
dates
=
dates
(
1
,
1
):
dates
(
1
,
1
)
+
(
nobs
(
o
)
-
1
);
o
.
ops
=
cell
(
length
(
o
.
name
),
1
);
o
.
ops
=
cell
(
length
(
o
.
name
),
1
);
o
.
tags
=
struct
();
elseif
isstruct
(
varargin
{
1
})
elseif
isstruct
(
varargin
{
1
})
o
=
struct2dseries
(
varargin
{
1
});
o
=
struct2dseries
(
varargin
{
1
});
end
end
...
@@ -105,26 +87,16 @@ methods
...
@@ -105,26 +87,16 @@ methods
% Instantiate dseries object with a data file and force the initial date to
% Instantiate dseries object with a data file and force the initial date to
% be as given by the second input argument (initial period represented
% be as given by the second input argument (initial period represented
% with a dates object).
% with a dates object).
[
~
,
data
,
varlist
,
tex
,
ops
,
tags
]
=
load_data
(
varargin
{
1
});
[
~
,
o
.
data
,
o
.
name
,
o
.
tex
,
o
.
ops
,
o
.
tags
]
=
load_data
(
varargin
{
1
});
o
.
data
=
data
;
o
.
name
=
varlist
;
o
.
dates
=
varargin
{
2
}:
varargin
{
2
}
+
(
nobs
(
o
)
-
1
);
o
.
dates
=
varargin
{
2
}:
varargin
{
2
}
+
(
nobs
(
o
)
-
1
);
o
.
tex
=
tex
;
o
.
ops
=
ops
;
o
.
tags
=
tags
;
return
return
end
end
if
isequal
(
nargin
,
2
)
&&
ischar
(
varargin
{
1
})
&&
ischar
(
varargin
{
2
})
&&
isdate
(
varargin
{
2
})
if
isequal
(
nargin
,
2
)
&&
ischar
(
varargin
{
1
})
&&
ischar
(
varargin
{
2
})
&&
isdate
(
varargin
{
2
})
% Instantiate dseries object with a data file and force the initial date to
% Instantiate dseries object with a data file and force the initial date to
% be as given by the second input argument (initial period represented with a
% be as given by the second input argument (initial period represented with a
% string).
% string).
[
~
,
data
,
varlist
,
tex
,
ops
,
tags
]
=
load_data
(
varargin
{
1
});
[
~
,
o
.
data
,
o
.
name
,
o
.
tex
,
o
.
ops
,
o
.
tags
]
=
load_data
(
varargin
{
1
});
o
.
data
=
data
;
o
.
name
=
varlist
;
o
.
dates
=
dates
(
varargin
{
2
}):
dates
(
varargin
{
2
})
+
(
nobs
(
o
)
-
1
);
o
.
dates
=
dates
(
varargin
{
2
}):
dates
(
varargin
{
2
})
+
(
nobs
(
o
)
-
1
);
o
.
tex
=
tex
;
o
.
ops
=
ops
;
o
.
tags
=
tags
;
return
return
end
end
a
=
varargin
{
1
};
a
=
varargin
{
1
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment