Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mcglm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leg
mcglm
Commits
3222d2a8
Commit
3222d2a8
authored
9 years ago
by
Walmes Marques Zeviani
Browse files
Options
Downloads
Patches
Plain Diff
Add roxygen tags and tidy
- Add @title, @name and @author. - Tidy the code and text.
parent
2b5a2762
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/mc_auxiliar.R
+15
-11
15 additions, 11 deletions
R/mc_auxiliar.R
with
15 additions
and
11 deletions
R/mc_auxiliar.R
+
15
−
11
View file @
3222d2a8
#' Matrix product in sandwich form
#' @title Matrix product in sandwich form
#' @name mc_sandwich
#' @author Wagner Hugo Bonat
#'
#' @description The function \code{mc_sandwich} is just an auxiliar function to compute product matrix
#' in the sandwich form bord1*middle*bord2. An special case appears when computing the derivative of
#' the covariance matrix with respect to the power parameter. Always the bord1 and bord2 should be
#' diagonal matrix. If it is not true, this product is too slow.
#' @description The function \code{mc_sandwich} is just an auxiliar
#' function to compute product matrix in the sandwich form
#' bord1*middle*bord2. An special case appears when computing the
#' derivative of the covariance matrix with respect to the power
#' parameter. Always the bord1 and bord2 should be diagonal
#' matrix. If it is not true, this product is too slow.
#'
#' @param middle A matrix.
#' @param bord1 A matrix.
#' @param bord2 A matrix.
#' @return The matrix product bord1*middle*bord2.
## Auxiliar function to multiply matrices
## Auxiliar function to multiply matrices
------------------------------
mc_sandwich
<-
function
(
middle
,
bord1
,
bord2
)
{
bord1
%*%
middle
%*%
bord2
}
#' @rdname mc_sandwich
#' @rdname mc_sandwich
-------------------------------------------------
mc_sandwich_negative
<-
function
(
middle
,
bord1
,
bord2
)
{
-
bord1
%*%
middle
%*%
bord2
}
#' @rdname mc_sandwich
#' @rdname mc_sandwich
-------------------------------------------------
mc_sandwich_power
<-
function
(
middle
,
bord1
,
bord2
)
{
temp1
<-
mc_sandwich
(
middle
=
middle
,
bord1
=
bord1
,
bord2
=
bord2
)
return
(
temp1
+
t
(
temp1
))
}
#' @rdname mc_sandwich
#' @rdname mc_sandwich
-------------------------------------------------
mc_sandwich_cholesky
<-
function
(
bord1
,
middle
,
bord2
)
{
p1
<-
bord1
%*%
middle
%*%
bord2
return
(
p1
+
t
(
p1
))
}
#' @rdname mc_sandwich
#' @rdname mc_sandwich
-------------------------------------------------
mc_multiply
<-
function
(
bord1
,
bord2
)
{
return
(
bord2
%*%
bord1
)
}
#' @rdname mc_sandwich
#' @rdname mc_sandwich
-------------------------------------------------
mc_multiply2
<-
function
(
bord1
,
bord2
)
{
return
(
bord1
%*%
bord2
)
}
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