search for: setlength

Displaying 20 results from an estimated 37 matches for "setlength".

2005 Sep 04
1
A memory management question
Can someone explain the use of SETLENGTH() and SETTRUELENGTH()? I would like to allocate a vector and reserve some space at the end, so that it appears shorter than the allocated size. So that I can more efficiently append to the vector, without requiring a new copy every time. So I'd like to use SETLENGTH() with a shorter apparent...
2011 Jan 17
1
isoreg memory leak?
...isoreg(x,y) + } > rm(x) > rm(y) > gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 121637 3.3 350000 9.4 350000 9.4 Vcells 578615 4.5 1300721 10.0 1300642 10.0 ^^^ Looking at the C code, I believe the problem arises as a consequence of using SETLENGTH to resize the result near the very end of isoreg.c, and the solution is to make a copy of iKnots. SEXP R_isoreg(SEXP y) { int n = LENGTH(y), i, ip, known, n_ip; double tmp, slope; SEXP yc, yf, iKnots, ans; const char *anms[] = {"y", "yc", "yf", &q...
2018 May 04
2
Debugging "SETLENGTH() cannot be applied to an ALTVEC object."?
...rg/incoming_pretest/ heatmaply_0.15.0_20180502_082353/Windows/00check.log> Status: OK Debian: <https://win-builder.r-project.org/incoming_pretest/ heatmaply_0.15.0_20180502_082353/Debian/00check.log> Status: 1 ERROR, 1 WARNING Looking at the errors I get, they are all of the type: "SETLENGTH() cannot be applied to an ALTVEC object." I assume this is somehow related to changes in R 3.5.0 (maybe related to this <https://github.com/wch/r-source/commit/0ba66a2bc236ae5b009af910688575aa4adddd2c>?), but I'm not sure how to debug it (as I don't have this environment set-up),...
2007 Apr 11
0
Problem with speex
...; buffDec: array of single; encstate := speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); speex_encoder_ctl(encstate,SPEEX_SET_SAMPLING_RATE,@smpRt); speex_encoder_ctl(encstate,SPEEX_SET_QUALITY,@n); speex_encoder_ctl(encstate,SPEEX_GET_FRAME_SIZE,@encframe); speex_bits_init(@encbits); SetLength(buffEnc,encframe); enh:=0; speex_bits_init(@decbits); decstate := speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); speex_decoder_ctl(decstate,SPEEX_GET_FRAME_SIZE,@decframe); speex_decoder_ctl(decstate,SPEEX_SET_ENH,@enh); SetLength(buffDec,decframe); Encode: s3:string; for j:=0 to e...
2017 Nov 21
1
Truncating vectors by reference in C-backend
Dear all, I want to create a function shrinkVector(x) that takes x and truncates it to the first element without copy. With SETLENGTH and SET_TRUELENGTH, I can achieve that. You can find a reproducible example below. But the memory that was freed is not available for other objects afterwards, except if x is a list (VECSXP). Any suggestions? library(inline) ## define the shrinking function shrinkVector <- cfunction(signatur...
2002 Nov 13
1
Package documentation and rd.sty
Hi all, I've got a basic question regarding package documentation and rd.sty. I wrote my first own package, and now I would like to place the documentation into the appendix of another LaTex document. Seemingly I cannot simply \usepackage{Rd}, as this will modify the page-settings of my document. Is there a minimum style file which will just define the environments and commands needed for
2004 Oct 21
1
Arrow heads at the end of axes
...is not supposed to be numbers on the axes. An imperfect example: plot(rnorm(10),bty='l',xaxt='n',yaxt='n',ylab='',xlab='',type='l') abline(h=0) Like this but without, the xaxis and with arrrowheads More like this in fact, LaTeX Picture example: \setlength{\unitlength}{1.3cm} \begin{picture}(4.3,3.6)(-2.5,-0.25) \put(-2,1.8){\vector(1,0){4.4}} \put(2.5,1.7){$x$} \put(-2,0){\vector(0,1){3.2}} \put(-2,3.35){\makebox(0,0){$y$}} \end{picture} --------------------------------------------- Henrik Andersson Netherlands Institute of Ecology - Centre for Est...
2010 May 11
1
Table and Sweave
Hi, in Latex I get the table using: \begin{table}[H] \centering \renewcommand{\arraystretch}{1.3} \setlength{\tabcolsep}{18pt} \begin{tabular}{cc} \hline Idade & Frequ?ncia \\ \hline $18 \vdash 26$ & 11 \\ $26 \vdash 34$ & 8 \\ $34 \vdash 42$ & 26 \\ $42 \vdash 50$ & 20 \\ $50 \vdash 58$ & 23 \\ $58 \vdash 66$ & 30 \\ $66 \vdash 74$ &a...
2002 Jul 12
0
Problem with checksums
...if (PageHeader.CapturePattern <> 'OggS') then raise Exception.Create('Not a valid Ogg stream'); if PageHeader.StreamStructureVersion <> 0 then raise Exception.CreateFmt('Not a valid stream structure version: %d', [PageHeader.StreamStructureVersion]); SetLength(PageHeader.SegmentTable, PageHeader.PageSegments); InStream.Read(Pointer(PageHeader.SegmentTable)^, PageHeader.PageSegments); PageHeader.PageBodyLength := SumByte(PageHeader.SegmentTable); SetLength(PageBody, PageHeader.PageBodyLength); InStream.Read(Pointer(PageBody)^, PageHeader.PageBodyL...
2005 Oct 24
2
R_MakeExternalPtr
...p, LENGTH(sexp) returns some quite large integer value. It seems like an "unitialized" value. Can I safely assume, that an SEXP of type EXTPTRSXP can only contain a single pointer value and never represent a vector (an array) of pointers? Or should I maybe explicitly add something like SETLENGTH(sexp,1); Best wishes from sunny Austria, Thomas Baier
2011 Apr 09
1
Trouble with Sweave and Beamer
...[onlylarge]{structurebold} \setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries} \setbeamertemplate{navigation symbols}{} % Standard packages \usepackage[english]{babel} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{Sweave} % The main document \begin{document} \setlength{\unitlength}{\textwidth} % measure in textwidths \begin{frame}[t]{Data Representation and Analysis} <<echo=TRUE>>= x <- rnorm(100) xm <- mean(x) xm @ \end{frame}
2009 Jun 14
1
Centering graphics by default in Sweave
Is there an elegant way to get Sweave to center graphics by default? I'd like to use \centerline{\includegraphics{}} etc. to save some vertical space that \begin{center} ... \end{center} uses, and I'd like to avoid centering with each <<fig=T>>= Thanks Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of
2007 Jul 24
1
Custom kinit to find device by "label"
...ated into C: function FindRootDeviceByLabel(const RootFSLabel: string): boolean; const DEV_MAJOR: dev_t = 8; DEV_MODE: mode_t = S_IFBLK or &0660; var ActualFSLabel: string; FileDescriptor: cint; ReadBytes: TsSize; DeviceFound: boolean; dev_minor: dev_t; begin Result := False; SetLength(ActualFSLabel, Length(RootFSLabel)); //loop through all devices that might have our root filesystem sda2 to sdp2 dev_minor := 2; while dev_minor < 243 do begin // last one is 242 if mknod(DEVICENAME, DEV_MODE, (DEV_MAJOR shl 8) or dev_minor) = 0 then begin WriteLn('Creat...
2012 May 25
1
knitr customization
...ntinuation sign '+'? (This is for an introductory presentation in which I want to show people exactly what they are going to see on their screen.) Oops, one more... How can I change the spacing between regular text and R code (input/output)? With Sweave I would do \fvset{listparameters={\setlength{\topsep}{0pt}}} \renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}} Sorry for the many questions and thank you in advance for any help and insight you can give me. Best, Giovanni -- Giovanni Petris <GPetris at uark.edu> Associate Professor Department of Mathematical Sciences...
2010 Jul 13
1
latex table question
...le,verbatim} \usepackage{longtable,pdflscape,graphicx} \usepackage{fmtcount,hyperref} % displaying latex counters ?%\usepackage[top=0.2inch, bottom=0.2inch, left=2cm, right=2cm]{geometry} \usepackage{fullpage} \usepackage{ctable} \title{United States Department of the Interior} \begin{document} ?%\setlength{\topmargin}{-1inch} % Just an example \setkeys{Gin}{width=1\textwidth} % makes all the graphics scales \maketitle <<echo=F,results=hide>>= reportDF <- structure(list(IDDate = c("3/12/2010", "3/13/2010", "3/14/2010", "3/15/2010"), FirstRunoftheY...
2013 Nov 05
1
Dynamic list creation (SEXP in C) returns error "unimplemented type (29) in 'duplicate'"
...+) { SECOND: By reading this post in Stackoverflow http://stackoverflow.com/questions/7458364/growing-an-r-matrix-inside-a-c-loop/7458516#7458516 I understood that it was necesary to (1) create the "child lists" and protecting them with PROTECT_WITH_INDEX, and (2) changing its size using SETLENGTH (Rf_lengthgets) and REPROTECT ing the lists in order to tell the GC that the vectors had change. THIRD: Once my two vectors are done ("id" and "lambda"), assign them to the i-th element of the "mother list" L1 using SET_VECTOR_ELT(VECTOR_ELT(L1,i), 0, duplicate(id))...
2008 Jul 27
2
Colors in Sweave
Hi list, I was using Sweave and was wondering if anyone has had any luck changing the font colors of the code chunks. For instance, in my .Rnw preample I tried including: === \usepackage[usenames]{colors} \definecolor{darkred}{rgb}{0.545,0,0} \definecolor{midnightblue}{rgb}{0.098,0.098,0.439} \DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl,formatcom={\color{midnightblue}}}
2024 Jun 06
4
clarifying and adjusting the C API for R
...ackages. Some entry points can safely be added to the API. Around 40 have already been added to WRE with API annotations; another 40 or so can probably be added after review. The remainder mostly fall into two groups: - Entry points that should never be used in packages, such as SET_OBJECT or SETLENGTH (or any non-API SETXYZ functions for that matter) that can create inconsistent or corrupt internal state. - Entry points that depend on the existence of internal structure that might be subject to change, such as the existence of promise objects or internal structure of environments. Man...
2009 Aug 19
3
Sweave output from print.summary.glm is too wide
Hi all I am preparing a document using Sweave; a really useful tool. But I am having a problem. Consider this toy example Sweave file: \documentclass{article} \begin{document} <<echo=TRUE,results=verbatim>>= options(width=40) # Set width to 40 characters hide <- capture.output(example(glm)) # Create an example of the problem, but hide the output summary(glm.D93) #
2008 Mar 06
1
Sweave and extra line
Hi the list, I am using Sweave. Between the Sinput and the Soutput, there is always an extra line: > 2+2 [1] 4 Is it possible to remove it ? > 2+2 [1] 4 Thanks Christophe