Skip to content

Commit ac6f54c

Browse files
committed
format files
1 parent c1fbedd commit ac6f54c

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

src/qobj/quantum_object_base.jl

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,47 +169,67 @@ check_dimensions(A::AbstractQuantumObject...) = check_dimensions(A)
169169

170170
function _check_QuantumObject(type::KetQuantumObject, dimensions::Dimensions, m::Int, n::Int)
171171
(n != 1) && throw(DomainError((m, n), "The size of the array is not compatible with Ket"))
172-
(prod(dimensions) != m) && throw(DimensionMismatch("Ket with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."))
172+
(prod(dimensions) != m) && throw(
173+
DimensionMismatch("Ket with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."),
174+
)
173175
return nothing
174176
end
175177

176178
function _check_QuantumObject(type::BraQuantumObject, dimensions::Dimensions, m::Int, n::Int)
177179
(m != 1) && throw(DomainError((m, n), "The size of the array is not compatible with Bra"))
178-
(prod(dimensions) != n) && throw(DimensionMismatch("Bra with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."))
180+
(prod(dimensions) != n) && throw(
181+
DimensionMismatch("Bra with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."),
182+
)
179183
return nothing
180184
end
181185

182186
function _check_QuantumObject(type::OperatorQuantumObject, dimensions::Dimensions, m::Int, n::Int)
183187
L = prod(dimensions)
184-
(L == m == n) || throw(DimensionMismatch("Operator with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."))
188+
(L == m == n) || throw(
189+
DimensionMismatch(
190+
"Operator with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n)).",
191+
),
192+
)
185193
return nothing
186194
end
187195

188196
function _check_QuantumObject(type::OperatorQuantumObject, dimensions::GeneralDimensions, m::Int, n::Int)
189197
((m == 1) || (n == 1)) && throw(DomainError((m, n), "The size of the array is not compatible with Operator"))
190-
((prod(dimensions.to) != m) || (prod(dimensions.from) != n)) &&
191-
throw(DimensionMismatch("Operator with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."))
198+
((prod(dimensions.to) != m) || (prod(dimensions.from) != n)) && throw(
199+
DimensionMismatch(
200+
"Operator with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n)).",
201+
),
202+
)
192203
return nothing
193204
end
194205

195206
function _check_QuantumObject(type::SuperOperatorQuantumObject, dimensions::Dimensions, m::Int, n::Int)
196207
(m != n) && throw(DomainError((m, n), "The size of the array is not compatible with SuperOperator"))
197-
(prod(dimensions) != sqrt(m)) &&
198-
throw(DimensionMismatch("SuperOperator with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."))
208+
(prod(dimensions) != sqrt(m)) && throw(
209+
DimensionMismatch(
210+
"SuperOperator with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n)).",
211+
),
212+
)
199213
return nothing
200214
end
201215

202216
function _check_QuantumObject(type::OperatorKetQuantumObject, dimensions::Dimensions, m::Int, n::Int)
203217
(n != 1) && throw(DomainError((m, n), "The size of the array is not compatible with OperatorKet"))
204-
(prod(dimensions) != sqrt(m)) &&
205-
throw(DimensionMismatch("OperatorKet with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."))
218+
(prod(dimensions) != sqrt(m)) && throw(
219+
DimensionMismatch(
220+
"OperatorKet with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n)).",
221+
),
222+
)
206223
return nothing
207224
end
208225

209226
function _check_QuantumObject(type::OperatorBraQuantumObject, dimensions::Dimensions, m::Int, n::Int)
210227
(m != 1) && throw(DomainError((m, n), "The size of the array is not compatible with OperatorBra"))
211-
(prod(dimensions) != sqrt(n)) &&
212-
throw(DimensionMismatch("OperatorBra with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n))."))
228+
(prod(dimensions) != sqrt(n)) && throw(
229+
DimensionMismatch(
230+
"OperatorBra with dims = $(_get_dims_string(dimensions)) does not fit the array size = $((m, n)).",
231+
),
232+
)
213233
return nothing
214234
end
215235

0 commit comments

Comments
 (0)