search for: dmat

Displaying 18 results from an estimated 18 matches for "dmat".

Did you mean: dma
2003 Jun 02
Help with factorized argument in solve.QP
...orized" argument in solve.QP (part of the quadprog library) to work as expected. The helpfile states that when the factorized argument is set to TRUE, then the function requires the inverse of a square-root factor of the Hessian instead of the Hessian itself. That is, when factorized=TRUE, the Dmat argument should be a matrix R^(-1), such that the Hessian of the objective function is t(R) %*% R. I modified the example in the helpfile slightly to test this out: R = matrix(rnorm(9),3,3) R.inv = solve(R) Dmat = t(R) %*% R dvec = c(0,5,0) Amat = matrix(c(-4,-3,...
2005 Jan 13
how to use solve.QP
...= bvec and [bLo=0 <= w #<=1=bUp] to Amat <- rbind(-1, 1, -mu, mu) dim(bLo) <- c(n,1) dim(bUp) <- c(n,1) bvec <- rbind(-1, 1,, Inf, bLo, -bUp) zMat <- matrix(rep(0,2*n*n),ncol=n, nrow=n*2) zMat[,1] <- c(rep(1,n), rep(-1,n)) Amat <- t(rbind(Amat, zMat)) #So I set Dmat=Cov and set dvec=0 Dmat=Cov dvec=rep(0, nrow(Amat)) #The first two rows of Amat should be equality constraints (so weights sum to 1) meq <- 2 sol <- solve.QP(Dmat=Dmat, dvec=dvec, Amat=Amat, bvec=bvec, meq) sol
2009 Feb 16
solve.QP with box and equality constraints
...positive and negative values within the constraint matrix (, but when I pass this expanded constraint matrix to solve.QP it complains that Amat and dvec are incompatible. How should I expand dvec (and consequently Dmat) to accomodate the larger Amat? Moreover, I am unclear how to apply the meq equality constraint across more than one cell (i.e. rows summing to one) although I have attempted a guess below. Any help warmly received. Selwyn. ################ #examples below ################ library(quadprog) #pai...
2010 Dec 04
Quadratic programming with semi-definite matrix
Hello. I'm trying to solve a quadratic programming problem of the form min ||Hx - y||^2 s.t. x >= 0 and x <= t using solve.QP in the quadprog package but I'm having problems with Dmat not being positive definite, which is kinda okay since I expect it to be numerically semi-definite in most cases. As far as I'm aware the problem arises because the Goldfarb and Idnani method first solves the unconstrained problem requiring a positive definite matrix. Are there any (fast) packa...
2003 Apr 03
Matrix eigenvectors in R and MatLab
...0.4348802 %Matlab Matrix PA9900 =[11/24 10/53 0/1 0/1 29/43 ;1/24 27/53 0/1 0/1 13/43 ;14/24 178/53 146/244 17/23 15/43 ;2/24 4/53 0/1 2/23 2/43 ;4/24 58/53 26/244 0/1 5/43] %MatLab-syntax [wmat,dmat]=eig(mat) %MatLab-output wmat = -0.2250 0.4330 -0.4998 -0.1795 -0.1854 -0.1083 0.1771 0.1599 -0.0614 -0.0583 -0.9403 -0.7191 -0.8457 0.9617 0.9708 -0.0327 -0.0752 -0.0967 -0.1750 -0.1160 -0.2289 -0.5083 0.0058 0.0928 0.0802 dmat =...
2010 Dec 06
use pcls to solve least square fitting with constraints
Hi, I have a least square fitting problem with linear inequality constraints. pcls seems capable of solving it so I tried it, unfortunately, it is stuck with the following error: > M <- list() > M$y = Dmat[,1] > M$X = Cmat > M$Ain = as.matrix(Amat) > M$bin = rep(0, dim(Amat)[1]) > M$p=qr.solve(as.matrix(Cmat), Dmat[,1]) > M$w = rep(1, length(M$y)) > M$C = matrix(0,0,0) > p<-pcls(M) Error in t(qr.qty(qra, t(M$X))[(j + 1):k, ]) : error in evaluating the argument 'x' in...
2006 Nov 08
Solving a maximization problem using QUADPROD
...roblem into maximization problem, i.e. -(0 5 0) %*% b - 1/2 b^T b? # Assume we want to minimize: -(0 5 0) %*% b + 1/2 b^T b # under the constraints: A^T b >= b0 # with b0 = (-8,2,0)^T # and (-4 2 0) # A = (-3 1 -2) # ( 0 0 1) # we can use solve.QP.compact as follows: # library(quadprog) Dmat <- matrix(0,3,3) diag(Dmat) <- 1 dvec <- c(0,5,0) Aind <- rbind(c(2,2,2),c(1,1,2),c(2,2,3)) Amat <- rbind(c(-4,2,-2),c(-3,1,1)) bvec <- c(-8,2,0) solve.QP.compact(Dmat,dvec,Amat,Aind,bvec=bvec) Thanks, Serguei
2004 Sep 01
not positive definite D matrix in quadprog
...anges too much D.vectors%*%D.quad%*%ginv(D.vectors) #now all eigenvalues are positive: <- eigen(D.vectors%*%D.quad%*%ginv(D.vectors),only.values=F)$values [1] 4.609489e+04 2.458166e+03 8.232288e+01 1.961199e+00 5.976441e-01 [6] 2.810968e-01 1.253140e-09 1.428534e-12 Dmat <- D.vectors%*%D.quad%*%ginv(D.vectors) dvec <- -c(-2910.533769,-2905.609008,-3012.223863,-16274.97455,-17222.46423,-18380.6 391,-357.8878464,-379.6371849) #this ensures that coefficients are positive: Amat <- matrix(0,8,8) diag(Amat) <- 1 bvec <- rep(0,8) #it says D is not pos...
2005 Nov 29
Constraints in Quadprog
I'm having difficulty figuring out how to implement the following set of constraints in Quadprog: 1). x1+x2+x3+x4=a1 2). x1+x2+x5+x6=a2 3). x1+x3+x5+x7=a3 4). x1+x2=b1 5). x1+x3=b2 6). x1+x5=b3 for the problem: MIN (x1-c1)2+(x2-c2)2+...+(x8-c8)2. As far a I understand, "solve.QP(Dmat, dvec, Amat, bvec, meq=0, factorized=FALSE)" reads contraints using an element-by-element multiplication, i.e. Amat'*x, not using the matrix-product, i.e. Amat'%*%x, required for the sums on the left-hand-side of 1-6). I would very much appreciate a suggestion on this problem. Thank...
2009 Jun 01
survreg.distributions() error
...down to a single line in the function. This function defines another function derfun() whose first few lines look like this: derfun <- function(y, eta, sigma, density, parms) { ny <- ncol(y) status <- y[, ny] z <- (y[, 1] - eta)/sigma dmat <- density(z, parms) ## line A: THIS COMMAND DOES NOT GIVE AN ERROR dtemp <- dmat[, 3] * dmat[, 4] if (any(status == 3)) { z2 <- (y[, 2] - eta)/sigma dmat2 <- density(z2) ## line B: THIS IS THE COMMAND THAT GIVES THE ERROR }...
2008 Jan 25
How to execute R code
...I have 'R' code in file. saved it as exmaple.r here is the code....... library("hopach") GSE <- read.table("gene_expression_data",sep="\t",header=TRUE,row.names=TRUE) gene.dist <- distancematrix(t(GSE),d="euclid") gene.hobj <- hopach(t(GSE), dmat=gene.dist, mss="med") labelstosil(gene.hobj$cluster$label,gene.dist) I dont know how to run it on linux terminal. Can you tell me how to execute this file. I am using Debian linux. Regards, Praeek Singh -- Prateek Singh Final year Bioinformatics(BTech) Vellore Institute Of Technology...
2012 Mar 16
quadprog error?
...ried to contact Berwin A. Turlach <Berwin.Turlach at> (maintainer for quadprog package) a week ago, with no success. ############################################################## load(file='quadprog.Rdata') # solve QP using quadprog require(quadprog) sol = solve.QP(Dmat, dvec, Amat, bvec, meq) x = sol$solution check = x %*% Amat - bvec # for some reason last equality constraint is violated round(check[1:meq], 4) # solve QP using kernlab require(kernlab) n = nrow(Amat) sv = ipop(c = matrix(dvec), H = Dmat, A = t(Amat[,1:meq]), b = bvec[1:meq], l...
2013 Jun 11
'Boolean Index too long'
...bsites$Site) #mzbdist being a distance object (Bray-Curtis similarity matrix) derived from my sqrt transformed community data set, created with function 'vegdist', mzbsites$Site refers to factors structuring my community. #when I run this code, I get the following error message: error in dmat[ind == x, ind == x] : (subscript) boolean index too long #What does that mean? How can I solve this problem? #thanks a lot for your help, #Claudia [[alternative HTML version deleted]]
2011 Oct 24
...NotEstablished ActiveRecord::ConnectionNotEstablished Rails.root: /home/ralph/railsprojects/sample_app Application Trace | Framework Trace | Full Trace The routes and controller erb don''t appear to have any errors. Is this a database related error? Any ideas? Thanks, DMAT -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/ To unsubscribe from this group, send email to rubyonrails-talk+unsubs...
2008 Apr 14
Vegan R^2 and tau values for metaMDS
I am using the function metaMDS with jaccard distances to ordinate a set of constituent by site matrix. I can post this data if it would be helpful, but it is large to include in an email. I can also provide reproducable code if necessary. I would like to get an R^2 value for the axes of the ordination configuration that I get with metaMDS in the vegan package is there a way to do this- is it
2007 Jul 11
Some questions about quadratic programming (QP)
...any argument for that? 3- In QP formulation we have a constant 1/2 in objective function. This should be multiplied by the user or it is done by the algorithm? 4- More important, when I multiply a b*b matrix by D in quadratic term of objective function, I get thise message: Error in solve.QP(Dmat, dvec, Amat, bvec) : matrix D in quadratic function is not positive definite! How to multiply b*b matrix by the diagonal matrix ? Thank you very much for any help. Amir --------------------------------- Park yourself in front of a world of choices in alternative vehicles....
2007 Dec 22
regarding lack of quadratic term in solve.qp
I was thinking about my solve.qp problem on my way home tonight and I think I can fix it by making Dmat the identity matrix. I'll check this weekend to make sure but my thinking is that doing this will make all the "variances" the same so that they shouldn't come into play during the evaluation of the objective function. Thanks though for any confirmation of this or other ideas....
2008 Feb 21
prototype.js hangs page load when included in an HTML page
I have a simple HTML page - stripped everything possible from it. No javascript is invoked (e.g. body onLoad) when the page is loaded I''ve included the new prototype.1.6.0 (and tried in my html page. When I load the page - the browser will render the html content - but the page continues to load - without ever finishing. This is a problem because the code I want to execute in