This document compares different methods for performing least squares calculations, which are commonly used in statistical analysis. It finds that using the crossprod and Matrix functions from the Matrix package provides faster and more numerically stable solutions than directly calculating the matrix inverse and products. For large, sparse datasets, the sparse matrix classes in Matrix produce the fastest results of all. Retaining intermediate computations allows for very fast repeated calculations.
IJRET : International Journal of Research in Engineering and Technology is an international peer reviewed, online journal published by eSAT Publishing House for the enhancement of research in various disciplines of Engineering and Technology. The aim and scope of the journal is to provide an academic medium and an important reference for the advancement and dissemination of research results that support high-level learning, teaching and research in the fields of Engineering and Technology. We bring together Scientists, Academician, Field Engineers, Scholars and Students of related fields of Engineering and Technology.
A novel approach for high speed convolution of finite and infinite length seq...eSAT Journals
Ā
Abstract
Digital signal processing, Digital control systems, Telecommunication, Audio and Video processing are important applications in
VLSI. Design and implementation of DSP systems with advances in VLSI demands low power, efficiency in energy, portability,
reliability and miniaturization. In digital signal processing, linear-time invariant systems are important sub-class of systems and are
the heart and soul of DSP.
In many application areas, linear and circular convolution are fundamental computations. Convolution with very long sequences is
often required. Discrete linear convolution of two finite-length and infinite length sequences using circular convolution on for
Overlap-Add and Overlap-Save methods can be computed. In real-time signal processing, circular convolution is much more
effective than linear convolution. Circular convolution is simpler to compute and produces less output samples compared to linear
convolution. Also linear convolution can be computed from circular convolution. In this paper, both linear, circular convolutions are
performed using vedic multiplier architecture based on vertical and cross wise algorithm of Urdhva-Tiryabhyam. The implementation
uses hierarchical design approach which leads to improvement in computational speed, power reduction, minimization in hardware
resources and area. Coding is done using Verilog HDL. Simulation and synthesis are performed using Xilinx FPGA.
Keywords: Linear and Circular convolution, Urdhva - Tiryagbhyam, carry save multiplier, Overlap āAdd/ Save Verilog
HDL.
IJRET : International Journal of Research in Engineering and Technology is an international peer reviewed, online journal published by eSAT Publishing House for the enhancement of research in various disciplines of Engineering and Technology. The aim and scope of the journal is to provide an academic medium and an important reference for the advancement and dissemination of research results that support high-level learning, teaching and research in the fields of Engineering and Technology. We bring together Scientists, Academician, Field Engineers, Scholars and Students of related fields of Engineering and Technology.
A novel approach for high speed convolution of finite and infinite length seq...eSAT Journals
Ā
Abstract
Digital signal processing, Digital control systems, Telecommunication, Audio and Video processing are important applications in
VLSI. Design and implementation of DSP systems with advances in VLSI demands low power, efficiency in energy, portability,
reliability and miniaturization. In digital signal processing, linear-time invariant systems are important sub-class of systems and are
the heart and soul of DSP.
In many application areas, linear and circular convolution are fundamental computations. Convolution with very long sequences is
often required. Discrete linear convolution of two finite-length and infinite length sequences using circular convolution on for
Overlap-Add and Overlap-Save methods can be computed. In real-time signal processing, circular convolution is much more
effective than linear convolution. Circular convolution is simpler to compute and produces less output samples compared to linear
convolution. Also linear convolution can be computed from circular convolution. In this paper, both linear, circular convolutions are
performed using vedic multiplier architecture based on vertical and cross wise algorithm of Urdhva-Tiryabhyam. The implementation
uses hierarchical design approach which leads to improvement in computational speed, power reduction, minimization in hardware
resources and area. Coding is done using Verilog HDL. Simulation and synthesis are performed using Xilinx FPGA.
Keywords: Linear and Circular convolution, Urdhva - Tiryagbhyam, carry save multiplier, Overlap āAdd/ Save Verilog
HDL.
Forecasting models for Customer Lifetime ValueAsoka Korale
Ā
The note presents some commonly used models in telecommunications demand forecasting. The models are presented for use in forecasting CLV with appropriately prepared revenue data.
Discretizing of linear systems with time-delay Using method of Eulerās and Tu...IJERA Editor
Ā
Delays deteriorate the control performance and could destabilize the overall system in the theory of discretetime
signals and dynamic systems. Whenever a computer is used in measurement, signal processing or control
applications, the data as seen from the computer and systems involved are naturally discrete-time because a
computer executes program code at discrete points of time. Theory of discrete-time dynamic signals and systems
is useful in design and analysis of control systems, signal filters, state estimators and model estimation from
time-series of process data system identification. In this paper, a new approximated discretization method and
digital design for control systems with delays is proposed. System is transformed to a discrete-time model with
time delays. To implement the digital modeling, we used the z-transfer functions matrix which is a useful model
type of discrete-time systems, being analogous to the Laplace-transform for continuous-time systems. The most
important use of the z-transform is for defining z-transfer functions matrix is employed to obtain an extended
discrete-time. The proposed method can closely approximate the step response of the original continuous timedelayed
control system by choosing various of energy loss level. Illustrative example is simulated to demonstrate
the effectiveness of the developed method.\
I am Paul G. I am a Mechanical Engineering Assignment Expert at matlabassignmentexperts.com. I hold a Ph.D. Matlab, University of Adelaide, Australia. I have been helping students with their homework for the past 10 years. I solve assignments related to Mechanical Engineering.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Mechanical Engineering Assignments.
Fpga implementation of optimal step size nlms algorithm and its performance a...eSAT Publishing House
Ā
IJRET : International Journal of Research in Engineering and Technology is an international peer reviewed, online journal published by eSAT Publishing House for the enhancement of research in various disciplines of Engineering and Technology. The aim and scope of the journal is to provide an academic medium and an important reference for the advancement and dissemination of research results that support high-level learning, teaching and research in the fields of Engineering and Technology. We bring together Scientists, Academician, Field Engineers, Scholars and Students of related fields of Engineering and Technology.
Fpga implementation of optimal step size nlms algorithm and its performance a...eSAT Journals
Ā
Abstract The Normalized Least Mean Square error (NLMS) algorithm is most popular due to its simplicity. The conflicts of fast convergence and low excess mean square error associated with a fixed step size NLMS are solved by using an optimal step size NLMS algorithm. The main objective of this paper is to derive a new nonparametric algorithm to control the step size and also the theoretical performance analysis of the steady state behavior is presented in the paper. The simulation experiments are performed in Matlab. The simulation results show that the proposed algorithm as superior performance in Fast convergence rate, low error rate, and has superior performance in noise cancellation. Index Terms: Least Mean square algorithm (LMS), Normalized least mean square algorithm (NLMS)
Forecasting models for Customer Lifetime ValueAsoka Korale
Ā
The note presents some commonly used models in telecommunications demand forecasting. The models are presented for use in forecasting CLV with appropriately prepared revenue data.
Discretizing of linear systems with time-delay Using method of Eulerās and Tu...IJERA Editor
Ā
Delays deteriorate the control performance and could destabilize the overall system in the theory of discretetime
signals and dynamic systems. Whenever a computer is used in measurement, signal processing or control
applications, the data as seen from the computer and systems involved are naturally discrete-time because a
computer executes program code at discrete points of time. Theory of discrete-time dynamic signals and systems
is useful in design and analysis of control systems, signal filters, state estimators and model estimation from
time-series of process data system identification. In this paper, a new approximated discretization method and
digital design for control systems with delays is proposed. System is transformed to a discrete-time model with
time delays. To implement the digital modeling, we used the z-transfer functions matrix which is a useful model
type of discrete-time systems, being analogous to the Laplace-transform for continuous-time systems. The most
important use of the z-transform is for defining z-transfer functions matrix is employed to obtain an extended
discrete-time. The proposed method can closely approximate the step response of the original continuous timedelayed
control system by choosing various of energy loss level. Illustrative example is simulated to demonstrate
the effectiveness of the developed method.\
I am Paul G. I am a Mechanical Engineering Assignment Expert at matlabassignmentexperts.com. I hold a Ph.D. Matlab, University of Adelaide, Australia. I have been helping students with their homework for the past 10 years. I solve assignments related to Mechanical Engineering.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Mechanical Engineering Assignments.
Fpga implementation of optimal step size nlms algorithm and its performance a...eSAT Publishing House
Ā
IJRET : International Journal of Research in Engineering and Technology is an international peer reviewed, online journal published by eSAT Publishing House for the enhancement of research in various disciplines of Engineering and Technology. The aim and scope of the journal is to provide an academic medium and an important reference for the advancement and dissemination of research results that support high-level learning, teaching and research in the fields of Engineering and Technology. We bring together Scientists, Academician, Field Engineers, Scholars and Students of related fields of Engineering and Technology.
Fpga implementation of optimal step size nlms algorithm and its performance a...eSAT Journals
Ā
Abstract The Normalized Least Mean Square error (NLMS) algorithm is most popular due to its simplicity. The conflicts of fast convergence and low excess mean square error associated with a fixed step size NLMS are solved by using an optimal step size NLMS algorithm. The main objective of this paper is to derive a new nonparametric algorithm to control the step size and also the theoretical performance analysis of the steady state behavior is presented in the paper. The simulation experiments are performed in Matlab. The simulation results show that the proposed algorithm as superior performance in Fast convergence rate, low error rate, and has superior performance in noise cancellation. Index Terms: Least Mean square algorithm (LMS), Normalized least mean square algorithm (NLMS)
The name MATLAB stands for MATrix LABoratory.MATLAB is a high-performance language for technical computing.
It integrates computation, visualization, and programming environment. Furthermore, MATLAB is a modern programming language environment: it has sophisticated data structures, contains built-in editing and debugging tools, and supports object-oriented programming.
These factor make MATLAB an excellent tool for teaching and research.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Ā
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overviewā
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Ā
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Ā
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Ā
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
Ā
The field of Information retrieval (IR) is currently undergoing a transformative shift, at least partly due to the emerging applications of generative AI to information access. In this talk, we will deliberate on the sociotechnical implications of generative AI for information access. We will argue that there is both a critical necessity and an exciting opportunity for the IR community to re-center our research agendas on societal needs while dismantling the artificial separation between the work on fairness, accountability, transparency, and ethics in IR and the rest of IR research. Instead of adopting a reactionary strategy of trying to mitigate potential social harms from emerging technologies, the community should aim to proactively set the research agenda for the kinds of systems we should build inspired by diverse explicitly stated sociotechnical imaginaries. The sociotechnical imaginaries that underpin the design and development of information access technologies needs to be explicitly articulated, and we need to develop theories of change in context of these diverse perspectives. Our guiding future imaginaries must be informed by other academic fields, such as democratic theory and critical theory, and should be co-developed with social science scholars, legal scholars, civil rights and social justice activists, and artists, among others.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
Ā
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
ā¢ The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
ā¢ Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
ā¢ Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
ā¢ Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
Ā
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties ā USA
Expansion of bot farms ā how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks ā Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
Ā
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
Ā
As AI technology is pushing into IT I was wondering myself, as an āinfrastructure container kubernetes guyā, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefitās both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Ā
Comparisons
1. Comparing Least Squares Calculations
Douglas Bates
R Development Core Team
Douglas.Bates@R-project.org
September 3, 2012
Abstract
Many statistics methods require one or more least squares problems
to be solved. There are several ways to perform this calculation, using
objects from the base R system and using objects in the classes deļ¬ned
in the Matrix package.
We compare the speed of some of these methods on a very small ex-
ample and on a example for which the model matrix is large and sparse.
1 Linear least squares calculations
Many statistical techniques require least squares solutions
Ī² = arg min
Ī²
y ā XĪ²
2
(1)
where X is an n Ć p model matrix (p ā¤ n), y is n-dimensional and Ī² is p
dimensional. Most statistics texts state that the solution to (1) is
Ī² = XT
X
ā1
XT
y (2)
when X has full column rank (i.e. the columns of X are linearly independent)
and all too frequently it is calculated in exactly this way.
1.1 A small example
As an example, letās create a model matrix, mm, and corresponding response
vector, y, for a simple linear regression model using the Formaldehyde data.
> data(Formaldehyde)
> str(Formaldehyde)
'data.frame': 6 obs. of 2 variables:
$ carb : num 0.1 0.3 0.5 0.6 0.7 0.9
$ optden: num 0.086 0.269 0.446 0.538 0.626 0.782
1
2. > (m <- cbind(1, Formaldehyde$carb))
[,1] [,2]
[1,] 1 0.1
[2,] 1 0.3
[3,] 1 0.5
[4,] 1 0.6
[5,] 1 0.7
[6,] 1 0.9
> (yo <- Formaldehyde$optden)
[1] 0.086 0.269 0.446 0.538 0.626 0.782
Using t to evaluate the transpose, solve to take an inverse, and the %*% operator
for matrix multiplication, we can translate 2 into the S language as
> solve(t(m) %*% m) %*% t(m) %*% yo
[,1]
[1,] 0.005085714
[2,] 0.876285714
On modern computers this calculation is performed so quickly that it cannot
be timed accurately in R 1
> system.time(solve(t(m) %*% m) %*% t(m) %*% yo)
user system elapsed
0 0 0
and it provides essentially the same results as the standard lm.fit function that
is called by lm.
> dput(c(solve(t(m) %*% m) %*% t(m) %*% yo))
c(0.00508571428571428, 0.876285714285715)
> dput(unname(lm.fit(m, yo)$coefficients))
c(0.00508571428571408, 0.876285714285715)
1From R version 2.2.0, system.time() has default argument gcFirst = TRUE which is as-
sumed and relevant for all subsequent timings
2
3. 1.2 A large example
For a large, ill-conditioned least squares problem, such as that described in
Koenker and Ng (2003), the literal translation of (2) does not perform well.
> library(Matrix)
> data(KNex, package = "Matrix")
> y <- KNex$y
> mm <- as(KNex$mm, "matrix") # full traditional matrix
> dim(mm)
[1] 1850 712
> system.time(naive.sol <- solve(t(mm) %*% mm) %*% t(mm) %*% y)
user system elapsed
3.682 0.014 3.718
Because the calculation of a ācross-productā matrix, such as XT
X or XT
y,
is a common operation in statistics, the crossprod function has been provided
to do this eļ¬ciently. In the single argument form crossprod(mm) calculates
XT
X, taking advantage of the symmetry of the product. That is, instead of
calculating the 7122
= 506944 elements of XT
X separately, it only calculates
the (712 Ā· 713)/2 = 253828 elements in the upper triangle and replicates them
in the lower triangle. Furthermore, there is no need to calculate the inverse of
a matrix explicitly when solving a linear system of equations. When the two
argument form of the solve function is used the linear system
XT
X Ī² = XT
y (3)
is solved directly.
Combining these optimizations we obtain
> system.time(cpod.sol <- solve(crossprod(mm), crossprod(mm,y)))
user system elapsed
0.989 0.007 1.002
> all.equal(naive.sol, cpod.sol)
[1] TRUE
On this computer (2.0 GHz Pentium-4, 1 GB Memory, Gotoās BLAS, in
Spring 2004) the crossprod form of the calculation is about four times as fast as
the naive calculation. In fact, the entire crossprod solution is faster than simply
calculating XT
X the naive way.
> system.time(t(mm) %*% mm)
3
4. user system elapsed
1.840 0.001 1.854
Note that in newer versions of R and the BLAS library (as of summer 2007),
Rās %*% is able to detect the many zeros in mm and shortcut many operations, and
is hence much faster for such a sparse matrix than crossprod which currently
does not make use of such optimizations. This is not the case when R is linked
against an optimized BLAS library such as GOTO or ATLAS. Also, for fully
dense matrices, crossprod() indeed remains faster (by a factor of two, typically)
independently of the BLAS library:
> fm <- mm
> set.seed(11)
> fm[] <- rnorm(length(fm))
> system.time(c1 <- t(fm) %*% fm)
user system elapsed
1.922 0.002 1.937
> system.time(c2 <- crossprod(fm))
user system elapsed
0.890 0.000 0.896
> stopifnot(all.equal(c1, c2, tol = 1e-12))
1.3 Least squares calculations with Matrix classes
The crossprod function applied to a single matrix takes advantage of symme-
try when calculating the product but does not retain the information that the
product is symmetric (and positive semideļ¬nite). As a result the solution of (3)
is performed using general linear system solver based on an LU decomposition
when it would be faster, and more stable numerically, to use a Cholesky decom-
position. The Cholesky decomposition could be used but it is rather awkward
> system.time(ch <- chol(crossprod(mm)))
user system elapsed
0.965 0.000 0.972
> system.time(chol.sol <-
+ backsolve(ch, forwardsolve(ch, crossprod(mm, y),
+ upper = TRUE, trans = TRUE)))
user system elapsed
0.012 0.000 0.012
> stopifnot(all.equal(chol.sol, naive.sol))
4
5. The Matrix package uses the S4 class system (Chambers, 1998) to retain
information on the structure of matrices from the intermediate calculations.
A general matrix in dense storage, created by the Matrix function, has class
"dgeMatrix" but its cross-product has class "dpoMatrix". The solve methods
for the "dpoMatrix" class use the Cholesky decomposition.
> mm <- as(KNex$mm, "dgeMatrix")
> class(crossprod(mm))
[1] "dpoMatrix"
attr(,"package")
[1] "Matrix"
> system.time(Mat.sol <- solve(crossprod(mm), crossprod(mm, y)))
user system elapsed
0.962 0.000 0.967
> stopifnot(all.equal(naive.sol, unname(as(Mat.sol,"matrix"))))
Furthermore, any method that calculates a decomposition or factorization
stores the resulting factorization with the original object so that it can be reused
without recalculation.
> xpx <- crossprod(mm)
> xpy <- crossprod(mm, y)
> system.time(solve(xpx, xpy))
user system elapsed
0.096 0.000 0.097
> system.time(solve(xpx, xpy)) # reusing factorization
user system elapsed
0.001 0.000 0.001
The model matrix mm is sparse; that is, most of the elements of mm are zero.
The Matrix package incorporates special methods for sparse matrices, which
produce the fastest results of all.
> mm <- KNex$mm
> class(mm)
[1] "dgCMatrix"
attr(,"package")
[1] "Matrix"
> system.time(sparse.sol <- solve(crossprod(mm), crossprod(mm, y)))
5
6. user system elapsed
0.006 0.000 0.005
> stopifnot(all.equal(naive.sol, unname(as(sparse.sol, "matrix"))))
As with other classes in the Matrix package, the dsCMatrix retains any
factorization that has been calculated although, in this case, the decomposition
is so fast that it is diļ¬cult to determine the diļ¬erence in the solution times.
> xpx <- crossprod(mm)
> xpy <- crossprod(mm, y)
> system.time(solve(xpx, xpy))
user system elapsed
0.002 0.000 0.002
> system.time(solve(xpx, xpy))
user system elapsed
0.001 0.000 0.000
Session Info
> toLatex(sessionInfo())
ā¢ R version 2.15.1 Patched (2012-09-01 r60539),
x86_64-unknown-linux-gnu
ā¢ Locale: LC_CTYPE=de_CH.UTF-8, LC_NUMERIC=C, LC_TIME=en_US.UTF-8,
LC_COLLATE=C, LC_MONETARY=en_US.UTF-8, LC_MESSAGES=de_CH.UTF-8,
LC_PAPER=C, LC_NAME=C, LC_ADDRESS=C, LC_TELEPHONE=C,
LC_MEASUREMENT=de_CH.UTF-8, LC_IDENTIFICATION=C
ā¢ Base packages: base, datasets, grDevices, graphics, methods, stats, tools,
utils
ā¢ Other packages: Matrix 1.0-9, lattice 0.20-10
ā¢ Loaded via a namespace (and not attached): grid 2.15.1
> if(identical(1L, grep("linux", R.version[["os"]]))) { ## Linux - only ---
+ Scpu <- sfsmisc::Sys.procinfo("/proc/cpuinfo")
+ Smem <- sfsmisc::Sys.procinfo("/proc/meminfo")
+ print(Scpu[c("model name", "cpu MHz", "cache size", "bogomips")])
+ print(Smem[c("MemTotal", "SwapTotal")])
+ }
6
7. _
model name AMD Phenom(tm) II X4 925 Processor
cpu MHz 800.000
cache size 512 KB
bogomips 5599.95
_
MemTotal 7920288 kB
SwapTotal 16777212 kB
References
John M. Chambers. Programming with Data. Springer, New York, 1998. ISBN
0-387-98503-4.
Roger Koenker and Pin Ng. SparseM: A sparse matrix package for R. J. of
Statistical Software, 8(6), 2003.
7