c# free pdf viewer : Add and remove pages from a pdf SDK control API wpf azure .net sharepoint R-admin4-part784

36
#include <Rmath.h>
toensurethattheconstantslikeNA_REALarelinkedcorrectly.(Auto-importwillprobablywork
withMinGW-w64,butitisbettertobesure. ThisislikelytoalsoworkwithVC++,Borland
andsimilarcompilers.)
Add and remove pages from a pdf - insert pages into PDF file in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Guide C# Users to Insert (Empty) PDF Page or Pages from a Supported File Format
add or remove pages from pdf; add page pdf reader
Add and remove pages from a pdf - VB.NET PDF Page Insert Library: insert pages into PDF file in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use VB.NET APIs to Add a New Blank Page to PDF Document
add multi page pdf to word document; add a page to a pdf in reader
37
Appendix A A Essentialandusefulotherprograms
underaUnix-alike
This appendix gives details of programs youwillneedtobuildR on n Unix-likeplatforms,or
whichwillbeusedbyRiffoundbyconfigure.
Remember that some packagemanagement systems (suchas
RPM
andDebian/Ubuntu’s)
makea distinctionbetweentheuser versionof apackage andthe developmentversion. . The
latter usually has the same name but with h theextension‘-devel’ or r ‘-dev’: : you u needboth
versionsinstalled.
A.1 Essentialprogramsandlibraries
You need a means s of compiling C C and d FORTRAN 90 (see Section B.6 [Using g FORTRAN],
page48). YourCcompilershouldbe
ISO
/
IEC
60059
1
,POSIX1003.1andC99-compliant.
2
R
triestochoosesuitableflagsfortheCcompilersitknowsabout,butyoumayhavetosetCCor
CFLAGSsuitably.Formanyversionsofgccwithglibcthismeansincluding-std=gnu99
3
.(Note
thatoptionsessentialtorunthecompilerevenforlinking,suchasthosetosetthearchitecture,
shouldbespecifiedaspartofCCratherthaninCFLAGS.)
Unless youdonot want toviewgraphson-screen(or useOSX)youneed‘X11’installed,
includingitsheadersandclientlibraries. ForrecentFedora/RedHatdistributionsitmeans(at
least) RPMs s ‘libX11’, ‘libX11-devel’, ‘libXt’ and ‘libXt-devel’. . On n Debian/Ubuntu we
recommendthe meta-package ‘xorg-dev’. . If f youreally do not want these you will need to
explicitlyconfigureRwithoutX11,using--with-x=no.
Thecommand-lineediting(andcommandcompletion)dependsonthe
GNU
readlinelibrary:
version 4.2 or r later is neededfor all l the features s tobe enabled. . Otherwise e youwillneedto
configurewith--with-readline=no(orequivalent).
Asuitably comprehensive iconv function n is s essential. . The e R usage requires iconv to be
abletotranslatebetween"latin1"and"UTF-8",torecognize""(asthecurrentencoding)and
"ASCII",andtotranslatetoandfromtheUnicodewide-characterformats "UCS-[24][BL]E"
—thisistruebydefaultforglibc
4
butnotofmostcommercialUnixes.However,youcanmake
useof
GNU
libiconv(asusedonOSX:seehttps://www.gnu.org/software/libiconv/).
TheOSneedstohaveenoughsupport
5
forwide-charactertypes: thisischeckedatconfigu-
ration.AsmallnumberofPOSIXfunctions
6
areessential,andothers
7
willbeusedifavailable.
Atarprogramis neededtounpack thesourcesandpackages(includingtherecommended
packages). Aversion
8
that canautomagically detectcompressedarchives is preferredfor use
withuntar(): the e configurescript looks for gtar andgnutarbeforetar – use environment
variableTARtooverridethis.
1
alsoknownas
IEEE
754
2
Notethat C11compilers neednot beC99-compliant: : Rrequiressupport t fordoublecomplexand variable-
lengtharrayswhichareoptionalinC11butismandatoryinC99.
3
-std=c99excludesPOSIXfunctionality,butconfig.hwillturnonall
GNU
extensionstoincludethePOSIX
functionality. ThedefaultmodeforGCC5.1andlateris-std=gnu11.
4
However, it is s possible e tobreakthe default behaviour of glibc by re-specifyingthe gconvmodules tobe
loaded.
5
specifically, the e C99 functionality of f headers wchar.h h and d wctype.h, , types wctans_t t and mbstate_t and
functionsmbrtowc,mbstowcs,wcrtomb,wcscoll,wcstombs,wctrans,wctype,andiswctype.
6
includingtheopendir,readdir,closedir,popen,stat, glob,access, getcwdandchdirsystemcalls,and
eitherputenvorsetenv.
7
suchasrealpath,symlink.
8
Suchas
GNU
tar1.15 orlater, bsdtar(fromhttps://github.com/libarchive/libarchive/, as s used by
FreeBSDand OS X10.6and later)ortarfromtheHeirloomToolchest (http://heirloom.sourceforge.
net/tools.html).
VB.NET PDF Password Library: add, remove, edit PDF file password
manipulations. Open password protected PDF. Add password to PDF. Change PDF original password. Remove password from PDF. Set PDF security level. VB
add page numbers to a pdf document; add a page to a pdf file
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
can simply delete a single page from a PDF document using VB.NET or remove any page Add necessary references: How to VB.NET: Delete Consecutive Pages from PDF.
adding page numbers to pdf files; add page break to pdf
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
38
Thereneedtobesuitableversionsofthetoolsgrepandsed:theproblemsareusuallywith
oldAT&TandBSDvariants. configurewilltrytofindsuitableversions(includinglookingin
/usr/xpg4/binwhichisusedonsomecommercialUnixes).
Youwillnotbeabletobuildmostofthemanualsunlessyouhavetexi2anyversion5.1or
laterinstalled,andifnotmostofthe
HTML
manualswillbelinkedtoaversionon
CRAN
. To
makePDFversionsofthemanualsyouwillalsoneedfiletexinfo.texinstalled(whichispart
ofthe
GNU
texinfodistributionbutisoftenmadepartoftheT
E
Xpackageinre-distributions)as
wellastexi2dvi.
9
Further,theversionsoftexi2dviandtexinfo.texneedtobecompatible:
wehaveseenproblemswitholderT
E
Xdistributions.
ThePDFdocumentation(includingdoc/NEWS.pdf)andbuildingvignettesneedspdftexand
pdflatex. WerequireL
A
T
E
Xversion2005/12/01orlater(forUTF-8support). BuildingPDF
packagemanuals(includingtheRreferencemanual)andvignettesissensitivetotheversionof
theLAT
E
XpackagehyperrefandwerecommendthattheT
E
Xdistributionusedis keptup-to-
date. Anumber r ofstandardLAT
E
Xpackagesare required(includingurlandsomeofthe font
packagessuchastimes,helvetic,ecandcm-super)andotherssuchashyperrefandinconsolata
aredesirable(andwithoutthemyoumayneedtochangeR’sdefaults: seeSection2.3[Making
the manuals], page 4). . Note e that package hyperref (currently) requires s packages kvoptions,
ltxcmds andrefcount. . For r distributions basedonTeXLivethesimplest approachmay beto
installcollectionscollection-latex,collection-fontsrecommended,collection-latexrecommended,
collection-fontsextraandcollection-latexextra(assumingtheyarenotinstalledbydefault): Fe-
dorausesnamesliketexlive-collection-fontsextraandDebian/Ubuntuliketexlive-fonts-extra.
IfyouwanttobuildfromtheRSubversionrepositorythentexi2anyishighlyrecommended
asitisusedtocreatefileswhichareinthetarballbutnotstoredintheSubversionrepository.
TheessentialprogramsshouldbeinyourPATHatthetimeconfigureisrun:thiswillcapture
thefullpaths.
A.2 Usefullibrariesandprograms
Theabilitytousetranslatedmessagesmakesuseofgettextandmostlikelyneeds
GNU
gettext:
youdoneedthistoworkwithnewtranslations,butotherwisetheversioncontainedintheR
sourceswillbeusedifnosuitableexternalgettextisfound.
The ‘modern’ version of the X11(), jpeg(), png() and tiff() graphics devices uses the
cairoand(optionally) Pango libraries. . Cairoversion1.2.0orlater r is required. . Pango o needs
tobeatleastversion1.10,and1.12is the earliest versionwehave tested. . (For r Fedorausers
webelievethepango-develRPManditsdependenciessuffice.) Rchecksforpkg-config,and
uses thattocheckfirstthatthe‘pangocairo’packageisinstalled(andifnot,‘cairo’)andif
additionalflagsareneededforthe‘cairo-xlib’package,thenifsuitablecodecanbecompiled.
Thesetestswillfailif pkg-config is not installed
10
, andare likely y tofailifcairo was built
statically(unusual).MostsystemswithGtk+2.8orlaterinstalledwillhavesuitablelibraries
Forthebestfontexperiencewiththesedevicesyouneedsuitablefontsinstalled: Linuxusers
willwanttheurw-fontspackage. Onplatforms s whichhaveit available,themsttcorefonts
package
11
provides TrueType versions of Monotype fonts s such as ArialandTimes s New Ro-
man. Another r useful set of fonts is the ‘liberation’ TrueType e fonts s available e at t https://
9
texi2dviisnormallyashellscript. Someversions(includingthat t fromtexinfo5.2and6.0)need toberun
underbashrather thanaBourneshell, especially onSolaris. . Someof f the issueswhichhavebeen observed
withbrokenversionsoftexi2dvicanbecircumventedbysettingtheenvironmentvariableR_TEXI2DVICMDto
thevalueemulation.
10
If necessarythepathtopkg-configcan bespecified bysettingPKGCONFinconfig.site,on theconfigure
commandlineorintheenvironment.
11
alsoknownas ttf-mscorefonts-installerin theDebian/Ubuntu world: : seealsohttps://en.wikipedia.
org/wiki/Core_fonts_for_the_Web.
C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
Ability to remove a range of pages from PDF file. Add necessary references: Demo Code: How to Delete Consecutive Pages from PDF in C#.NET.
adding page numbers to pdf in reader; adding page numbers to pdf
C# PDF Password Library: add, remove, edit PDF file password in C#
String outputFilePath = Program.RootPath + "\\" Output.pdf"; // Remove the password. doc.Save(outputFilePath); C# Sample Code: Add Password to Plain PDF
add pages to an existing pdf; add page numbers to pdf
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
39
fedorahosted.org/liberation-fonts/,
12
whichcovertheLatin,GreekandCyrillicalphabets
plus a fair range of signs. . These e share metrics with Arial, Times New w Roman n and Courier
New,andcontain fonts s rather similar to thefirst two(https://en.wikipedia.org/wiki/
Liberation_fonts). Thenthereisthe‘FreeUCSOutlineFonts’project(https://www.gnu.
org/software/freefont/)whichareOpenType/TrueTypefontsbasedontheURWfontsbut
withextendedUnicodecoverage. SeetheRhelponX11onselectingsuchfonts.
The bitmappedgraphics devices jpeg(),png() andtiff()needtheappropriate headers
andlibrariesinstalled: jpeg(version6bor r later,orlibjpeg-turbo)orlibpng(version1.2.7
or later)andzlibor libtiff(anyrecent version–3.9.[4567]and4.0.[23]havebeentested)
respectively. TheyalsoneedsupportforeitherX11orcairo(seeabove). . Shouldsupportfor
thesedevicesnotberequiredorbrokensystemlibrariesneedtobeavoidedthereareconfigure
options --without-libpng, --without-jpeglib b and d --without-libtiff. . For r most system
installations theTIFFlibrarieswillrequireJPEGlibrariesto be present andperhaps linked
explicitly,so--without-jpeglibmayalsodisablethetiff()device. Thetiff()devicesonly
requirea basic buildof libtiff (not evenJPEGsupport is needed). . Recent t versions allow
severalotherlibrariestobelinkedintolibtiffsuchaslzma,jbigandjpeg12,andthesemay
needalsotobepresent.
Ifyouhavetheminstalled(includingtheappropriateheadersandofsuitableversions),system
versionsofzlib(version1.2.5orlater),,libbz2(version1.0.6orlater:calledbzip2-libs/bzip2-
develorlibbz2-1.0/libbz2-devbysome Linux distributions)andPCRE(version8.10orlater,
preferably8.32orlater
13
):willbeused,otherwiseversionsintheRsourceswillbecompiledin.
Theexternalversionscanbeavoidedbyconfigureoptions--without-system-zlib,--without-
system-bzliband--without-system-pcre.
Option--with-system-treisalsoavailable:itneedsarecentversionofTRE.(Thecurrent
sourcesareinthegitrepositoryathttps://github.com/laurikari/tre/,butatthetimeof
writingtheresultingbuildwillnotpassitschecks.).
Library liblzma fromxz-utils version n 5.0.3 or r later (including 5.2.x) willbeusedifin-
stalled: the e versionintheR sources canbeselectedinsteadby configuringwith--without-
system-xz. Systems s differ in n what t they callthe package including this: : e.g. . on Fedora the
libraryisin‘xz-libs’andtheheadersin‘xz-devel’.
Animplementation of
XDR
is required, , and the R R sources s contain one e whichis likely to
suffice (althougha system version may have higher performance).
XDR
is part of
RPC
and
historically has been part of libc on a Unix-alike. . However r some e builds s of glibc hide it
withtheintentionthatthe
TI-RPC
librarybeusedinstead,inwhichcase libtirpc(andits
developmentversion)needstobeinstalled,anditsheadersneedtobeontheCincludepathor
in/usr/include/tirpc.
UseoftheX11clipboardselectionrequirestheXmuheadersandlibraries. Thesearenormally
partofanX11installation(e.g.theDebianmeta-package‘xorg-dev’),butsomedistributions
havesplitthisintosmallerparts,soforexamplerecentversionsofFedorarequirethe‘libXmu’
and‘libXmu-devel’RPMs.
Somesystems(notablyOSXandatleastsomeFreeBSDsystems)haveinadequatesupport
forcollationinmultibytelocales. It t is possibletoreplacetheOS’scollationsupportbythat
fromICU(InternationalComponentsforUnicode,http://site.icu-project.org/),andthis
providesmuchmore precisecontrolovercollationonallsystems. . ICUisavailableas s sources
andasbinarydistributionsfor(atleast)mostLinuxdistributions,Solaris,FreeBSDandAIX,
12
ttf-liberationinDebian/Ubuntu.
13
sometimes known n as PCRE1, and d not t PCRE2, which started at version 10.0. . PCRE E must t be e built with
UTF-8support(notthedefault,and checkedbyconfigure)andsupportforUnicodepropertiesisassumed
bysomeRpackages(thiscanbecheckedatrun-timebycallingpcre_config()).
C# PDF Digital Signature Library: add, remove, update PDF digital
Image: Insert Image to PDF. Image: Remove Image from Redact Text Content. Redact Images. Redact Pages. Annotation & Highlight Text. Add Text. Add Text Box. Drawing
add page numbers pdf file; add a page to pdf file
C# PDF remove image library: remove, delete images from PDF in C#.
Image: Insert Image to PDF. Image: Remove Image from Redact Text Content. Redact Images. Redact Pages. Annotation & Highlight Text. Add Text. Add Text Box. Drawing
add page number to pdf document; adding page to pdf
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
40
usually as libicuoricu4c. . Itwillbe e usedby default where available: : shouldaveryoldor
brokenversionofICUbefoundthiscanbesuppressedby--without-ICU.
Iflibcurlversion7.28.0orlaterisavailable(includingitsdevelopmentfiles),itwillbelinked
intosupportcurlGetHeadersandthe"libcurl"methodsofdownload.fileandurl. This
isrecommendedasitgivesaccessto‘https://’and‘ftps://’URLs.Informationonlibcurl
isfoundfromthecurl-configscript: ifthatismissingorneedstobeoverridden
14
thereare
macrosdescribedinfileconfig.site.
Thebitmapanddev2bitmapdevicesandfunctionembedFonts()useghostscript(http://
www.ghostscript.com/). Thisshouldeitherbeinyourpathwhenthecommandisrun,orits
fullpathspecifiedbytheenvironmentvariableR_GSCMDatthattime.
A.2.1 Tcl/Tk
Thetcltkpackageneeds Tcl/Tk >= 8.4installed: : thesourcesare e availableathttps://www.
tcl.tk/. TospecifythelocationsoftheTcl/Tkfilesyoumayneedtheconfigurationoptions
--with-tcltk
useTcl/Tk,orspecifyitslibrarydirectory
--with-tcl-config=TCL_CONFIG
specifylocationoftclConfig.sh
--with-tk-config=TK_CONFIG
specifylocationoftkConfig.sh
orusetheconfigurevariablesTCLTK_LIBSandTCLTK_CPPFLAGStospecifytheflagsneededfor
linkingagainsttheTclandTklibrariesandforfindingthetcl.handtk.hheaders,respectively.
Ifyouhaveboth32-and64-bitversionsofTcl/Tkinstalled,specifyingthepathstothecorrect
configfilesmaybenecessarytoavoidconfusionbetweenthem.
VersionsofTcl/Tkupto8.5.19and8.6.4havebeentested(includingmostversionsof8.4.x,
butnotrecently).
Notethatthetk.hheaderincludes
15
X11headers,soyouwillneedX11anditsdevelopment
filesinstalled.
A.2.2 Javasupport
ThebuildprocesslooksforJavasupportonthehostsystem,andifitfindsitsetssomesettings
which are e useful l for Java-using g packages (such as rJava (https://CRAN.R-project.org/
package=rJava)andJavaGD(https://CRAN.R-project.org/package=JavaGD)). Thischeck
canbesuppressedbyconfigureoption--disable-java. ConfigurevariableJAVA_HOMEcanbe
settopointtoaspecificJRE/JDK,ontheconfigurecommandlineorintheenvironment.
PrincipalamongstthesesettingsaresomelibrarypathstotheJavalibrariesandJVM,which
arestoredinenvironmentvariableR_JAVA_LD_LIBRARY_PATHinfileR_HOME/etc/ldpaths(ora
sub-architecture-specificversion).Atypicalsettingfor‘x86_64’Linuxis
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-1.b15.fc22.x86_64/jre
R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server
UnfortunatelythisdependsontheexactversionoftheJRE/JDKinstalled,andsomayneed
updatingifthe Javainstallationisupdated. . Thiscanbedoneby y runningRCMDjavareconf
whichupdates settings inbothR_HOME/etc/Makeconf and d R_HOME/etc/ldpaths. . SeeRCMD
javareconf--help fordetails: : notethatthisneeds s tobedonebytheaccountowningtheR
installation.
14
forexampletospecifystaticlinkingwithabuildwhichhasbothsharedandstaticlibraries.
15
Thisistrueeven forthe‘Aqua’version ofTkonOSX,butdistributionsof that includeacopyoftheX11
filesneeded.
C# PDF bookmark Library: add, remove, update PDF bookmarks in C#.
Help to add or insert bookmark and outline into PDF file in .NET framework. Ability to remove and delete bookmark and outline from PDF document.
add page to pdf in preview; adding page numbers in pdf
C# PDF metadata Library: add, remove, update PDF metadata in C#.
Add metadata to PDF document in C# .NET framework program. Remove and delete metadata from PDF file. Also a PDF metadata extraction control.
adding page numbers to pdf documents; add page numbers to a pdf file
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
41
Another way of overriding g those settings s is to o set t the e environment t variable R_JAVA_LD_
LIBRARY_PATH(beforeRisstarted,hencenotin~/.Renviron),whichsufficestorunalready-
installedJava-usingpackages.Forexample
R_JAVA_LD_LIBRARY_PATH=/usr/lib/jvm/java-1.8.0/jre/lib/amd64/server
Itmaybepossibletoavoidthisbyspecifyinganinvariantlinkasthepathwhenconfiguring.
Forexample,onthatsystemanyof
JAVA_HOME=/usr/lib/jvm/java
JAVA_HOME=/usr/lib/jvm/java-1.8.0
JAVA_HOME=/usr/lib/jvm/java-1.8.0/jre
worked.
A.2.3 Othercompiledlanguages
Some add-onpackages needaC++compiler. . This s isspecifiedbytheconfigurevariables CXX,
CXXFLAGSandsimilar.configurewillnormallyfindasuitablecompiler.However,inmostcases
thiswillbeaC++98compiler,andasfromR3.1.0itispossibletospecifyanalternativecompiler
forusewithC++11bytheconfigurevariablesCXX1X,CXX1XSTD,CXX1XFLAGSandsimilar.Again,
configurewillnormallyfindasuitablevalueforCXX1XSTDifthecompilergivenbyCXXiscapable
ofcompilingC++11code,butitispossiblethatacompletelydifferentcompilerwillbeneeded.
OtherpackagesneedfullFortran90(orlater)support.Forsourcefileswithextension.f90
or.f95,thecompilerdefinedbythemacroFCisusedbyRCMDINSTALL. ThisisfoundwhenR
isconfiguredandisoftenthesameasF77:notethatitisdetectedbythenameofthecommand
withoutatestthat itcanactuallycompileFortran90 code. . Set t the configure variable FC to
override this if necessary: : variables s FCFLAGS, FCPICFLAGS, FCLIBS, SHLIB_FCLD D and d SHLIB_
FCLDFLAGSmightalsoneedtobeset.
Seefileconfig.siteintheRsourceformoredetailsaboutthesevariables.
A.3 Linearalgebra
A.3.1 BLAS
ThelinearalgebraroutinesinRcanmakeuseofenhanced
BLAS
(BasicLinearAlgebraSub-
programs, http://www.netlib.org/blas/faq.html) ) routines. . However,these e have to be
explicitlyrequestedatconfiguretime:Rprovidesaninternal
BLAS
whichiswell-testedandwill
beadequateformostusesofR.
Youcanspecifyaparticular
BLAS
libraryvia avaluefortheconfigurationoption--with-
blasandnottouseanexternal
BLAS
libraryby--without-blas(thedefault).If--with-blas
isgivenwithno=,itsvalueistakenfromtheenvironmentvariableBLAS_LIBS,setforexample
inconfig.site. Ifneithertheoptionnortheenvironmentvariablesupplyavalue,asearchis
madeforasuitable
BLAS
.Ifthevalueisnotobviouslyalinkercommand(startingwithadash
orgivingthepathtoalibrary),itisprefixedby‘-l’,so
--with-blas="foo"
isaninstructiontolinkagainst‘-lfoo’tofindanexternal
BLAS
(whichneedstobefoundboth
atlinktimeandruntime).
The configurecodechecks that theexternal
BLAS
is complete(it must includealldouble
precisionanddoublecomplexroutines,aswellasLSAME),andappearstobeusable. However,
anexternal
BLAS
hastobeusablefromasharedobject(somustcontainposition-independent
code),andthatisnotchecked.
VB.NET PDF remove image library: remove, delete images from PDF in
Image: Insert Image to PDF. Image: Remove Image from Redact Text Content. Redact Images. Redact Pages. Annotation & Highlight Text. Add Text. Add Text Box. Drawing
add page number to pdf hyperlink; adding page numbers pdf file
VB.NET PDF metadata library: add, remove, update PDF metadata in
Add permanent metadata to PDF document in VB .NET framework program. Remove and delete metadata content from PDF file in Visual Basic .NET application.
adding page numbers to a pdf in preview; add pdf pages to word
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
42
Someenhanced
BLAS
esarecompiler-system-specific(sunperfonSolaris
16
,libesslonIBM,
AccelerateonOSX).Thecorrectincantationfortheseisoftenfoundvia --with-blaswith
novalueontheappropriateplatforms.
Someoftheexternal
BLAS
esaremulti-threaded.OneissueisthatRprofiling(whichusesthe
SIGPROFsignal)maycauseproblems,andyoumaywanttodisableprofilingifyouuseamulti-
threaded
BLAS
. Notethat t usingamulti-threaded
BLAS
canresult intaking more
CPU
time
andevenmoreelapsedtime(occasionallydramaticallyso)thanusingasimilarsingle-threaded
BLAS
.Onamachinerunningothertasks,therecanbecontentionforCPUcachesthatreduces
theeffectivenessoftheoptimizationofcacheusebya
BLAS
implementation.
NotethatunderUnix(butnotunderWindows)ifRiscompiledagainstanon-default
BLAS
and--enable-BLAS-shlibisnotused,thenall
BLAS
-usingpackagesmustalsobe. SoifRis
re-builttouseanenhanced
BLAS
thenpackagessuchasquantreg(https://CRAN.R-project.
org/package=quantreg)willneedtobere-installed.
R relies s on
ISO
/
IEC
60559 compliance e of an n external
BLAS
. This s can be e broken if for
examplethecodeassumesthattermswithazerofactorarealwayszeroanddonotneedtobe
computed—whereasx*0canbeNaN.Thisischeckedinthetestsuite.
External
BLAS
implementationsoftenmakelessuseofextended-precisionfloating-pointreg-
istersandwill almost t certainly re-ordercomputations. . This s can n resultin less s accuracy than
usingtheinternal
BLAS
,andmayresultindifferentsolutions,e.g.different signsinSVDand
eigendecompositions.
TheURIsforseveraloftheseBLASaresubjecttofrequentgratuitouschanges,soyouwill
needtosearchfortheircurrentlocations.
A.3.1.1 ATLAS
ATLAS(http://math-atlas.sourceforge.net/)isa“tuned”
BLAS
thatrunsonawiderange
of Unix-alikeplatforms. . Unfortunately y it isbuiltby default as astatic librarythat on n some
platformscannotbeusedwithsharedobjectssuchasareusedinRpackages. Becarefulwhen
usingpre-builtversionsofATLAS(theyseemtoworkon‘ix86’platforms,butnotalwayson
‘x86_64’ones).
TheusualwaytospecifyATLASwillbevia
--with-blas="-lf77blas -latlas"
ifthelibrariesareinthelibrarypath,otherwiseby
--with-blas="-L/path/to/ATLAS/libs -lf77blas s -latlas"
Forexample,‘x86_64’Fedoraneeds
--with-blas="-L/usr/lib64/atlas -lf77blas s -latlas"
ForsystemswithmultipleCPUcoresitispossibletouseamulti-threadedversionofATLAS,
byspecifying
--with-blas="-lptf77blas -lpthread d -latlas"
ConsultitsinstallationguideforhowtobuildATLASwithposition-independentcode,and
asasharedlibrary.
A.3.1.2 ACML
For‘x86_64’processors
17
underLinuxthereistheAMDCoreMathLibrary(ACML).Forthe
gccversionwecoulduse
--with-blas="-lacml"
16
UsingtheOracleSolarisStudioccandf95compilers
17
and‘i686’forearlierversions.
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
43
iftheappropriate library directory (suchas /opt/acml5.1.0/gfortran64/lib)is inthe LD_
LIBRARY_PATH. Forothercompilers,seetheACMLdocumentation. Thereisamultithreaded
LinuxversionofACMLavailableforrecentversionsofgfortran. Tomakeuseofthisyouwill
needsomethinglike
--with-blas="-L/opt/acml5.1.0/gfortran64_mp/lib -lacml_mp"
(andyoumayneedtoarrangeforthedirectorytobeinld.socache).
SeeseeSectionA.3.1.5[SharedBLAS],page44,foranalternative(andinmanywaysprefer-
able)waytouseACML.
Theversionlasttested(5.1.0)failedthereg-BLAS.RtestinitshandlingofNAs.
A.3.1.3 GotoandOpenBLAS
DrKazushigeGotowroteatuned
BLAS
forseveralprocessorsandOSes,whichwasfrozenin
mid-2010. The e finalversionisknownasGotoBLAS2, andwas re-releasedundera muchless
restrictivelicence.Onceitisbuiltandinstalled,itcanbeusedbyconfiguringRwith
--with-blas="-lgoto2"
SeeseeSectionA.3.1.5[SharedBLAS],page44,foranalternative(andinmanywaysprefer-
able)waytouseit.
OpenBLAS(http://www.openblas.net/) isa descendantproject withsupport for some
laterCPUs(e.g.IntelSandyBridge). Onceinstalleditcanbeusedbysomethinglike
--with-blas="-lopenblas"
orasasharedBLAS.
A.3.1.4 IntelMKL
ForIntelprocessors(andperhapsothers)andsomedistributionsofLinux,thereisIntel’sMath
KernelLibrary. YouarestronglyencouragedtoreadtheMKLUser’sGuide,whichisinstalled
withthelibrary,beforeattemptingtolinktoMKL.Thisincludesa‘linklineadvisor’whichwill
suggestappropriateincantations: itsuseisrecommended. . Orsee e https://software.intel.
com/en-us/articles/intel-mkl-link-line-advisor.
Therearealsoversions ofMKLforOSXandWindows,but atthetimethese weretried
theydidnotworkwiththestandardcompilersusedforRonthoseplatforms.
TheMKLinterfacehaschangedseveraltimesandmaychangeagain:thefollowingexamples
havebeenusedwithversions10.3to11.3,forGCCcompilerson‘x86_64’.
ToasequentialversionofMKLweused
MKL_LIB_PATH=/path/to/intel_mkl/lib/intel64
export LD_LIBRARY_PATH=$MKL_LIB_PATH
MKL="-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_core -lmkl_sequential"
./configure --with-blas="$MKL" --with-lapack
Theoption--with-lapack isusedsinceMKLcontains atunedcopyofLAPACKas wellas
BLAS
(seeSectionA.3.2[LAPACK],page44),althoughthiscanbeomitted.
ThreadedMKLmaybeusedbyreplacingthelinedefiningthevariableMKLby
MKL="-L${MKL_LIB_PATH} -lmkl_gf_lp64 -lmkl_core \
-lmkl_gnu_thread -dl -lpthread"
ThedefaultnumberofthreadswillbechosenbytheOpenMPsoftware,butcanbecontrolled
bysettingOMP_NUM_THREADSorMKL_NUM_THREADS,andinrecentversionsseemstodefaulttoa
sensiblevalueforsoleuseofthemachine.
Ithasbeenreportedthat
--with-blas=’-mkl=parallel’ --with-lapack
workedwiththeIntel2015.3compilersonCentos6.
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
44
A.3.1.5 SharedBLAS
The
BLAS
library willbeusedfor manyoftheadd-onpackages as wellas for R itself. . This
meansthatitisbettertouseashared/dynamic
BLAS
library,asmostofastaticlibrarywillbe
compiledintotheRexecutableandeach
BLAS
-usingpackage.
R offers the optionofcompilingthe
BLAS
intoa dynamic library libRblas stored inR_
HOME/libandlinkingbothRitselfandalltheadd-onpackagesagainstthatlibrary.
This is the default on n allplatforms s except AIXunless anexternal
BLAS
is specifiedand
found:forthelatteritcanbeusedbyspecifyingtheoption--enable-BLAS-shlib,anditcan
alwaysbedisabledvia--disable-BLAS-shlib.
Thishasbothadvantagesanddisadvantages.
 Itsavesspacebyhavingonlyasinglecopyofthe
BLAS
routines,whichishelpfulifthere
isanexternalstatic
BLAS
suchasusedtobestandardforATLAS.
 There e may y be e performance e disadvantages in n using a shared
BLAS
. Probably y the most
likelyiswhenR’sinternal
BLAS
isusedandRis not t builtasasharedlibrary,whenitis
possible to buildthe
BLAS
intoR.bin(and libR.a) ) withoutusing position-independent
code. However,experimentsshowedthatinmanycasesusingashared
BLAS
wasas fast,
providedhighlevelsofcompileroptimizationareused.
 Itiseasytochangethe
BLAS
withoutneedingtore-installRandalltheadd-onpackages,
since all references to the
BLAS
go through libRblas, and that can be replaced. . Note
thoughthatany dynamiclibrariesthereplacementlinks towillneedtobefoundbythe
linker: thismayneedthelibrarypathtobechangedinR_HOME/etc/ldpaths.
Another optiontochangethe
BLAS
inuseistosymlinkadynamic
BLAS
library(suchas
ACMLorGoto’s)toR_HOME/lib/libRblas.so.Forexample,just
mv R_HOME/lib/libRblas.so R_HOME/lib/libRblas.so.keep
ln -s /opt/acml5.1.0/gfortran64_mp/lib/libacml_mp.so R_HOME/lib/libRblas.so
willchangethe
BLAS
inusetomultithreadedACML.Asimilarlinkworksforsomeversions
ofGoto
BLAS
,OpenBLASandMKL(providedtheappropriatelibdirectoryisintherun-time
librarypathorld.socache).
A.3.2 LAPACK
ProvisionismadeforusinganexternalLAPACKlibrary,principallytocopewith
BLAS
libraries
whichcontainacopyofLAPACK(suchassunperfonSolaris,AccelerateonOSXandACML
andMKLon‘ix86’/‘x86_64’Linux). AtleastLAPACKversion3.2isrequired. Thiscanonly
bedoneif--with-blashasbeenused.
However,thelikelyperformancegainsarethoughttobesmall(andmaybenegative),andthe
defaultisnottosearchforasuitableLAPACKlibrary,andthisisdefinitelynotrecommended.
YoucanspecifyaspecificLAPACKlibraryorasearchforagenericlibrarybytheconfiguration
option--with-lapack. Thedefaultfor--with-lapackistocheckthe
BLAS
libraryandthen
lookfor anexternallibrary‘-llapack’. . Sites s searchingfor the fastestpossiblelinearalgebra
maywanttobuildaLAPACKlibraryusingtheATLAS-optimizedsubsetofLAPACK.Todo
sospecifysomethinglike
--with-lapack="-L/path/to/ATLAS/libs -llapack k -lcblas"
sincetheATLASsubsetofLAPACKdependsonlibcblas.Avaluefor--with-lapackcanbe
setvia theenvironmentvariableLAPACK_LIBS,butthiswillonlybeusedif--with-lapackis
specified(asthedefaultvalueisno)andthe
BLAS
librarydoesnotcontainLAPACK.
SinceACMLcontainsafullLAPACK,ifselectedasthe
BLAS
itcanbeusedastheLAPACK
via --with-lapack.
AppendixA:EssentialandusefulotherprogramsunderaUnix-alike
45
If youdo use--with-lapack,be awareofpotentialproblemswithbugs intheLAPACK
sources(orinthepostedcorrectionstothosesources).Inparticular,bugsinDGEEVandDGESDD
haveresultedinerrormessagessuchas
DGEBRD gave error code -10
. Otherpotentialproblemsareincompleteversionsofthelibraries,seenseveraltimesinLinux
distributionsovertheyears.
Pleasedobearinmindthatusing--with-lapackis‘definitelynotrecommended’:itispro-
videdonlybecauseitisnecessaryonsomeplatformsandbecausesomeuserswanttoexperiment
withclaimedperformanceimprovements.Reportingproblemswhereitisusedunnecessarilywill
simplyirritatetheRhelpers.
Notetoothecomments about
ISO
/
IEC
60559complianceinthesectionofexternal
BLAS
:
theseapplyequallytoanexternalLAPACK,andforexampletheIntelMKLdocumentation
says
LAPACK routines s assume e that input matrices do not contain IEEE E 754 special
valuessuchasINForNaNvalues. UsingthesespecialvaluesmaycauseLAPACK
toreturnunexpectedresultsorbecomeunstable.
WerelyonlimitedsupportinLAPACKformatriceswith2
31
ormoreelements: itisquite
possiblethatanexternalLAPACKwillnothavethatsupport.
IfyouhaveapureFORTRAN77compilerwhichcannotcompileLAPACKitmaybepossible
touseCLAPACKfromhttp://www.netlib.org/clapack/bysomethinglike
-with-lapack="-lclapack -lf2c"
providedthesewerebuiltwithposition-independentcodeandthecallingconventionsfordouble
complex function n returnvalues s matchthose in n the BLAS used, so it t may be simpler r to o use
CLAPACKbuilttouseCBLASand
-with-lapack="-lclapack -lcblas -lf2c"
A.3.3 Caveats
Aswithalllibraries,youneedtoensurethattheyandRwerecompiledwithcompatiblecompilers
andflags. Forexample,thishas s meantthatonSunSparcusingthenativecompilerstheflag
-dalignisneededifsunperfistobeused.
Onsomesystemsithasbeennecessarythatanexternal
BLAS
/LAPACKwasbuiltwiththe
sameFORTRANcompilerusedtobuildR.
Documents you may be interested
Documents you may be interested