@@ -20,12 +20,7 @@ eigs_sym.undirected_factor_model <- function(
20
20
which = " LM" , sigma = NULL ,
21
21
opts = list (),
22
22
... ) {
23
- if (! requireNamespace(" RSpectra" , quietly = TRUE )) {
24
- stop(
25
- " Must install `RSpectra` for this functionality." ,
26
- call. = FALSE
27
- )
28
- }
23
+ rlang :: check_installed(" RSpectra" )
29
24
30
25
Ax <- function (x , args ) as.numeric(args $ X %*% (args $ SXt %*% x ))
31
26
@@ -48,12 +43,7 @@ svds.undirected_factor_model <- function(
48
43
nv = k ,
49
44
opts = list (),
50
45
... ) {
51
- if (! requireNamespace(" RSpectra" , quietly = TRUE )) {
52
- stop(
53
- " Must install `RSpectra` for this functionality." ,
54
- call. = FALSE
55
- )
56
- }
46
+ rlang :: check_installed(" RSpectra" )
57
47
58
48
Ax <- function (x , args ) {
59
49
as.numeric(args $ X %*% (tcrossprod(args $ S , args $ X ) %*% x ))
@@ -92,12 +82,7 @@ svds.directed_factor_model <- function(
92
82
nv = k ,
93
83
opts = list (),
94
84
... ) {
95
- if (! requireNamespace(" RSpectra" , quietly = TRUE )) {
96
- stop(
97
- " Must install `RSpectra` for this functionality." ,
98
- call. = FALSE
99
- )
100
- }
85
+ rlang :: check_installed(" RSpectra" )
101
86
102
87
Ax <- function (x , args ) {
103
88
as.numeric(args $ X %*% (tcrossprod(args $ S , args $ Y ) %*% x ))
0 commit comments